Skip to content

Commit 11b14dc

Browse files
authored
Merge pull request #74 from binance/rc-v1.0.0
2 parents 363035f + 580add9 commit 11b14dc

File tree

5,169 files changed

+1144872
-5
lines changed

Some content is hidden

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

5,169 files changed

+1144872
-5
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ jobs:
1515
- name: Detect modified targets
1616
id: filter
1717
run: |
18-
echo "Detected all clients: [\"common\"]"
19-
echo "modified_targets=[\"common\"]" >> $GITHUB_OUTPUT
18+
ALL_CLIENTS=$(ls -d clients/*/ | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')
19+
echo "Detected all clients: $ALL_CLIENTS"
20+
echo "modified_targets=$ALL_CLIENTS" >> $GITHUB_OUTPUT
2021
2122
build-target:
2223
needs: detect-targets

.github/workflows/release.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
- name: Detect all clients
1919
id: detect
2020
run: |
21-
echo "clients=[\"common\"]" >> $GITHUB_OUTPUT
21+
ALL_CLIENTS=$(ls -d clients/*/ | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')
22+
echo "Detected all clients: $ALL_CLIENTS"
23+
echo "clients=$ALL_CLIENTS" >> $GITHUB_OUTPUT
2224
2325
release:
2426
needs: detect-clients

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,51 @@ Before using the SDK, ensure you have:
1414
- **Go** (version 1.24 or later)
1515
- **Go Modules** (for dependency management)
1616

17+
## Available SDK
18+
19+
- [binance-connector-algo](./clients/algo) - Algo Trading connector
20+
- [binance-connector-c2c](./clients/c2c/) - C2
21+
- [binance-sdk-convert](./clients/convert/) - Convert connector
22+
- [binance-sdk-copy-trading](./clients/copy-trading/) - Copy Trading connector
23+
- [binance-sdk-crypto-loan](./clients/crypto-loan/) - Crypto Loan connector
24+
- [binance-sdk-derivatives-trading-coin-futures](./clients/derivatives-trading-coin-futures/) - Coin Futures Trading connector
25+
- [binance-sdk-derivatives-trading-options](./clients/derivatives-trading-options/) - Options Trading connector
26+
- [binance-sdk-derivatives-trading-portfolio-margin](./clients/derivatives-trading-portfolio-margin/) - Portfolio Margin Futures Trading connector
27+
- [binance-sdk-derivatives-trading-portfolio-margin-pro](./clients/derivatives-trading-portfolio-margin-pro/) - Portfolio Margin Pro Trading connector
28+
- [binance-sdk-derivatives-trading-usds-futures](./clients/derivatives-trading-usds-futures/) - USDs Futures Trading connector
29+
- [binance-sdk-dual-investment](./clients/dual-investment/) - Dual Investment connector
30+
- [binance-sdk-fiat](./clients/fiat/) - Fiat connector
31+
- [binance-sdk-gift-card](./clients/gift-card/) - Gift Card connector
32+
- [binance-sdk-margin-trading](./clients/margin-trading/) - Margin Trading connector
33+
- [binance-sdk-mining](./clients/mining/) - Mining connector
34+
- [binance-sdk-nft](./clients/nft/) - NFT connector
35+
- [binance-sdk-pay](./clients/pay/) - Pay connector
36+
- [binance-sdk-rebate](./clients/rebate/) - Rebate connector
37+
- [binance-sdk-simple-earn](./clients/simple-earn/) - Simple Earn connector
38+
- [binance-sdk-spot](./clients/spot/) - Spot Trading connector
39+
- [binance-sdk-staking](./clients/staking/) - Staking connector
40+
- [binance-sdk-sub-account](./clients/sub-account/) - Sub Account connector
41+
- [binance-sdk-vip-loan](./clients/vip-loan/) - VIP Loan connector
42+
- [binance-sdk-wallet](./clients/wallet/) - Wallet connector
43+
44+
## Documentation
45+
46+
For detailed information, refer to the [Binance API Documentation](https://developers.binance.com).
47+
48+
## Installation
49+
50+
Each connector is published as a separate Python package. You can install them via `go get`. For example:
51+
52+
```bash
53+
go get github.com/binance/binance-connector-go/clients/spot
54+
```
55+
56+
Or to install multiple connectors:
57+
58+
```bash
59+
go get github.com/binance/binance-connector-go/clients/spot github.com/binance/binance-connector-go/clients/margintrading github.com/binance/binance-connector-go/clients/wallet
60+
```
61+
1762
## Contributing
1863

1964
Since this repository contains auto-generated code using OpenAPI Generator, we encourage you to:
@@ -23,4 +68,4 @@ Since this repository contains auto-generated code using OpenAPI Generator, we e
2368

2469
## License
2570

26-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE.md) file for details.
71+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE.md) file for details.

clients/algo/.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/algo/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0 - 2025-12-15
2+
3+
- Initial release

