|Taylor Bockman 42abdde19a Bump version, move central repo to xchg||1 year ago|
|.circleci||1 year ago|
|.github||1 year ago|
|gradle/wrapper||1 year ago|
|src||1 year ago|
|.codeclimate.yml||1 year ago|
|.gitignore||1 year ago|
|CONTRIBUTING.md||1 year ago|
|LICENSE||1 year ago|
|README.md||1 year ago|
|build.gradle||1 year ago|
|gradlew||1 year ago|
|gradlew.bat||1 year ago|
|settings.gradle||1 year 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.