Getting started

How to install and send your first request to the binance API

Installing binance.py

Installing binance.py is a fairly straight forward process:

pip install binance.py

binance.py requires python 3.6 or superior

Setup a client

  • Generate an API Key and assign relevant permissions.

  • Load your keys from a config

  • Load the client (it is not mandatory but this is highly recommended)

  • Send your first request

import binance

client = binance.Client(API_KEY, API_SECRET)
await client.load()

order = await client.create_order(
    "ETHPAX", Side.BUY, OrderType.MARKET, quantity=1, test=True,
) # this will fake a buy of one ETH with your PAX balance
print(order)
await client.close()

Don't forget to close the client after you are done with it using client.close()

Last updated