The official Python connector for Binance APIs, designed for backend applications running on Python.
The connector is fully modular: each Binance product is published as a separate Python package (for
example binance-spot), allowing you to install and use only the APIs you need. It supports REST
APIs, WebSocket APIs and WebSocket Streams and provides built-in request signing, connection
management, and typed request/response models for a consistent development experience.
For source code, issues, and release notes, see the binance-connector-python repository on GitHub.
Supported environments
- Python 3.9 or newer
- Backend Python applications and services
This connector is intended for server-side usage only. Interactive or client-side Python environments are not supported.
Package structure
Each Binance product is published as an independent Python package.
Commonly used packages include:
binance-sdk-spotbinance-sdk-derivatives-trading-usds-futuresbinance-sdk-derivatives-trading-coin-futuresbinance-sdk-wallet- (additional products follow the same structure)
This modular approach keeps dependencies minimal and makes upgrades and integrations easier to manage.
Typical use cases
- Trading and execution services
- Real-time and historical market data ingestion
- Backend services managing accounts, balances, and orders
- Applications consuming WebSocket APIs or WebSocket Streams for low-latency updates
Key features
- Support for Binance REST APIs, WebSocket APIs and WebSocket Streams
- Built-in request signing for authenticated endpoints
- WebSocket connection handling with automatic reconnection and session renewal
- Typed request and response models
- Support for both production and testnet environments
- Consistent API design across products
Getting started
Install the package for the product you want to integrate with:
Code
Create a client and send a request:
Code
The example above uses asymmetric key authentication. HMAC-based authentication using an API secret is also supported.
Refer to each package’s documentation for product-specific REST, WebSocket API and WebSocket Streams examples.
Notes and best practices
- Store API keys securely using environment variables or a secrets manager
- Prefer WebSocket APIs or Streams for real-time data instead of polling REST endpoints
- Monitor rate limits and endpoint weights when building high-throughput services
- Use testnet environments when developing and validating integrations