I have a bot that I want to terminate after achieving a certain goal - determined by the code.
If I exit via sys.exit() then the the .pickle file isn’t created.
How do we shut down a bot nicely?
Also: what’s a recommended way to distinguish between Backtesting mode and live/paper mode? I want the bot to keep running when being backtested.