This is a client library for the Binance Fiat API, enabling developers to interact programmatically with Binance’s Fiat trading platform. The library provides tools to get Binance Fiat Deposit/Withdraw history through the REST API:
/sapi/v1/fiat/*
To use this library, ensure your environment is running Java version 11 or newer.
Then add dependency to pom.xml:
<dependency>
<groupId>io.github.binance</groupId>
<artifactId>binance-fiat</artifactId>
<version>1.1.0</version>
</dependency>
For detailed information, refer to the Binance API Documentation.
All REST API endpoints are available through the rest
module. Note that some endpoints require authentication using your Binance API credentials.
import com.binance.connector.client.fiat.rest.FiatRestApiUtil;
import com.binance.connector.client.fiat.rest.api.FiatRestApi;
import com.binance.connector.client.common.ApiException;
import com.binance.connector.client.common.ApiResponse;
import com.binance.connector.client.common.configuration.ClientConfiguration;
import com.binance.connector.client.common.configuration.SignatureConfiguration;
public static void main(String[] args) {
ClientConfiguration clientConfiguration = FiatRestApiUtil.getClientConfiguration();
SignatureConfiguration signatureConfiguration = new SignatureConfiguration();
signatureConfiguration.setApiKey("apiKey");
signatureConfiguration.setPrivateKey("path/to/private.key");
clientConfiguration.setSignatureConfiguration(signatureConfiguration);
FiatRestApi api = new FiatRestApi(clientConfiguration);
}
More examples can be found in the examples/rest
folder.
The REST API supports the following advanced configuration options:
proxy
: Proxy configuration for http client.certificatePinner
: Certificate Pinner configuration for http client.connectTimeout
: Timeout for requests in milliseconds (default: 1000 ms).readTimeout
: Timeout for requests in milliseconds (default: 5000 ms).compression
: Enable response compression (default: true).retries
: Number of retry attempts for failed requests (default: 3).backoff
: Delay in milliseconds between retries (default: 200 ms).timeUnit
: TimeUnit to be returned by API (default MILLISECOND).apiKey
: Binance API KeysecretKey
: Binance Secret Key, if using HMAC algorithmprivateKey
: RSA or ED25519 private key for authentication.privateKeyPass
: Passphrase for the private key, if encrypted.You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the Timeout example for detailed usage.
The REST API supports HTTP/HTTPS proxy configurations. See the Proxy example for detailed usage.
Enable HTTP keep-alive for persistent connections. See the Keep-Alive example for detailed usage.
Enable or disable response compression. See the Compression example for detailed usage.
Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the Retries example for detailed usage.
The REST API supports key pair-based authentication for secure communication. You can use RSA
or ED25519
keys for signing requests. See the Key Pair Based Authentication example for detailed usage.
To enhance security, you can use certificate pinning with the httpsAgent
option in the configuration. This ensures the client only communicates with servers using specific certificates. See the Certificate Pinning example for detailed usage.
The REST API provides detailed error types to help you handle issues effectively:
ConnectorClientError
: General client error.See the Error Handling example for detailed usage.
If basePath
is not provided, it defaults to https://api.binance.com
.
To run the tests:
mvn -f clients/pom.xml -pl fiat test
The tests cover:
If you are upgrading to the new modularized structure, refer to the Migration Guide for detailed steps.
Contributions are welcome!
Since this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project’s goals and auto-generation processes.
To contribute:
Please ensure that all tests pass if you’re making a direct contribution. Submit a pull request only after discussing and confirming the change.
Thank you for your contributions!
This project is licensed under the MIT License. See the LICENSE file for details.