Vision
Description
Binance4j-vision is a Java connector for the public data endpoints of the Binance REST API.
Installation
Dependencies
- binance4j-core : The core of every binance4j artifact
- Lombok : Prevent boilerplate code.
- OkHttp : HTTP && Websocket clients
- Retrofit : Map API endpoints with annotations.
- Jackson : Payload deserialization
- Apache Common Codecs : Encode/decode urls
- Maven
- Gradle
pom.xml
<dependency>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<version>{{version}}</version>
</dependency>
build.gradle
implementation '{{groupId}}:{{artifactId}}:{{version}}'
SPOT endpoints
Get klines
- Zipped
- In a CSV format / 2D List
- Deserialized
- Get Checksum
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
ZipInputStream response = client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getZip();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getZip(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getZip(new ApiCallback<ZipInputStream>() {
@Override
public void onResponse(ZipInputStream response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
ZipInputStream response = client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getZip();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getZip(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getZip(new ApiCallback<ZipInputStream>() {
@Override
public void onResponse(ZipInputStream response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<List<String>> response = client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getCSV();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getCSV(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getCSV(new ApiCallback<List<List<String>>>() {
@Override
public void onResponse(List<List<String>> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<List<String>> response = client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getCSV();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getCSV(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getCSV(new ApiCallback<List<List<String>>>() {
@Override
public void onResponse(List<List<String>> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<CandlestickBar> response = client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getData();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getData(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getData(new ApiCallback<List<CandlestickBar>>() {
@Override
public void onResponse(List<CandlestickBar> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<CandlestickBar> response = client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getData();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getData(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlines("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getData(new ApiCallback<List<CandlestickBar>>() {
@Override
public void onResponse(List<CandlestickBar> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
Checksum response = client.getKlinesChecksum("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getChecksum();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlinesChecksum("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getChecksum(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlinesChecksum("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01").getChecksum(new ApiCallback<Checksum>() {
@Override
public void onResponse(Checksum response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
Checksum response = client.getKlinesChecksum("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getChecksum();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getKlinesChecksum("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getChecksum(response->{
//...
});
SpotClient client = new SpotClient();
client.getKlinesChecksum("BNBBTC", CandlestickInterval.FIVE_MINUTE, "2022", "01", "25").getChecksum(new ApiCallback<Checksum>() {
@Override
public void onResponse(Checksum response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
Get trades
- Zipped
- In a CSV format / 2D List
- Deserialized
- Get Checksum
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
ZipInputStream response = client.getTrades("BNBBTC", "2022", "01").getZip();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01").getZip(response->{
//...
});
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01").getZip(new ApiCallback<ZipInputStream>() {
@Override
public void onResponse(ZipInputStream response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
ZipInputStream response = client.getTrades("BNBBTC", "2022", "01", "25").getZip();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01", "25").getZip(response->{
//...
});
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01", "25").getZip(new ApiCallback<ZipInputStream>() {
@Override
public void onResponse(ZipInputStream response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<List<String>> response = client.getTrades("BNBBTC", "2022", "01").getCSV();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01").getCSV(response->{
//...
});
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01").getCSV(new ApiCallback<List<List<String>>>() {
@Override
public void onResponse(List<List<String>> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<List<String>> response = client.getTrades("BNBBTC", "2022", "01", "25").getCSV();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01", "25").getCSV(response->{
//...
});
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01", "25").getCSV(new ApiCallback<List<List<String>>>() {
@Override
public void onResponse(List<List<String>> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<Trade> response = client.getTrades("BNBBTC", "2022", "01").getData();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01").getData(response->{
//...
});
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01").getData(new ApiCallback<List<Trade>>() {
@Override
public void onResponse(List<Trade> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<Trade> response = client.getTrades("BNBBTC", "2022", "01", "25").getData();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01", "25").getData(response->{
//...
});
SpotClient client = new SpotClient();
client.getTrades("BNBBTC", "2022", "01", "25").getData(new ApiCallback<List<Trade>>() {
@Override
public void onResponse(List<Trade> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
Checksum response = client.getTradesChecksum("BNBBTC", "2022", "01").getChecksum();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTradesChecksum("BNBBTC", "2022", "01").getChecksum(response->{
//...
});
SpotClient client = new SpotClient();
client.getTradesChecksum("BNBBTC", "2022", "01").getChecksum(new ApiCallback<Checksum>() {
@Override
public void onResponse(Checksum response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
Checksum response = client.getTradesChecksum("BNBBTC", "2022", "01", "25").getChecksum();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getTradesChecksum("BNBBTC", "2022", "01", "25").getChecksum(response->{
//...
});
SpotClient client = new SpotClient();
client.getTradesChecksum("BNBBTC", "2022", "01", "25").getChecksum(new ApiCallback<Checksum>() {
@Override
public void onResponse(Checksum response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
Get aggregate trades
- Zipped
- In a CSV format / 2D List
- Deserialized
- Get Checksum
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
ZipInputStream response = client.getAggTrades("BNBBTC", "2022", "01").getZip();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01").getZip(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01").getZip(new ApiCallback<ZipInputStream>() {
@Override
public void onResponse(ZipInputStream response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
ZipInputStream response = client.getAggTrades("BNBBTC", "2022", "01", "25").getZip();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01", "25").getZip(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01", "25").getZip(new ApiCallback<ZipInputStream>() {
@Override
public void onResponse(ZipInputStream response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<List<String>> response = client.getAggTrades("BNBBTC", "2022", "01").getCSV();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01").getCSV(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01").getCSV(new ApiCallback<List<List<String>>>() {
@Override
public void onResponse(List<List<String>> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
List<List<String>> response = client.getAggTrades("BNBBTC", "2022", "01", "25").getCSV();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01", "25").getCSV(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01", "25").getCSV(new ApiCallback<List<List<String>>>() {
@Override
public void onResponse(List<List<String>> response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
AggTrade response = client.getAggTrades("BNBBTC", "2022", "01").getData();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01").getData(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01").getData(new ApiCallback<AggTrade>() {
@Override
public void onResponse(AggTrade response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
AggTrade response = client.getAggTrades("BNBBTC", "2022", "01", "25").getData();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01", "25").getData(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTrades("BNBBTC", "2022", "01", "25").getData(new ApiCallback<AggTrade>() {
@Override
public void onResponse(AggTrade response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Monthly
- Daily
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
Checksum response = client.getAggTradesChecksum("BNBBTC", "2022", "01").getChecksum();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTradesChecksum("BNBBTC", "2022", "01").getChecksum(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTradesChecksum("BNBBTC", "2022", "01").getChecksum(new ApiCallback<Checksum>() {
@Override
public void onResponse(Checksum response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});
- Synchronous request
- Asynchronous request with lambda
- Asynchronous request with ApiCallback
SpotClient client = new SpotClient();
try{
Checksum response = client.getAggTradesChecksum("BNBBTC", "2022", "01", "25").getChecksum();
}catch(ApiException e){
//...
}
SpotClient client = new SpotClient();
client.getAggTradesChecksum("BNBBTC", "2022", "01", "25").getChecksum(response->{
//...
});
SpotClient client = new SpotClient();
client.getAggTradesChecksum("BNBBTC", "2022", "01", "25").getChecksum(new ApiCallback<Checksum>() {
@Override
public void onResponse(Checksum response) {
//...
}
@Override
public void onFailure(ApiException exception) {
//...
}
});