pyjuque
pyjuque copied to clipboard
error on tryExitOrder; cannot place limit order after buy fill due to balance error
Running the bot on multiple symbols. 1m timeframe. After a while all the filled buy orders get this error:
INFO:pyjuque.Engine.BotController:FILLED BUY order on BNB/USDT, try exit. INFO:pyjuque.Engine.BotController:Error placing order for BNB/USDT: (<class 'ccxt.base.errors.InsufficientFunds'>, InsufficientFunds('binance Account has insufficient balance for requested action.'), <traceback object at 0x7f9db3739ec0>)
I tried playing around with removing take profit, changing 'signal_distance' to market orders. But the issue remains.
The bot is unable to evaluate stop loss or exit signals after this error occurred for a symbol.
Help is appreciated!
Thanks
The problem might be here, that the quantity calculation does not take fees into account, resulting in a too low budget of the symbol. I noticed that Binance does not always take fees in the form of BNB but sometimes in the form of the target symbol.
def computeMatchingOrderQuantity(self, order):
""" Compute exit quantity so that also partially
filled orders can be handled."""
if order.side == 'buy':
exit_quantity = order.executed_quantity
elif order.side == 'sell':
exit_quantity = order.original_quantity \
- order.executed_quantity
return exit_quantity
Hey Joris, thanks a lot for trying pyjuque!
Could you please paste the bot_config that you used to set up this bot?
One potential suggestion is that you set your bot up using a starting_balance parameter that is less than what you actually hold in your inventory. Also, all the symbols in the bot_config should be ending in the same coin.
I see now that that might not necessarily be the fix I need to put some checks in place regarding how much the fees cost and what can be sold on top of that.
What version of pyjuque are you running?
Have same issue Now i clean up database with:
Step 1: it need for we can clean database PRAGMA foreign_keys = OFF;
Step 2: look at breaked orders SELECT * FROM [order] WHERE status = 'closed' AND side = 'buy' AND is_entry = 1 AND is_closed = 0; and delete all of them DELETE FROM [order] WHERE status = 'closed' AND side = 'buy' AND is_entry = 1 AND is_closed = 0;