This Java library implements all the methods and types in the API of bx.in.th except the Options API. BX is a Thai cryptocurrency exchange.
If you find a bug or know some way to improve the library please report it to me as an issue or in private.
- Full implementation of the Public API, Private API and Private Bill Payment API
- Javadoc
- Errors automatically turned into exceptions
private static BxApi bx = new BxApi();
Ticker[] tickers = bx.getMarketData();
for (Ticker ticker : tickers) {
// ...
}
To access the private API you need an account at BX and you need to generate an API key at your account area. Make sure you create a key that only has access to the functionality you need and enable 2FA if appropriate.
private static BxApi bx = new BxApi(YOUR_API_KEY, YOUR_API_SECRET);
Balances balances = bx.getBalances(null);
Balance btcBalance = balances.get("BTC");
All errors will result in exceptions being thrown by the methods. You can simply catch IOException or add additional handling for BxApiException and HttpResponseException.
try {
Pairing[] pairings = bx.getCurrencyPairings();
for (Pairing pairing : pairings) {
// Do something with each pairing
}
} catch (BxApiException e) {
// Error from BX. Check e.getMessage().
} catch (HttpResponseException e) {
// Unexpected response code from BX. Check e.getResponseCode() and e.getMessage().
} catch (IOException e) {
// Communication error, for instance connection error or timeout
}
The project depends on GSON 2.8.2.
No binaries published yet.
A pom.xml for Maven is included in the project. For other options just make sure you include GSON 2.8.2 or later.