[英]Binance API Error(code=-2010) Account has insufficient balance for requested action
我用這個代碼檢查我的賬戶余額。
balance = client.get_account()
free = [b['free'] for b in balance['balances'] if b['asset'] == 'BTC']
locked = [b['locked'] for b in balance['balances'] if b['asset'] == 'BTC']
# check balance for this coin
all_balance = float(free[0]) + float(locked[0])
print(all_balance)
它顯示 output 是
0.00102323
之后,我嘗試使用此代碼進行銷售。
prices = client.get_symbol_ticker(symbol=coin_name)
# Buy 10 Dollar for this price
s = 10 / df['Sell_Signal_Price'].iloc[0]
# round to 1 decimal
sell_quantity = round(s, 5)
print(sell_quantity) #It show output is 0.00022
order = client.order_limit_sell(
symbol= coin_name,
quantity=sell_quantity,
price=float(prices['price']))
它顯示這樣的錯誤。
APIError(code=-2010): Account has insufficient balance for requested action.
我的賬戶余額是 0.00102323 多於 0.00022 為什么會出現這個錯誤? 如何解決?
當您沒有 BNB 作為支付費用的資產時會發生這種情況,因此將從您的硬幣中扣除 binance 費用,從而減少您的數量。 fizlx的兩種方法:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.