clients/algo/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) 2025 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/algo/README.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Binance Go Algo 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 Algo API, enabling developers to interact programmatically with Binance's Algo trading platform. The library provides tools to programmatically leverage Binance in-house algorithmic trading capability to automate order execution strategy, improve execution transparency and give users smart access to the available market liquidity 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+
- `/sapi/v1/algo/*`
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.22** 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/algo
36+
```
37+
38+
## Documentation
39+
40+
For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/algo).
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/algo/src"
55+
"github.com/binance/binance-connector-go/common/common"
56+
)
57+
58+
func main() {
59+
QueryHistoricalAlgoOrdersSpotAlgo()
60+
}
61+
62+
func QueryHistoricalAlgoOrdersSpotAlgo() {
63+
configuration := common.NewConfigurationRestAPI(
64+
common.WithBasePath(common.AlgoRestApiProdUrl),
65+
common.WithApiKey("Your API Key"),
66+
common.WithApiSecret("Your API Secret"),
67+
)
68+
apiClient := client.NewBinanceAlgoClient(
69+
client.WithRestAPI(configuration),
70+
)
71+
resp, err := apiClient.RestApi.SpotAlgoAPI.QueryHistoricalAlgoOrdersSpotAlgo(context.Background()).Execute()
72+
if err != nil {
73+
log.Println(err)
74+
return
75+
}
76+
77+
rateLimitsValue, _ := json.MarshalIndent(resp.RateLimits, "", " ")
78+
log.Printf("Rate limits: %s\n", string(rateLimitsValue))
79+
80+
dataValue, _ := json.MarshalIndent(resp.Data, "", " ")
81+
log.Printf("Response: %s\n", string(dataValue))
82+
}
83+
```
84+
85+
More examples can be found in the [`examples/restapi`](./examples/restapi/) folder.
86+
87+
#### Configuration Options
88+
89+
The REST API supports the following advanced configuration options:
90+
91+
- `Timeout`: Timeout for requests in milliseconds (default: 1000 ms).
92+
- `Proxy`: Proxy configuration:
93+
- `Host`: Proxy server hostname.
94+
- `Port`: Proxy server port.
95+
- `Protocol`: Proxy protocol (http or https).
96+
- `Auth`: Proxy authentication credentials:
97+
- `Username`: Proxy username.
98+
- `Password`: Proxy password.
99+
- `KeepAlive`: Enable HTTP keep-alive (default: true).
100+
- `Compression`: Enable response compression (default: true).
101+
- `Retries`: Number of retry attempts for failed requests (default: 3).
102+
- `Backoff`: Delay in milliseconds between retries (default: 1000 ms).
103+
- `HTTPSAgent`: Custom HTTPS agent for advanced TLS configuration.
104+
- `PrivateKey`: RSA or ED25519 private key for authentication.
105+
- `PrivateKeyPassphrase`: Passphrase for the private key, if encrypted.
106+
107+
##### Timeout
108+
109+
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.
110+
111+
##### Proxy
112+
113+
The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/restapi/proxy.md) for detailed usage.
114+
115+
##### Keep-Alive
116+
117+
Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/restapi/keep-alive.md) for detailed usage.
118+
119+
##### Compression
120+
121+
Enable or disable response compression. See the [Compression example](./docs/restapi/compression.md) for detailed usage.
122+
123+
##### Retries
124+
125+
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.
126+
127+
##### HTTPS Agent
128+
129+
Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/restapi/https-agent.md) for detailed usage.
130+
131+
##### Key Pair Based Authentication
132+
133+
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.
134+
135+
##### Certificate Pinning
136+
137+
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.
138+
139+
#### Error Handling
140+
141+
The REST API provides detailed error types to help you handle issues effectively:
142+
143+
- `ConnectorClientError`: General client error.
144+
- `RequiredError`: Thrown when a required parameter is missing.
145+
- `UnauthorizedError`: Indicates missing or invalid authentication credentials.
146+
- `ForbiddenError`: Access to the requested resource is forbidden.
147+
- `TooManyRequestsError`: Rate limit exceeded.
148+
- `RateLimitBanError`: IP address banned for exceeding rate limits.
149+
- `ServerError`: Internal server error.
150+
- `NetworkError`: Issues with network connectivity.
151+
- `NotFoundError`: Resource not found.
152+
- `BadRequestError`: Invalid request.
153+
154+
See the [Error Handling example](./docs/restapi/error-handling.md) for detailed usage.
155+
156+
## Testing
157+
158+
To run the test cases, use the following command:
159+
160+
```bash
161+
go test ./tests/...
162+
```
163+
164+
The tests cover:
165+
- REST API endpoints
166+
- Error handling and edge cases
167+
168+
## Migration Guide
169+
170+
For information on migrating from previous versions of the Binance Go Algo SDK, please refer to the [Migration Guide](./docs/migration-guide.md).
171+
172+
## Contributing
173+
174+
Contributions are welcome!
175+
176+
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.
177+
178+
To contribute:
179+
180+
1. Open a GitHub issue describing your suggestion or the bug you've identified.
181+
2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
182+
183+
Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
184+
185+
Thank you for your contributions!
186+
187+
## License
188+
189+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

0 commit comments

Comments
 (0)