|Taylor Bockman 42abdde19a Bump version, move central repo to xchg||2 years ago|
|.circleci||2 years ago|
|.github||2 years ago|
|gradle/wrapper||2 years ago|
|src||2 years ago|
|.codeclimate.yml||2 years ago|
|.gitignore||2 years ago|
|CONTRIBUTING.md||2 years ago|
|LICENSE||2 years ago|
|README.md||2 years ago|
|build.gradle||2 years ago|
|gradlew||2 years ago|
|gradlew.bat||2 years ago|
|settings.gradle||2 years ago|
A Java 8 implementation of the Binance API Specification.
<dependency> <groupId>com.sigmaflare</groupId> <artifactId>binancej</artifactId> <version>1.0.4</version> </dependency>
compile group: 'com.sigmaflare', name: 'binancej', version: '1.0.4'
BinanceJ is released under the MIT license.
BinanceJ will throw a
RateLimitExceededException when a HTTP 429 error code comes back. This is an important
exception to catch and handle because if you do not back off they will issue a temporary ban. If you don't listen,
you'll be receiving
The following endpoints are currently covered:
More will be added in future PRs as they become necessary to me or the people using the library.
Any function in the API can throw a handful of exceptions related to HTTP:
IpBannedException: Your IP has been banned after ignoring rate limit exceeded messages
RateLimitExceededException: Your IP has exceeded the rate limit and needs to slow down
InternalServiceErrorException: An error occurred on Binance's server side (see note below)
MalformedRequestException: A malformed request was sent, the error exists on the sender's side (check error code and message)
Note: A 504 error in general should not be treated as an error (though it is "exceptional" behavior). In the case of
InternalServiceErrorExceptions it is critical to check the
code member of the exception.
The "more general" HTTP exceptions (
InternalServiceErrorException) have a code
component so you can check the specifics against the Binance Error Documentation.
In the event an unknown error occurs, the code will throw an
UnexpectedErrorException. These are generally complete showstoppers.
Be sure to call
close on the API container class (
MarketData, etc) in order to close the
Dates coming in from Binance have a UTC time zone. You can check this by calling
generalUtilities.getExchangeInfo() and checking
the value of the
Dates are returned to you in the form of a
long, so understanding that the date coming back is UTC you should be able to convert
it in a straight forward way to a Java 8 Date data type.
If the ping method does not throw an exception, the ping was successful.
GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build(); generalUtilities.ping();
GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build(); ServerTime = generalUtilities.getServerTime();
GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build(); ExchangeInfo res = generalUtilities.getExchangeInfo();
MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build(); List<Candlestick> res = marketData.getCandlestickData("ETHBTC", Interval.ONE_MINUTE);
MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build(); OrderBookDepth res = marketData.getOrderBookDepth("ETHBTC", 1000);
MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build(); TickerPrice res = marketData.getTickerPriceForSymbol("ETHBTC");
Head over to our CONTRIBUTING.md to get started. All features are welcome as long as they are in scope of the API and following the contributing guide.