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.
37 lines
1.1 KiB
37 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 = HttpRequests.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; |
|
} |
|
|
|
/** |
|
* Closes the CloseableHttpClient instance. |
|
* @throws IOException If closing fails |
|
*/ |
|
public void close() throws IOException { |
|
closeableHttpClient.close(); |
|
} |
|
}
|
|
|