Skip to content

Commit 8dd92cb

Browse files
authored
Merge pull request #87 from binance/rc-release-clients-january-23
2 parents f164100 + 4c9ef59 commit 8dd92cb

File tree

321 files changed

+17020
-9490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+17020
-9490
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Before using the SDK, ensure you have:
1717
## Available SDK
1818

1919
- [binance-connector-algo](./clients/algo) - Algo Trading connector
20+
- [binance-connector-alpha](./clients/alpha/) - Alpha connector
2021
- [binance-connector-c2c](./clients/c2c/) - C2
2122
- [binance-convert](./clients/convert/) - Convert connector
2223
- [binance-copy-trading](./clients/copy-trading/) - Copy Trading connector

clients/algo/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### Changelog
22

3+
## 1.2.0 - 2026-01-23
4+
5+
### Changed (1)
6+
7+
- Updated `github.com/binance/binance-connector-go/common` library to version `1.2.0`.
8+
39
## 1.1.0 - 2026-01-13
410

511
### Changed (1)

clients/algo/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.0
55
toolchain go1.24.11
66

77
require (
8-
github.com/binance/binance-connector-go/common v1.1.0
8+
github.com/binance/binance-connector-go/common v1.2.0
99
github.com/stretchr/testify v1.11.1
1010
)
1111

clients/algo/src/restapi/api_future_algo.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (a *FutureAlgoAPIService) CancelAlgoOrderFutureAlgoExecute(r ApiCancelAlgoO
7777
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
7878
}
7979

