kelp
kelp copied to clipboard
The bot should not update orders when nothing has changed
Describe the bug
Not sure if this is a bug or not: the bot always updates offers, even if the price has not changed and the quantities of assets also remain the same. I tried to change the tolerances to several different values but the behavior continued. I'm using the buysell strategy.
Expected behavior
I think that the bot should not update offers when the price and quantity of assets have remained the same.
Frequency
Always
Steps To Reproduce
Let the bot place the first offers. From the second iteration on, the bot continues to update and submit offers, even when nothing changed.
Your Environment
cli version: master:v1.9.0 gui version: v1.0.0-rc1 git branch: master git hash: ab3333ed871e81124b59d053b60a5856aecc5f41 build date: 20200507T143536Z env: release GOOS: linux GOARCH: arm
@joaofrp this sounds like a bug. Can you share your log file please?
@nikhilsaraf
Here are two log files, one with tolerances set to 0.01 and the other to 0.5 Notice how the bot keeps updating offers even when the price and the amount of assets are the same:
@joaofrp this is a known bug (#252). I haven't gotten around to fixing it yet because it is a slightly involved change and because there's a simple fix. I will fix this bug eventually or sooner if it becomes a more pressing issue.
This is happening because there is not enough balance of both assets in your account (we will oversell the asset
in the logs), i.e. your bot is trying to place an order bigger than the asset balance which confuses the bot and it is unable to correctly check if nothing has changed so the bot ends up re-placing the order.
The fix: For now, to avoid the constant replacement of orders, can you ensure that the balance in the account is bigger than the orders you want to place? This will go through the necessary checks and will not place orders when nothing has changed.
Relevant log lines:
Notice below that the triggers
field on the lines says the amount
caused the replacement of orders. The targetAmtBase
, curAmtBase
, minAmtBase
, and maxAmtBase
values tell you the exact numerical comparison that triggered the order re-placement.
2020/05/17 07:35:26 buy | modify | old level=1 | new level = 1 | triggers=[amount] | targetPriceQuote=1.00000000 | targetAmtBase=100.00000000 | curPriceQuote=1.00000000 | lowPriceQuote=0.99009901 | highPriceQuote=1.01010101 | curAmtBase=0.11793970 | minAmtBase=99.00000000 | maxAmtBase=101.00000000
2020/05/17 07:35:27 we will oversell the asset 'ETH:GCNSGHUCG5VMGLT5RIYYZSO7VQULQKAJ62QA33DBC5PPBSO57LFWVV6P', amountSelling = 100.00000000, bal = 0.11805780, minAccountBal = 0.00011806, liabilities.Selling = 0.00000000
2020/05/17 07:35:27 computed remainder amount, constrained by selling capacity, returning sellingAmount=0.11793974, buyingAmount=0.11793974
2020/05/17 07:35:27 buy | modify | old level=1 | new level = 1 | triggers=[amount] | targetPriceQuote=1.00000000 | targetAmtBase=0.11793974 | curPriceQuote=1.00000000 | lowPriceQuote=0.99009901 | highPriceQuote=1.01010101 | curAmtBase=0.11793970 | minAmtBase=99.00000000 | maxAmtBase=101.00000000
@nikhilsaraf Sorry I submited a new bug report, should've have checked.
For now I'll not use the fix you mentioned, because I want the bot to always use the full balance, whatever it is, but thanks for letting me know.
I'll let the bot update the offers always, and wait for the fix.
Thank you.
@joaofrp no worries, didn't mean it that way. I'm glad you raised the issue! 👍 It's useful for me to know how many people are hitting a given issue which helps with prioritization.
Ok, that sounds good. The fix may take some time (Q3) but if it turns out to be consuming too much in XLM fees over time let me know and I can shift focus to try and fix the bug sooner.
I just saw this yesterday: the bot repeatedly updated its offer subtracting 100 stroops every iteration for quite a while until I caught it. In a slow market, this just drains xlm from the account.
I'm using buysell, so it can get itself into a state where it decides to oversell (despite having around 20 XLM in reserve, when the account only needs 1.5-2.5 depending on offers outstanding).
I have logs but they seem unnecessary given the cause is known, is there a way to simply turn off overselling? Is there also a way to tell the bot the minAccountBal is NOT 22.5 XLM, but rather 2.5 XLM? This would help keep it from overselling as well.
@gcochard there's no way to turn off the protection to avoid overselling.
You can use this command line option to remove the additional XLM requirement: --operationalBufferNonNativePct 0.0
The default amount is 22.5 to prevent your bot from getting stuck to a point where it cannot execute more operations. If trading XLM as one of the assets, you should consider using a SOURCE account with your TRADER account if using this command line option so fees can be deducted from your source account