This is the lightweight, official Python library for connecting to Binance's public API. It provides interfaces for Spot, Futures, and other market data and trading endpoints. Currently at version 3.12.0, it receives active development and frequent updates to align with Binance API changes.
pip install binance-connectorVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to initialize the `Spot` client and make basic calls to public endpoints like getting the server time and exchange information. For Futures API, replace `Spot` with `Futures`. For endpoints requiring authentication, ensure `BINANCE_API_KEY` and `BINANCE_API_SECRET` environment variables are set.
Update your imports to explicitly use `from binance.spot import Spot as Client` or `from binance.futures import Futures as Client`. Direct `from binance import Client` will no longer work.
Ensure you are installing `binance-connector` (`pip install binance-connector`) and using its specific import paths and methods. Do not mix code or documentation from the two libraries.
Implement proper rate-limiting strategies in your application, such as introducing delays between requests, using a queue system, or employing exponential backoff for retries. Consult Binance's official API documentation for current rate limits.
Log in to your Binance account, navigate to API Management, and verify that your API key has all the required permissions enabled for the actions you are trying to perform.
After installing `binance-connector` (`pip install binance-connector`), update your client import to `from binance.spot import Spot as Client` for Spot trading or `from binance.futures import Futures as Client` for Futures.
Double-check your `BINANCE_API_KEY` and `BINANCE_API_SECRET` environment variables. If applicable, ensure your IP address is whitelisted in Binance API settings, and verify that the API key has the required permissions enabled on Binance's website.
Reduce the frequency of your API calls. Implement delays or a backoff strategy between requests to stay within the limits. Review Binance's official API documentation for specific endpoint rate limits.
No dependency data recorded yet.