80-
resp, err := SendRequest[models.CancelAlgoOrderFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
80+
resp, err := SendRequest[models.CancelAlgoOrderFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
8181
if err != nil || resp == nil {
8282
return nil, err
8383
}
@@ -131,7 +131,7 @@ func (a *FutureAlgoAPIService) QueryCurrentAlgoOpenOrdersFutureAlgoExecute(r Api
131131
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
132132
}
133133

134-
resp, err := SendRequest[models.QueryCurrentAlgoOpenOrdersFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
134+
resp, err := SendRequest[models.QueryCurrentAlgoOpenOrdersFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
135135
if err != nil || resp == nil {
136136
return nil, err
137137
}
@@ -251,7 +251,7 @@ func (a *FutureAlgoAPIService) QueryHistoricalAlgoOrdersFutureAlgoExecute(r ApiQ
251251
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
252252
}
253253

254-
resp, err := SendRequest[models.QueryHistoricalAlgoOrdersFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
254+
resp, err := SendRequest[models.QueryHistoricalAlgoOrdersFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
255255
if err != nil || resp == nil {
256256
return nil, err
257257
}
@@ -340,7 +340,7 @@ func (a *FutureAlgoAPIService) QuerySubOrdersFutureAlgoExecute(r ApiQuerySubOrde
340340
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
341341
}
342342

343-
resp, err := SendRequest[models.QuerySubOrdersFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
343+
resp, err := SendRequest[models.QuerySubOrdersFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
344344
if err != nil || resp == nil {
345345
return nil, err
346346
}
@@ -487,7 +487,7 @@ func (a *FutureAlgoAPIService) TimeWeightedAveragePriceFutureAlgoExecute(r ApiTi
487487
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
488488
}
489489

490-
resp, err := SendRequest[models.TimeWeightedAveragePriceFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
490+
resp, err := SendRequest[models.TimeWeightedAveragePriceFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
491491
if err != nil || resp == nil {
492492
return nil, err
493493
}
@@ -634,7 +634,7 @@ func (a *FutureAlgoAPIService) VolumeParticipationFutureAlgoExecute(r ApiVolumeP
634634
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
635635
}
636636

637-
resp, err := SendRequest[models.VolumeParticipationFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
637+
resp, err := SendRequest[models.VolumeParticipationFutureAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
638638
if err != nil || resp == nil {
639639
return nil, err
640640
}

clients/algo/src/restapi/api_spot_algo.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (a *SpotAlgoAPIService) CancelAlgoOrderSpotAlgoExecute(r ApiCancelAlgoOrder
7777
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
7878
}
7979

80-
resp, err := SendRequest[models.CancelAlgoOrderSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
80+
resp, err := SendRequest[models.CancelAlgoOrderSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
8181
if err != nil || resp == nil {
8282
return nil, err
8383
}
@@ -131,7 +131,7 @@ func (a *SpotAlgoAPIService) QueryCurrentAlgoOpenOrdersSpotAlgoExecute(r ApiQuer
131131
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
132132
}
133133

134-
resp, err := SendRequest[models.QueryCurrentAlgoOpenOrdersSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
134+
resp, err := SendRequest[models.QueryCurrentAlgoOpenOrdersSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
135135
if err != nil || resp == nil {
136136
return nil, err
137137
}
@@ -251,7 +251,7 @@ func (a *SpotAlgoAPIService) QueryHistoricalAlgoOrdersSpotAlgoExecute(r ApiQuery
251251
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
252252
}
253253

254-
resp, err := SendRequest[models.QueryHistoricalAlgoOrdersSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
254+
resp, err := SendRequest[models.QueryHistoricalAlgoOrdersSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
255255
if err != nil || resp == nil {
256256
return nil, err
257257
}
@@ -340,7 +340,7 @@ func (a *SpotAlgoAPIService) QuerySubOrdersSpotAlgoExecute(r ApiQuerySubOrdersSp
340340
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "recvWindow", r.recvWindow, "form", "")
341341
}
342342

343-
resp, err := SendRequest[models.QuerySubOrdersSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
343+
resp, err := SendRequest[models.QuerySubOrdersSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
344344
if err != nil || resp == nil {
345345
return nil, err
346346
}
@@ -455,7 +455,7 @@ func (a *SpotAlgoAPIService) TimeWeightedAveragePriceSpotAlgoExecute(r ApiTimeWe
455455
common.ParameterAddToHeaderOrQuery(localVarQueryParams, "limitPrice", r.limitPrice, "form", "")
456456
}
457457

458-
resp, err := SendRequest[models.TimeWeightedAveragePriceSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg)
458+
resp, err := SendRequest[models.TimeWeightedAveragePriceSpotAlgoResponse](r.ctx, localVarPath, localVarHTTPMethod, localVarQueryParams, localVarBodyParameters, a.client.cfg, true)
459459
if err != nil || resp == nil {
460460
return nil, err
461461
}

clients/algo/src/restapi/rest_api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/binance/binance-connector-go/common/common"
1515
)
1616

17-
// RestAPIClient manages communication with the Binance Algo REST API API v1.1.0
17+
// RestAPIClient manages communication with the Binance Algo REST API API v1.2.0
1818
type RestAPIClient struct {
1919
cfg *common.ConfigurationRestAPI
2020

@@ -37,7 +37,7 @@ func NewRestAPIClient(cfg *common.ConfigurationRestAPI) *RestAPIClient {
3737
if customHeaders == nil {
3838
customHeaders = make(map[string]string)
3939
}
40-
customHeaders["User-Agent"] = "binance-algo/1.1.0 (Go/" + runtime.Version() + "; " + runtime.GOOS + "; " + runtime.GOARCH + ")"
40+
customHeaders["User-Agent"] = "binance-algo/1.2.0 (Go/" + runtime.Version() + "; " + runtime.GOOS + "; " + runtime.GOARCH + ")"
4141
cfg.CustomHeaders = customHeaders
4242
c := &RestAPIClient{cfg: cfg}
4343

@@ -60,8 +60,8 @@ func NewRestAPIClient(cfg *common.ConfigurationRestAPI) *RestAPIClient {
6060
// @param config *common.ConfigurationRestAPI - The configuration for the REST API client
6161
// @return *common.RestApiResponse[T] - The API response containing the typed data
6262
// @return error - An error if the request fails
63-
func SendRequest[T any](ctx context.Context, path string, method string, queryParams url.Values, bodyParams interface{}, config *common.ConfigurationRestAPI) (*common.RestApiResponse[T], error) {
64-
resp, err := common.SendRequest[T](ctx, path, method, queryParams, bodyParams, config)
63+
func SendRequest[T any](ctx context.Context, path string, method string, queryParams url.Values, bodyParams interface{}, config *common.ConfigurationRestAPI, signed bool) (*common.RestApiResponse[T], error) {
64+
resp, err := common.SendRequest[T](ctx, path, method, queryParams, bodyParams, config, signed)
6565
if err != nil {
6666
return resp, err
6767
}

clients/alpha/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage.txt
2+
*.DS_Store
3+
.idea

clients/alpha/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Changelog
2+
3+
## 1.0.0 - 2026-01-23
4+
5+
- Initial release

clients/alpha/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Binance
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

clients/alpha/README.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Binance Go Alpha SDK
2+
3+
[![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-go/ci.yaml)](https://github.com/binance/binance-connector-go/actions)
4+
[![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-go)](https://github.com/binance/binance-connector-go/issues)
5+
[![Go Version](https://img.shields.io/github/go-mod/go-version/binance/binance-connector-go)](https://github.com/binance/binance-connector-go)
6+
[![Known Vulnerabilities](https://img.shields.io/badge/security-scanned-brightgreen)](https://github.com/binance/binance-connector-go/security)
7+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8+
9+
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:
10+
11+
- [REST API](./src/restapi/rest_api.go)
12+
13+
## Table of Contents
14+
15+
- [Supported Features](#supported-features)
16+
- [Installation](#installation)
17+
- [Documentation](#documentation)
18+
- [REST APIs](#rest-apis)
19+
- [Testing](#testing)
20+
- [Migration Guide](#migration-guide)
21+
- [Contributing](#contributing)
22+
- [License](#license)
23+
24+
## Supported Features
25+
26+
- REST API Endpoints:
27+
- `/bapi/defi/v1/*`
28+
- Inclusion of test cases and examples for quick onboarding.
29+
30+
## Installation
31+
32+
To use this library, ensure you have Go installed (version **1.24** or higher is recommended). You can install the library using the following command:
33+
34+
```bash
35+
go get github.com/binance/binance-connector-go/clients/alpha
36+
```
37+
38+
## Documentation
39+
40+
For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/alpha).
41+
42+
### REST APIs
43+
44+
All REST API endpoints are available through the [`restapi`](./src/restapi/rest_api.go) module. Note that some endpoints require authentication using your Binance API credentials.
45+
46+
```go
47+
package main
48+
49+
import (
50+
"context"
51+
"encoding/json"
52+
"log"
53+
54+
client "github.com/binance/binance-connector-go/clients/alpha"
55+
"github.com/binance/binance-connector-go/common/common"
56+
)
57+
58+
func main() {
59+
GetExchangeInfo()
60+
}
61+
62+
func GetExchangeInfo() {
63+
configuration := common.NewConfigurationRestAPI(
64+
common.WithBasePath(common.AlphaRestApiProdUrl),
65+
common.WithApiKey("Your API Key"),
66+
)
67+
apiClient := client.NewBinanceAlphaClient(
68+
client.WithRestAPI(configuration),
69+
)
70+
resp, err := apiClient.RestApi.MarketDataAPI.GetExchangeInfo(context.Background()).Execute()
71+
if err != nil {
72+
log.Println(err)
73+
return
74+
}
75+
76+
rateLimitsValue, _ := json.MarshalIndent(resp.RateLimits, "", " ")
77+
log.Printf("Rate limits: %s\n", string(rateLimitsValue))
78+
79+
dataValue, _ := json.MarshalIndent(resp.Data, "", " ")
80+
log.Printf("Response: %s\n", string(dataValue))
81+
}
82+
```
83+
84+
More examples can be found in the [`examples/restapi`](./examples/restapi/) folder.
85+
86+
#### Configuration Options
87+
88+
The REST API supports the following advanced configuration options:
89+
90+
- `Timeout`: Timeout for requests in milliseconds (default: 1000 ms).
91+
- `Proxy`: Proxy configuration:
92+
- `Host`: Proxy server hostname.
93+
- `Port`: Proxy server port.
94+
- `Protocol`: Proxy protocol (http or https).
95+
- `Auth`: Proxy authentication credentials:
96+
- `Username`: Proxy username.
97+
- `Password`: Proxy password.
98+
- `KeepAlive`: Enable HTTP keep-alive (default: true).
99+
- `Compression`: Enable response compression (default: true).
100+
- `Retries`: Number of retry attempts for failed requests (default: 3).
101+
- `Backoff`: Delay in milliseconds between retries (default: 1000 ms).
102+
- `HTTPSAgent`: Custom HTTPS agent for advanced TLS configuration.
103+
- `PrivateKey`: RSA or ED25519 private key for authentication.
104+
- `PrivateKeyPassphrase`: Passphrase for the private key, if encrypted.
105+
106+
##### Timeout
107+
108+
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/restapi/timeout.md) for detailed usage.
109+
110+
##### Proxy
111+
112+
The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/restapi/proxy.md) for detailed usage.
113+
114+
##### Keep-Alive
115+
116+
Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/restapi/keep-alive.md) for detailed usage.
117+
118+
##### Compression
119+
120+
Enable or disable response compression. See the [Compression example](./docs/restapi/compression.md) for detailed usage.
121+
122+
##### Retries
123+
124+
Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/restapi/retries.md) for detailed usage.
125+
126+
##### HTTPS Agent
127+
128+
Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/restapi/https-agent.md) for detailed usage.
129+
130+
##### Key Pair Based Authentication
131+
132+
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/restapi/key-pair-authentication.md) for detailed usage.
133+
134+
##### Certificate Pinning
135+
136+
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/restapi/certificate-pinning.md) for detailed usage.
137+
138+
#### Error Handling
139+
140+
The REST API provides detailed error types to help you handle issues effectively:
141+
142+
- `ConnectorClientError`: General client error.
143+
- `RequiredError`: Thrown when a required parameter is missing.
144+
- `UnauthorizedError`: Indicates missing or invalid authentication credentials.
145+
- `ForbiddenError`: Access to the requested resource is forbidden.
146+
- `TooManyRequestsError`: Rate limit exceeded.
147+
- `RateLimitBanError`: IP address banned for exceeding rate limits.
148+
- `ServerError`: Internal server error.
149+
- `NetworkError`: Issues with network connectivity.
150+
- `NotFoundError`: Resource not found.
151+
- `BadRequestError`: Invalid request.
152+
153+
See the [Error Handling example](./docs/restapi/error-handling.md) for detailed usage.
154+
155+
If `base_path` is not provided, it defaults to `https://www.binance.com`.
156+
157+
## Testing
158+
159+
To run the test cases, use the following command:
160+
161+
```bash
162+
go test ./tests/...
163+
```
164+
165+
The tests cover:
166+
- REST API endpoints
167+
- Error handling and edge cases
168+
169+
## Contributing
170+
171+
Contributions are welcome!
172+
173+
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.
174+
175+
To contribute:
176+
177+
1. Open a GitHub issue describing your suggestion or the bug you've identified.
178+
2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
179+
180+
Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
181+
182+
Thank you for your contributions!
183+
184+
## License
185+
186+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

0 commit comments

Comments
 (0)