Skip to content

nadam/bx-java-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BX Java API

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.

Features

  • Full implementation of the Public API, Private API and Private Bill Payment API
  • Javadoc
  • Errors automatically turned into exceptions

Using the public API

private static BxApi bx = new BxApi();
Ticker[] tickers = bx.getMarketData();
for (Ticker ticker : tickers) {
    // ...
}

Using the private API

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");

Exception handling

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
}

Including in your project

Dependencies

The project depends on GSON 2.8.2.

Binary

No binaries published yet.

Building from source code

A pom.xml for Maven is included in the project. For other options just make sure you include GSON 2.8.2 or later.

License

Apache License 2.0

About

Java library for the cryptocurrency trading API at bx.in.th

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages