Skip to main content
Version: 2.x

Market

 License: MIT 

Installation

pom.xml
<dependency>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<version>{{version}}</version>
</dependency>

Client instantiation

MarketDataClient client = new MarketDataClient(key, secret);

Features

Test connectivity

client.ping().sync();

Get server time

try{
ServerTimeRespons res = client.getServerTime().sync();
}catch(ApiException e){
//...
}

Get exchange info

try{
ExchangeInfo res = client.getExchangeInfo().sync();
}catch(ApiException e){
//...
}

Get a symbol's order book

try{
OrderBook res = client.getOrderBook(new OrderBookParams(symbol)).sync();
}catch(ApiException e){
//...
}
caution

The String value must match one of the OrderBookLimit values or the request will fail

Get recent trades

try{
List<Trade> res = client.getTrades(new TradesParams(symbol)).sync();
}catch(ApiException e){
//...
}

Get historical trades

try{
List<Trade> res = client.getHistoricalTrades(new TradesParams(symbol)).sync();
}catch(ApiException e){
//...
}

Get compressed/aggregate trades List

try{
List<AggTrade> res = client.getAggTrades(new AggTradeParams(symbol)).sync();
}catch(ApiException e){
//...
}

Get Klines / candles

try{
List<Candle> res = client.getKlines(new KlinesParams(symbol, CandlestickInterval.ONE_MINUTE)).sync();
}catch(ApiException e){
//...
}
caution

The String interval must correspond to one of the CandlestickInterval else the request will throw an ApiException

Get average price

try{
AveragePrice res = client.getAveragePrice(new AveragePriceParams(symbol)).sync();
}catch(ApiException e){
//...
}

Get 24h ticker statistics

try{
TickerStatistics res = client.get24hTickerStatistics(new TickerStatisticsParams(symbol)).sync();
}catch(ApiException e){
//...
}
try{
List<TickersStatistics> res = client.get24hTickerStatistics().sync();
}catch(ApiException e){
//...
}

Get price ticker

try{
PriceTicker res = client.getTicker(new PriceTickerParams(symbol)).sync();
}catch(ApiException e){
//...
}
try{
List<PriceTicker> res = client.getTicker().sync();
}catch(ApiException e){
//...
}

Get order book ticker

try{
OrderBook res = client.getOrderBook(new OrderBookParams(symbol)).sync();
}catch(ApiException e){
//...
}
caution

The String value must match one of the OrderBookLimit values or the request will fail