For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Optimizing in the background while running live or backtesting
-
I have tried a few different ways, but they have all run into a wall. Is this possible in some way?
When running a backtest I would like to have an optimizer run when a trade ends or at a certain time, let's say every 30 minutes.
I did not mess with the regular runstrategy() that starts the strategy. I made a new optimize_strategy() that has the optstrategy that I try to run while the regular backtesting is on, but when I start it I get this:
AssertionError: daemonic processes are not allowed to have children
I made a sleep() test to see if the problem came from the initial runstrategy()
def optimize_strategy(): print('Before sleep') time.sleep(10) print('After sleep')
when started from notify_trade() it pauses like it should
def notify_trade(self, trade): if trade.isclosed: optimize_strategy()
So, what I would like is the following:
- In backtesting, run a separate optstrategy when I choose and have the regular code pause when it runs.
- In live, run a separate optstrategy in the background when I choose and without interrupting the regular code.
Is it possible?