Usually nobody reads this text but I'll still try. Hey everybody, this is my Java lib for interaction with HitBTC API. Lets be honest, this API is dumb and not well structured (clientOrderId & client_order_id, string arguments used as integers, etc) but anyway in order to make this lib as much easy as possible I followed doc for 100%. It means if doc says you should use client_order_id key even if all other keys are CamelCased, you should follow the doc. Same with returned values, you are getting all as it wrote on https://hitbtc.com/api.
This API separates to 3 parts: REST API, Socket.io API, Streaming API. The only REST API is done. Thats enough for trading, others will be implemented later.
Dont forget to star this repo if you found this work useful.
for accessing public market data
HitBTC service = new HitBTC(APIMode.PRODUCTION); // or APIMode.DEMOto access market, trading and payment api
HitBTC service = new HitBTC(APIMode.PRODUCTION, apiKey, apiSecret);If u'll try access trading or payment api without providing apiKey and apiSecret or api keys are invalid u'll get HitBTCAccessDenied exception on calling tradeAPI() and paymentAPI() methods that are described below.
Gets current market time in UTC with milliseconds
long time = service.marketAPI().getTimestamp(); // 1393492619000https://hitbtc.com/api#symbols
ArrayList<Symbol> symbols = service.marketAPI().getAllSymbols();
for (Symbol sym : symbols) {
System.out.println(sym.symbol);
}Prints:
SCBTC
XMRBTC
BTCEUR
ZECETH
...
It's not a ticker you are thinking about. This is REST API. Means it named "ticker" but it doesnt updates itself. You have to call this method each time you want to receive current market rates.
Ticker ticker = service.marketAPI().getTickerFor("BTCUSD");Gives you an object with fields:
{
"last": "550.73",
"bid": "549.56",
"ask": "554.12",
"high": "600.1",
"low": "400.7",
"volume": "567.9",
"open": "449.73",
"volume_quote": "289002.81",
"timestamp": 1393492619000
}
ArrayList<Ticker> tickers = service.marketAPI().getTickersForAll();Gives a list of objects with structure described above
//readme not finished