stellar-deprecated / kelp

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
https://kelpbot.io
Other
1.1k stars 261 forks source link

Infinite loop when encounters a trade that is different from base/quote asset #770

Open ddombrowsky opened 2 years ago

ddombrowsky commented 2 years ago

There is an infinite loop when the bot encounters a trade from a different pair on the account. This happens to me often since I switch between bots on the same stellar account (not running them simultaneously).

I would expect it to just ignore the trade and move on.

Frequency: this happens every time I switch from one pair to another.

2022/09/30 16:39:04 encountered a trade (ID=184281168177836033-0) that is different from the base and quote asset (:/WFTM:GAEDZ7BHMDYEMU6IJT3CTTGDUSLZWS5CQWZHGP4XUOIDG5ISH3AFAEK2) on the bot or uses a different trading account, botTraderAccount=GDWJONB4JX6C3Y3MQSYGHMAI2L2BYFZ2D6UENO4YIHF26X5PGZKJER77 (tradeBaseAccount=GAITTRFFPHN76ETLGET52ZXZJRELJ56B32X46OOGLG3SIC5RBC5BYT4E, tradeCounterAccount=GDWJONB4JX6C3Y3MQSYGHMAI2L2BYFZ2D6UENO4YIHF26X5PGZKJER77)
2022/09/30 16:39:04 continuing to fetch trades from the new updated cursor (184281142407536641-1) because we did not hit a stoppping condition, (numFetchedTrades = 0, total len(trades) = 0, sdexTradesFetchLimit = 200; hitCursorEnd=false, hitRateLimit=false)
2022/09/30 16:39:04 returned from fetch trades API call for SDEX using cursor '184281142407536641-1' (len(records) = 1, error = <nil>)
2022/09/30 16:39:04 encountered a trade (ID=184281168177836033-0) that is different from the base and quote asset (:/WFTM:GAEDZ7BHMDYEMU6IJT3CTTGDUSLZWS5CQWZHGP4XUOIDG5ISH3AFAEK2) on the bot or uses a different trading account, botTraderAccount=GDWJONB4JX6C3Y3MQSYGHMAI2L2BYFZ2D6UENO4YIHF26X5PGZKJER77 (tradeBaseAccount=GAITTRFFPHN76ETLGET52ZXZJRELJ56B32X46OOGLG3SIC5RBC5BYT4E, tradeCounterAccount=GDWJONB4JX6C3Y3MQSYGHMAI2L2BYFZ2D6UENO4YIHF26X5PGZKJER77)
2022/09/30 16:39:04 continuing to fetch trades from the new updated cursor (184281142407536641-1) because we did not hit a stoppping condition, (numFetchedTrades = 0, total len(trades) = 0, sdexTradesFetchLimit = 200; hitCursorEnd=false, hitRateLimit=false)
2022/09/30 16:39:04 returned from fetch trades API call for SDEX using cursor '184281142407536641-1' (len(records) = 1, error = <nil>)
.... and so on, forever ...

It makes the bot unusable until it finally encounters a trade that it expects.

The configuration is using the balanced strategy.

scoobie-bot commented 1 year ago

Having the same issue (when manually claiming / burning dust). Leave it run for 5 mins, then restart - seems to be long enough to work it's way through the unexpected transactions.

scoobie-bot commented 1 year ago

Did you make any progress solving this?

Surely there must be a way of 'resetting' a strategy to use different pairs

ddombrowsky commented 1 year ago

@scoobie-bot

I haven't dug into the source yet. Looks like this project is all but abandoned, unfortunately.

scoobie-bot commented 1 year ago

Yes, spoke with the dev recently and it is.

Solved our issue though. In trader.cfg you can change the FILL_TRACKER_LAST_TRADE_CURSOR_OVERRIDE (This is where(when?) kelp starts to search for transactions) You can get the latest cursor number from https://stellar.expert/explorer/public/asset/XLM Put that in the FILL_TRACKER and restart - you'll be good to go

smserwan commented 1 year ago

i fill empty FILL_TRACKER_LAST_TRADE_CURSOR_OVERRIDE = ""

Yes, spoke with the dev recently and it is.

Solved our issue though. In trader.cfg you can change the FILL_TRACKER_LAST_TRADE_CURSOR_OVERRIDE (This is where(when?) kelp starts to search for transactions) You can get the latest cursor number from https://stellar.expert/explorer/public/asset/XLM Put that in the FILL_TRACKER and restart - you'll be good to go

i put an empty value and it's working fine, kelp updating last cursor every few minutes FILL_TRACKER_LAST_TRADE_CURSOR_OVERRIDE = ""