whittlem / pycryptobot

Python Crypto Bot (PyCryptoBot)
Apache License 2.0
1.96k stars 736 forks source link

Issue with restart #775

Closed TruBluStu closed 1 year ago

TruBluStu commented 1 year ago

Version 7.0.36 MyISP changed my ipaddress so the bot defaulted in the number of autostarts. When I fixed the problem and restarted pycryptobot, it no longer knows that I have an open trade as indicated by "margin 0%" in the logs, however it does say "Last action BUY". Last time this situation occured about a week ago, the trading pair went over my "nosellmaxpcnt" and "trailingstoplosstrigger" in the config.json which should have triggered a sell (as it normally does), however it didn't sell. I also tried "Restart open orders" in the telegram_bot before restarting the pycryptobot service to no avail.

TruBluStu commented 1 year ago

Ok, I believe the problem involves writing to the pair.json file in telegram_data folder. The timestamp data is recorded correctly eg: "watchdog_ping": "2023-03-16T16:56:43.443824" however the values "margin", "delta", "price", "df_high", "from_df_high", are not being updated. I've tested for this problem in version 6.3.0 and the pair.json file updates fine.

TruBluStu commented 1 year ago

Ok, I found the problem in file controllers/pycryptobot.py Line 1420

if self.state.last_buy_size <= 0 and self.state.last_buy_price <= 0 and self.price <= 0 and self.state.last_action != "BUY":

self.price <= 0 was included from version 6 in the rewrite and should have been left out. (see below for fix)

if self.state.last_buy_size <= 0 and self.state.last_buy_price <= 0 and self.state.last_action != "BUY":