Invalid quantity.
rulezzpt opened this issue · 7 comments
Can anyone help with this error? i have USDT and BTC in Binance account, the bot can check but give a invalid quantity, occurs in both BTC and USDT
Your USDT balance is 101.84521760
Please ensure Config is correct before proceeding
A min balance is often required for trade on Binance
? Please enter coin for Pump? bnb
Traceback (most recent call last):
File "bot-binance.py", line 263, in
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "bot-binance.py", line 210, in main
buy_order = market_order(client, selected_coin_pair, 'buy', coin_pair_info, balance)
File "bot-binance.py", line 139, in market_order
order = client.order_market_buy(symbol=selected_coin_pair, quantity=buy_qty)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 1553, in order_market_buy
return self.order_market(**params)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 1525, in order_market
return self.create_order(**params)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 1387, in create_order
return self._post('order', True, data=params)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 368, in _post
return self._request_api('post', path, signed, version, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 328, in _request_api
return self._request(method, uri, signed, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 309, in _request
return self._handle_response(self.response)
File "/usr/local/lib/python3.8/dist-packages/binance/client.py", line 318, in _handle_response
raise BinanceAPIException(response, response.status_code, response.text)
binance.exceptions.BinanceAPIException: APIError(code=-1013): Invalid quantity.
Thanks.
Hey, the error says invalid quantity. Try changing your buy quantity
market-trade-one:
#Coin pairing for trade
pairing: USDT
#Currently, only market is available, keep unchanged
order_type: market
#Amount from wallet to use for trade buy; range 0 to 1
buy_qty_from_wallet: 0.3
#Profit margin multiplier; 0.5 equals 50% gain
profit_margin: 0.2
#Amount from wallet to use for trade sell; range 0 to 1
sell_qty_from_wallet: 1
#Refresh interval in milliseconds to check market for current price
refresh_interval: 100
#Timeout in milliseconds if profit margin doesn't reach intended value; 25 seconds
sell_fallback_timeout_ms: 25000
I already change the quantity, 0.3 0.7 and 1 and i have the same error, i really dont understand why
Hey, it turns out that a specific number of decimal places is required for some coins on Binance
This seems specific to certain coin pairs. I'll look into fixing it later today
Thanks, for your help.
With BTC / BNB / ETH this error is mentioned above, but for example when buying OMG the purchase is already made without a problem, although after giving the following error.
? Please enter coin for Pump? OMG
{
"clientOrderId": "7m5quECHlk4h0aA1HqkfUX",
"cummulativeQuoteQty": "33.06760000",
"executedQty": "4.00000000",
"fills": [
{
"commission": "0.00004897",
"commissionAsset": "BNB",
"price": "8.26690000",
"qty": "4.00000000",
"tradeId": 28999742
}
],
"orderId": 691041066,
"orderListId": -1,
"origQty": "4.00000000",
"price": "0.00000000",
"side": "BUY",
"status": "FILLED",
"symbol": "OMGUSDT",
"timeInForce": "GTC",
"transactTime": 1621291671805,
"type": "MARKET"
}
Traceback (most recent call last):
File "bot-binance.py", line 263, in
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "bot-binance.py", line 219, in main
sell_order = await check_margin()
File "bot-binance.py", line 171, in check_margin
if float(current_price['price']) >= (buy_order['fills'][0]['price'] * (1.0 + margin)):
TypeError: 'NoneType' object is not subscriptable
Please bear with me for a day or two. I'm restructuring the bot to prevent issues like this.
I've just pushed a fix that should solve the error.
Of course friend, I'm just reporting some errors to turn this BOT into a real monster, because I honestly have little knowledge in programming.
Thanks :)