A java implementation of the Binance API Specification
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

package com.sigmaflare.binancej;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import java.io.IOException;
public abstract class BaseBinanceApi {
protected final String apiKey;
protected final String secretKey;
protected final CloseableHttpClient closeableHttpClient;
protected static final ObjectMapper mapper = Helpers.objectMapperBuilder();
public BaseBinanceApi(String apiKey, String secretKey) {
this.apiKey = apiKey;
this.secretKey = secretKey;
this.closeableHttpClient = HttpClientBuilder.create().build();
}
public BaseBinanceApi(String apiKey, String secretKey, CloseableHttpClient closeableHttpClient) {
this.apiKey = apiKey;
this.secretKey = secretKey;
this.closeableHttpClient = closeableHttpClient;
}
public void close() throws IOException {
closeableHttpClient.close();
}
@Override
protected void finalize() throws IOException {
close();
}
}