Account Endpoints

Orders

Order Validation

Binance has a number of rules around symbol pair orders with validation on minimum price, quantity and total order value.

Read more about their specifics in the Filters section of the official API.

It can be helpful to format the output using the following snippet

amount = 0.000234234
precision = 5
amt_str = "{:0.0{}f}".format(amount, precision)

Fetch all orders

orders = client.get_all_orders(symbol='BNBBTC', limit=10)

Place an order

Place an order

Use the create_order function to have full control over creating an order

from binance.enums import *
order = client.create_order(
    symbol='BNBBTC',
    side=SIDE_BUY,
    type=ORDER_TYPE_LIMIT,
    timeInForce=TIME_IN_FORCE_GTC,
    quantity=100,
    price='0.00001')

Place a limit order

Use the helper functions to easily place a limit buy or sell order

order = client.order_limit_buy(
    symbol='BNBBTC',
    quantity=100,
    price='0.00001')

order = client.order_limit_sell(
    symbol='BNBBTC',
    quantity=100,
    price='0.00001')

Place a market order

Use the helper functions to easily place a market buy or sell order

order = client.order_market_buy(
    symbol='BNBBTC',
    quantity=100)

order = client.order_market_sell(
    symbol='BNBBTC',
    quantity=100)

Place a test order

Creates and validates a new order but does not send it into the exchange.

from binance.enums import *
order = client.create_test_order(
    symbol='BNBBTC',
    side=SIDE_BUY,
    type=ORDER_TYPE_LIMIT,
    timeInForce=TIME_IN_FORCE_GTC,
    quantity=100,
    price='0.00001')

Check order status

order = client.get_order(
    symbol='BNBBTC',
    orderId='orderId')

Cancel an order

result = client.cancel_order(
    symbol='BNBBTC',
    orderId='orderId')

Get all open orders

orders = client.get_open_orders(symbol='BNBBTC')

Get all orders

orders = client.get_all_orders(symbol='BNBBTC')

Account

Get account info

info = client.get_account()

Get asset balance

balance = client.get_asset_balance(asset='BTC')

Get account status

status = client.get_account_status()

Get trades

trades = client.get_my_trades(symbol='BNBBTC')

Get trade fees

# get fees for all symbols
fees = client.get_trade_fee()

# get fee for one symbol
fees = client.get_trade_fee(symbol='BNBBTC')

Get asset details

details = client.get_asset_details()

Get dust log

log = client.get_dust_log()