Name | binance-sdk-algo JSON |
Version |
1.3.0
JSON |
| download |
home_page | None |
Summary | Official Binance Algo SDK - A lightweight library that provides a convenient interface to Binance's Algo REST API |
upload_time | 2025-08-22 14:54:06 |
maintainer | None |
docs_url | None |
author | Binance |
requires_python | <3.14,>=3.9 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Binance Python Algo SDK
[](https://github.com/binance/binance-connector-python/actions)
[](https://github.com/binance/binance-connector-python/issues)
[](https://black.readthedocs.io/en/stable/)
[](https://pypi.python.org/pypi/binance-sdk-algo)
[](https://pypi.org/project/binance-sdk-algo/)
[](https://www.python.org/downloads/)
[](https://github.com/binance/binance-connector-python/security)
[](https://opensource.org/licenses/MIT)
This is a client library for the Binance Algo SDK 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:
- [REST API](./src/binance_sdk_algo/rest_api/rest_api.py)
## Table of Contents
- [Supported Features](#supported-features)
- [Installation](#installation)
- [Documentation](#documentation)
- [REST APIs](#rest-apis)
- [Testing](#testing)
- [Contributing](#contributing)
- [Licence](#licence)
## Supported Features
- REST API Endpoints:
- `/sapi/v1/algo/*`
- Inclusion of test cases and examples for quick onboarding.
## Installation
To use this library, ensure your environment is running Python version **3.9** or later.
```bash
pip install binance-sdk-algo
```
## Documentation
For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/algo/Introduction).
### REST APIs
All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_algo/rest_api/rest_api.py) module. The REST API enables you to fetch market data, manage trades, and access account information. Note that some endpoints require authentication using your Binance API credentials.
```python
from binance_common.configuration import ConfigurationRestAPI
from binance_common.constants import ALGO_REST_API_PROD_URL
from binance_sdk_algo.algo import Algo
logging.basicConfig(level=logging.INFO)
configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=ALGO_REST_API_PROD_URL)
client = Algo(config_rest_api=configuration)
try:
response = client.rest_api.query_historical_algo_orders_spot_algo()
data = response.data()
logging.info(f"query_historical_algo_orders_spot_algo() response: {data}")
except Exception as e:
logging.error(f"query_historical_algo_orders_spot_algo() error: {e}")
```
More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.
#### Configuration Options
The REST API supports the following advanced configuration options:
- `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
- `proxy`: Proxy configuration:
- `host`: Proxy server hostname.
- `port`: Proxy server port.
- `protocol`: Proxy protocol (http or https).
- `auth`: Proxy authentication credentials:
- `username`: Proxy username.
- `password`: Proxy password.
- `keep_alive`: Enable HTTP keep-alive (default: true).
- `compression`: Enable response compression (default: true).
- `retries`: Number of retry attempts for failed requests (default: 3).
- `backoff`: Delay in milliseconds between retries (default: 1000 ms).
- `https_agent`: Custom HTTPS agent for advanced TLS configuration.
- `private_key`: RSA or ED25519 private key for authentication.
- `private_key_passphrase`: 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.
##### HTTPS Agent
Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.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 `https_agent` 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:
- `ClientError`: Represents an error that occurred in the SDK client.
- `RequiredError`: Thrown when a required parameter is missing or undefined.
- `UnauthorizedError`: Indicates missing or invalid authentication credentials.
- `ForbiddenError`: Access to the requested resource is forbidden.
- `TooManyRequestsError`: Rate limit exceeded.
- `RateLimitBanError`: IP address banned for exceeding rate limits.
- `ServerError`: Internal server error, optionally includes a status code.
- `NetworkError`: Issues with network connectivity.
- `NotFoundError`: Resource not found.
- `BadRequestError`: Invalid request or one that cannot be served.
See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.
If `base_path` is not provided, it defaults to `https://api.binance.com`.
## Testing
To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:
```bash
poetry install
poetry run pytest ./tests
```
The tests cover:
* REST API endpoints
* Error handling
* Edge cases
## 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!
## Licence
This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "binance-sdk-algo",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Binance",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b7/3e/e6957f71e3bba9298cd055856015587431bac9cbed944ec51c8f2d43814f/binance_sdk_algo-1.3.0.tar.gz",
"platform": null,
"description": "# Binance Python Algo SDK\n\n[](https://github.com/binance/binance-connector-python/actions)\n[](https://github.com/binance/binance-connector-python/issues)\n[](https://black.readthedocs.io/en/stable/)\n[](https://pypi.python.org/pypi/binance-sdk-algo)\n[](https://pypi.org/project/binance-sdk-algo/)\n[](https://www.python.org/downloads/)\n[](https://github.com/binance/binance-connector-python/security)\n[](https://opensource.org/licenses/MIT)\n\nThis is a client library for the Binance Algo SDK 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:\n- [REST API](./src/binance_sdk_algo/rest_api/rest_api.py)\n\n## Table of Contents\n\n- [Supported Features](#supported-features)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [REST APIs](#rest-apis)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [Licence](#licence)\n\n## Supported Features\n\n- REST API Endpoints:\n - `/sapi/v1/algo/*`\n- Inclusion of test cases and examples for quick onboarding.\n\n## Installation\n\nTo use this library, ensure your environment is running Python version **3.9** or later.\n\n```bash\npip install binance-sdk-algo\n```\n\n## Documentation\n\nFor detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/algo/Introduction).\n\n### REST APIs\n\nAll REST API endpoints are available through the [`rest_api`](./src/binance_sdk_algo/rest_api/rest_api.py) module. The REST API enables you to fetch market data, manage trades, and access account information. Note that some endpoints require authentication using your Binance API credentials.\n\n```python\nfrom binance_common.configuration import ConfigurationRestAPI\nfrom binance_common.constants import ALGO_REST_API_PROD_URL\nfrom binance_sdk_algo.algo import Algo\n\nlogging.basicConfig(level=logging.INFO)\nconfiguration = ConfigurationRestAPI(api_key=\"your-api-key\", api_secret=\"your-api-secret\", base_path=ALGO_REST_API_PROD_URL)\n\nclient = Algo(config_rest_api=configuration)\n\ntry:\n response = client.rest_api.query_historical_algo_orders_spot_algo()\n\n data = response.data()\n logging.info(f\"query_historical_algo_orders_spot_algo() response: {data}\")\nexcept Exception as e:\n logging.error(f\"query_historical_algo_orders_spot_algo() error: {e}\")\n```\n\nMore examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.\n\n#### Configuration Options\n\nThe REST API supports the following advanced configuration options:\n\n- `timeout`: Timeout for requests in milliseconds (default: 1000 ms).\n- `proxy`: Proxy configuration:\n - `host`: Proxy server hostname.\n - `port`: Proxy server port.\n - `protocol`: Proxy protocol (http or https).\n - `auth`: Proxy authentication credentials:\n - `username`: Proxy username.\n - `password`: Proxy password.\n- `keep_alive`: Enable HTTP keep-alive (default: true).\n- `compression`: Enable response compression (default: true).\n- `retries`: Number of retry attempts for failed requests (default: 3).\n- `backoff`: Delay in milliseconds between retries (default: 1000 ms).\n- `https_agent`: Custom HTTPS agent for advanced TLS configuration.\n- `private_key`: RSA or ED25519 private key for authentication.\n- `private_key_passphrase`: Passphrase for the private key, if encrypted.\n\n##### Timeout\n\nYou 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.\n\n##### Proxy\n\nThe REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.\n\n##### Keep-Alive\n\nEnable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.\n\n##### Compression\n\nEnable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.\n\n##### Retries\n\nConfigure 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.\n\n##### HTTPS Agent\n\nCustomize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.\n\n##### Key Pair Based Authentication\n\nThe 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.\n\n##### Certificate Pinning\n\nTo enhance security, you can use certificate pinning with the `https_agent` 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.\n\n#### Error Handling\n\nThe REST API provides detailed error types to help you handle issues effectively:\n\n- `ClientError`: Represents an error that occurred in the SDK client.\n- `RequiredError`: Thrown when a required parameter is missing or undefined.\n- `UnauthorizedError`: Indicates missing or invalid authentication credentials.\n- `ForbiddenError`: Access to the requested resource is forbidden.\n- `TooManyRequestsError`: Rate limit exceeded.\n- `RateLimitBanError`: IP address banned for exceeding rate limits.\n- `ServerError`: Internal server error, optionally includes a status code.\n- `NetworkError`: Issues with network connectivity.\n- `NotFoundError`: Resource not found.\n- `BadRequestError`: Invalid request or one that cannot be served.\n\nSee the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.\n\nIf `base_path` is not provided, it defaults to `https://api.binance.com`.\n\n## Testing\n\nTo run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:\n\n```bash\npoetry install\npoetry run pytest ./tests\n```\n\nThe tests cover:\n* REST API endpoints\n* Error handling\n* Edge cases\n\n## Contributing\n\nContributions are welcome!\n\nSince 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.\n\nTo contribute:\n\n1. Open a GitHub issue describing your suggestion or the bug you've identified.\n2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.\n\nPlease ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.\n\nThank you for your contributions!\n\n## Licence\n\nThis project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Official Binance Algo SDK - A lightweight library that provides a convenient interface to Binance's Algo REST API",
"version": "1.3.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6397e8e80a13b312dfa5170bb974d7d368e18467c75d05bec8828cfe8c1d9590",
"md5": "d3c7e305737da5f8c9bc1c4246214d8a",
"sha256": "ebebfd11eb416c544c581c313158a26f88983427e4864376f470ea45fcef421d"
},
"downloads": -1,
"filename": "binance_sdk_algo-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d3c7e305737da5f8c9bc1c4246214d8a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 43725,
"upload_time": "2025-08-22T14:54:05",
"upload_time_iso_8601": "2025-08-22T14:54:05.398336Z",
"url": "https://files.pythonhosted.org/packages/63/97/e8e80a13b312dfa5170bb974d7d368e18467c75d05bec8828cfe8c1d9590/binance_sdk_algo-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b73ee6957f71e3bba9298cd055856015587431bac9cbed944ec51c8f2d43814f",
"md5": "7f261a8ab48e59c1b4a40947f75e39a9",
"sha256": "cc2ff8f4fa2096b7fbcadcca819a864023d18fe91aa5ee4e2f73d1492913a72c"
},
"downloads": -1,
"filename": "binance_sdk_algo-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "7f261a8ab48e59c1b4a40947f75e39a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 17773,
"upload_time": "2025-08-22T14:54:06",
"upload_time_iso_8601": "2025-08-22T14:54:06.611637Z",
"url": "https://files.pythonhosted.org/packages/b7/3e/e6957f71e3bba9298cd055856015587431bac9cbed944ec51c8f2d43814f/binance_sdk_algo-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-22 14:54:06",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "binance-sdk-algo"
}