Hi,
I’m trying to post a market buy order on the testnet for BNBBTC, but I get the LOT_SIZE error.
My code:
client = Client(BINANCE_API_KEY, BINANCE_API_SECRET, {"verify":False, "timeout": 20})
coins = float(client.get_asset_balance(asset='BTC')['free'])
print(f"You have {coins:,.8f}BTC available")
try:
order = client.create_order(symbol=symbol, type='MARKET', side='BUY', quoteOrderQty='0.2')
except BinanceAPIException as e:
print("#" + "!"*50 + "#")
print('ERROR:')
print(e)
print('Exiting...')
return
print("#" + "="*50 + "#")
print("Order:")
print(order)
print(f"Bought {order['executedQty']}BNB spending {order['cummulativeQuoteQty']}BTC")
print(f"Price paid {float(order['cummulativeQuoteQty']) / float(order['executedQty'])}")
print(f"Price paid {float(order['executedQty']) / float(order['cummulativeQuoteQty'])}")
Output
You have 0.23061280BTC available
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#
ERROR:
APIError(code=-2010): Filter failure: LOT_SIZE
Exiting...
I don’t understand why I’m getting the LOT_SIZE error. https://binance-docs.github.io/apidocs/spot/en/#new-order-trade says that
MARKET orders using quoteOrderQty will not break LOT_SIZE filter rules; the order will execute a quantity that will have the notional value as close as possible to quoteOrderQty.
I’m trying to spend 0.2BTC of the 0.2306 BTC on the testnet. So, why isn’t it working?
Regards