python-binance is available on PYPI.
Install with pip:
pip install python-binanceFirstly register an account with Binance.
To use signed account methods you are required to create an API Key.
Pass your API Key and Secret
from binance.client import Client
client = Client(api_key, api_secret)Every method supports the passing of arbitrary parameters via keyword matching those in the`Binance API documentation <https://github.com/binance-exchange/binance-official-api-docs>`_. These keyword arguments will be sent directly to the relevant endpoint.
Each API method returns a dictionary of the JSON response as per the Binance API documentation. The docstring of each method in the code references the endpoint it implements.
The Binance API documentation references a timestamp parameter, this is generated for you where required.
Some methods have a recvWindow parameter for timing security, see Binance documentation.
API Endpoints are rate limited by Binance at 20 requests per second, ask them if you require more.
Check the get_exchange_info() call for up to date rate limits.
At the current time Binance rate limits are:
- 1200 requests per minute
- 10 orders per second
- 100,000 orders per 24hrs
Some calls have a higher weight than others especially if a call returns information about all symbols. Read the `official Binance documentation <https://github.com/binance-exchange/binance-official-api-docs`_ for specific information.