Guides
Account Endpoints
Orders, account info, balances, trades, fees, and dust management
Orders
Order Validation
Binance has rules around symbol pair orders with validation on minimum price, quantity, and total order value. Read more in the Filters section of the official API.
Read Understanding Binance Order Filters for more information.
It can be helpful to format the output:
amount = 0.000234234
precision = 5
amt_str = "{:0.0{}f}".format(amount, precision)Or use the helper to round to step size:
from binance.helpers import round_step_size
amount = 0.000234234
tick_size = 0.00001
rounded_amount = round_step_size(amount, tick_size)Fetch All Orders
orders = client.get_all_orders(symbol='BNBBTC', limit=10)Place an Order
Use create_order for full control:
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')Limit orders:
order = client.order_limit_buy(
symbol='BNBBTC',
quantity=100,
price='0.00001')
order = client.order_limit_sell(
symbol='BNBBTC',
quantity=100,
price='0.00001')Market orders:
order = client.order_market_buy(
symbol='BNBBTC',
quantity=100)
order = client.order_market_sell(
symbol='BNBBTC',
quantity=100)OCO orders:
from binance.enums import *
order = client.create_oco_order(
symbol='BNBBTC',
side=SIDE_SELL,
stopLimitTimeInForce=TIME_IN_FORCE_GTC,
quantity=100,
stopPrice='0.00001',
price='0.00002')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 Account API Trading Status
status = client.get_account_api_trading_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()Transfer Dust
transfer = client.transfer_dust(asset='BNZ')Get Asset Dividend History
history = client.get_asset_dividend_history()Disable Fast Withdraw Switch
client.disable_fast_withdraw_switch()Enable Fast Withdraw Switch
client.enable_fast_withdraw_switch()