Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Before using the connectors, ensure you have:

## Available Connectors
- [binance-algo](clients/algo) - Algo Trading connector
- [binance-alpha](clients/alpha) - Alpha connector
- [binance-c2c](clients/c2c) - C2C connector
- [binance-convert](clients/convert) - Convert connector
- [binance-copy-trading](clients/copy-trading) - Copy Trading connector
Expand Down Expand Up @@ -208,6 +209,8 @@ When creating WebSocket API clients (such as SpotWebSocketApi), you can follow:
## Examples
**Algo**: [Rest API](clients/algo/example_rest.md)

**Alpha**: [Rest API](clients/alpha/example_rest.md)

**C2c**: [Rest API](clients/c2c/example_rest.md)

**Convert**: [Rest API](clients/convert/example_rest.md)
Expand Down
5 changes: 5 additions & 0 deletions clients/alpha/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0 - 2026-01-20

- Initial release
162 changes: 162 additions & 0 deletions clients/alpha/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Binance Java Alpha Connector

[![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-java)](https://github.com/binance/binance-connector-java/issues)
[![Code Style: Spotless](https://img.shields.io/badge/code%20style-spotless-ff69b4)](https://github.com/diffplug/spotless)
[![Maven Central Version](https://img.shields.io/maven-central/v/io.github.binance/binance-alpha)](https://central.sonatype.com/artifact/io.github.binance/binance-alpha)
![Java Version](https://img.shields.io/badge/Java-%3E=11-brightgreen)
[![Known Vulnerabilities](https://snyk.io/test/github/binance/binance-connector-java/badge.svg)](https://snyk.io/test/github/binance/binance-connector-java)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This is a client library for the Binance Alpha API, enabling developers to interact programmatically with Binance Alpha. The library provides tools to access curated early-stage token data, track Alpha project metrics and integrate discovery-focused market information into applications through the REST API:

- [REST API](./src/main/java/com/binance/connector/client/alpha/rest/api)

## Table of Contents

- [Supported Features](#supported-features)
- [Installation](#installation)
- [Documentation](#documentation)
- [REST APIs](#rest-apis)
- [Testing](#testing)
- [Migration Guide](#migration-guide)
- [Contributing](#contributing)
- [License](#license)

## Supported Features

- REST API Endpoints:
- `/bapi/defi/v1/*`
- Inclusion of test cases and examples for quick onboarding.

## Installation

To use this library, ensure your environment is running Java version **11** or newer.

Then add dependency to pom.xml:

```xml
<dependency>
<groupId>io.github.binance</groupId>
<artifactId>binance-alpha</artifactId>
<version>1.1.0</version>
</dependency>
```

## Documentation

For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/alpha).

### REST APIs

All REST API endpoints are available through the [`rest`](./src/main/java/com/binance/connector/client/alpha/rest) module. Note that some endpoints require authentication using your Binance API credentials.

```java
import com.binance.connector.client.alpha.rest.AlphaRestApiUtil;
import com.binance.connector.client.alpha.rest.api.AlphaRestApi;
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 = AlphaRestApiUtil.getClientConfiguration();
SignatureConfiguration signatureConfiguration = new SignatureConfiguration();
signatureConfiguration.setApiKey("apiKey");
signatureConfiguration.setPrivateKey("path/to/private.key");
clientConfiguration.setSignatureConfiguration(signatureConfiguration);
AlphaRestApi api = new AlphaRestApi(clientConfiguration);
}
```

More examples can be found in the [`examples/rest`](./../../examples/alpha/src/main/java/com/binance/connector/client/alpha/rest) folder.

#### Configuration Options

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 Key
- `secretKey`: Binance Secret Key, if using HMAC algorithm
- `privateKey`: RSA or ED25519 private key for authentication.
- `privateKeyPass`: Passphrase for the private key, if encrypted.

##### Timeout

You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest-api/timeout.md) for detailed usage.

##### Proxy

The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest-api/proxy.md) for detailed usage.

##### Keep-Alive

Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest-api/keepAlive.md) for detailed usage.

##### Compression

Enable or disable response compression. See the [Compression example](./docs/rest-api/compression.md) for detailed usage.

##### Retries

Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest-api/retries.md) for detailed usage.

##### Key Pair Based Authentication

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](./docs/rest-api/key-pair-authentication.md) for detailed usage.

##### Certificate Pinning

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](./docs/rest-api/certificate-pinning.md) for detailed usage.

#### Error Handling

The REST API provides detailed error types to help you handle issues effectively:

- `ConnectorClientError`: General client error.

See the [Error Handling example](./docs/rest-api/error-handling.md) for detailed usage.

If `basePath` is not provided, it defaults to `https://api.binance.com`.

## Testing

To run the tests:

```bash
mvn -f clients/pom.xml -pl alpha test
```

The tests cover:

- REST API endpoints
- Signature generation

## Migration Guide

If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/rest-api/migration-guide.md) for detailed steps.

## Contributing

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:

1. Open a GitHub issue describing your suggestion or the bug you've identified.
2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.

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!

## License

This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.
16 changes: 16 additions & 0 deletions clients/alpha/docs/AggregatedTradesResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


# AggregatedTradesResponse


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**code** | **String** | | [optional] |
|**message** | **String** | | [optional] |
|**messageDetail** | **String** | | [optional] |
|**data** | [**List&lt;AggregatedTradesResponseDataInner&gt;**](AggregatedTradesResponseDataInner.md) | | [optional] |



19 changes: 19 additions & 0 deletions clients/alpha/docs/AggregatedTradesResponseDataInner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@


# AggregatedTradesResponseDataInner


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**aLowerCase** | **Long** | | [optional] |
|**pLowerCase** | **String** | | [optional] |
|**qLowerCase** | **String** | | [optional] |
|**fLowerCase** | **Long** | | [optional] |
|**lLowerCase** | **Long** | | [optional] |
|**T** | **Long** | | [optional] |
|**mLowerCase** | **Boolean** | | [optional] |



17 changes: 17 additions & 0 deletions clients/alpha/docs/GetExchangeInfoResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


# GetExchangeInfoResponse


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**code** | **String** | | [optional] |
|**message** | **String** | | [optional] |
|**messageDetail** | **String** | | [optional] |
|**success** | **Boolean** | | [optional] |
|**data** | [**GetExchangeInfoResponseData**](GetExchangeInfoResponseData.md) | | [optional] |



16 changes: 16 additions & 0 deletions clients/alpha/docs/GetExchangeInfoResponseData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


# GetExchangeInfoResponseData


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**timezone** | **String** | | [optional] |
|**assets** | [**List&lt;GetExchangeInfoResponseDataAssetsInner&gt;**](GetExchangeInfoResponseDataAssetsInner.md) | | [optional] |
|**symbols** | [**List&lt;GetExchangeInfoResponseDataSymbolsInner&gt;**](GetExchangeInfoResponseDataSymbolsInner.md) | | [optional] |
|**orderTypes** | **String** | | [optional] |



13 changes: 13 additions & 0 deletions clients/alpha/docs/GetExchangeInfoResponseDataAssetsInner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


# GetExchangeInfoResponseDataAssetsInner


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**asset** | **String** | | [optional] |



22 changes: 22 additions & 0 deletions clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


# GetExchangeInfoResponseDataSymbolsInner


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**symbol** | **String** | | [optional] |
|**status** | **String** | | [optional] |
|**baseAsset** | **String** | | [optional] |
|**quoteAsset** | **String** | | [optional] |
|**pricePrecision** | **Long** | | [optional] |
|**quantityPrecision** | **Long** | | [optional] |
|**baseAssetPrecision** | **Long** | | [optional] |
|**quotePrecision** | **Long** | | [optional] |
|**filters** | [**List&lt;GetExchangeInfoResponseDataSymbolsInnerFiltersInner&gt;**](GetExchangeInfoResponseDataSymbolsInnerFiltersInner.md) | | [optional] |
|**orderTypes** | **List&lt;String&gt;** | | [optional] |



Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@


# GetExchangeInfoResponseDataSymbolsInnerFiltersInner


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**filterType** | **String** | | [optional] |
|**minPrice** | **String** | | [optional] |
|**maxPrice** | **String** | | [optional] |
|**tickSize** | **String** | | [optional] |
|**stepSize** | **String** | | [optional] |
|**maxQty** | **String** | | [optional] |
|**minQty** | **String** | | [optional] |
|**limit** | **Long** | | [optional] |
|**minNotional** | **String** | | [optional] |
|**maxNotional** | **String** | | [optional] |
|**multiplierDown** | **String** | | [optional] |
|**multiplierUp** | **String** | | [optional] |
|**bidMultiplierUp** | **String** | | [optional] |
|**askMultiplierUp** | **String** | | [optional] |
|**bidMultiplierDown** | **String** | | [optional] |
|**askMultiplierDown** | **String** | | [optional] |



17 changes: 17 additions & 0 deletions clients/alpha/docs/KlinesResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


# KlinesResponse


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**code** | **String** | | [optional] |
|**message** | **String** | | [optional] |
|**messageDetail** | **String** | | [optional] |
|**success** | **Boolean** | | [optional] |
|**data** | **List&lt;KlinesResponseDataItem&gt;** | | [optional] |



12 changes: 12 additions & 0 deletions clients/alpha/docs/KlinesResponseDataItem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


# KlinesResponseDataItem


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|



12 changes: 12 additions & 0 deletions clients/alpha/docs/KlinesResponseDataItemInner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


# KlinesResponseDataItemInner


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|



Loading
Loading