forked from binance-exchange/binance-java-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGeneralEndpointsExample.java
More file actions
executable file
·39 lines (31 loc) · 1.44 KB
/
GeneralEndpointsExample.java
File metadata and controls
executable file
·39 lines (31 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.binance.api.examples;
import com.binance.api.client.api.sync.BinanceApiSpotRestClient;
import com.binance.api.client.domain.general.ExchangeInfo;
import com.binance.api.client.domain.general.FilterType;
import com.binance.api.client.domain.general.SymbolFilter;
import com.binance.api.client.domain.general.SymbolInfo;
import com.binance.api.client.factory.BinanceSpotApiClientFactory;
/**
* Examples on how to use the general endpoints.
*/
public class GeneralEndpointsExample {
public static void main(String[] args) {
BinanceSpotApiClientFactory factory = BinanceSpotApiClientFactory.newInstance();
BinanceApiSpotRestClient client = factory.newRestClient();
// Test connectivity
client.ping();
// Check server time
long serverTime = client.getServerTime();
System.out.println(serverTime);
// Exchange info
ExchangeInfo exchangeInfo = client.getExchangeInfo();
System.out.println(exchangeInfo.getTimezone());
System.out.println(exchangeInfo.getSymbols());
// Obtain symbol information
SymbolInfo symbolInfo = exchangeInfo.getSymbolInfo("ETHBTC");
System.out.println(symbolInfo.getStatus());
SymbolFilter priceFilter = symbolInfo.getSymbolFilter(FilterType.PRICE_FILTER);
System.out.println(priceFilter.getMinPrice());
System.out.println(priceFilter.getTickSize());
}
}