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://www.binance.com/restapipub.html>`_. 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.
Binance rate limits are:
- 1200 requests per minute
- 10 orders per second
- 100,000 orders per 24hrs