With the move towards modularization, Binance connectors are now split into smaller, product-specific libraries. This guide explains how to migrate from the monolithic binance-connector package to the new modular connectors.
| Feature | Monolithic Connector | Modular Connector |
|---|---|---|
| Package Name | binance-connector |
binance-sdk-<product> |
| API Coverage | All Binance APIs | Individual APIs (Spot, Wallet, Algo Trading, Mining, etc.) |
| Imports | Single package import | Separate package per product |
| Code Structure | One large client | Smaller, focused clients |
If you were using the old connector, remove it from your project:
pip uninstall binance-connectorInstall only the connector(s) you need. For example, to install the Spot Trading connector:
pip install binance-sdk-spotTo install multiple connectors:
pip install binance-sdk-spot binance-sdk-margin-trading binanc-sdk-walletUpdate your import paths:
Old:
from binance.spot import SpotNew:
from binance_sdk_spot.spot import SpotThe new structure introduces a more modular approach to client initialization.
Old (Monolithic Connector):
from binance.spot import Spot
client = Spot(api_key, api_secret)
account_info = client.account()
print(account_info)New (Modular Spot Connector):
from binance_common.configuration import ConfigurationRestAPI
from binance_sdk_spot.spot import Spot
configuration = ConfigurationRestAPI(api_key, api_secret)
client = Spot(config_rest_api=configuration)
account_info = client.rest_api.get_account()
print(account_info)Some function names or response structures may have changed. Refer to the modular connector's documentation for details.
- If a modular connector is not yet available for your use case, continue using the monolithic connector (
binance-connector). - The monolithic connector will remain available, but it is recommended to migrate when modular versions are released.
You can continue using binance-connector until the modular version is released.
Critical bug fixes will be provided, but feature updates will focus on the modular connectors.
Check the modular connector's documentation for detailed examples.