-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Threading/ProcessPooling Backtest.Optimize #620
-
Hi There,
I am trying to perform an optimised backtest on my user defined strategy. The scope of potential combinations for these 2 indicators is large, and therefore the cost-to-time for these computations is high.
Is there a way to thread/process-pool backtesting.optimize? I'm currently thinking that I can chunk the indicator combinations up and then backtest.optimize again on the set of outcomes of the chunks - do you think this is the best way forward?
Any advice on how to thread/processpool would be very helpful,
Thanks,
Kit
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 1 reply
-
chunk the indicator combinations up
This is how Backtest.optimize(method='grid')
works internally. Unfortunately not so well on Windos. Ideally, someone would have a look at implementing proper multiprocessing on Widows:
backtesting.py/backtesting/backtesting.py
Lines 1268 to 1269 in 94d20da
backtesting.py/backtesting/backtesting.py
Lines 1353 to 1382 in 94d20da
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I'll give that a go, I'm running it on linux so should work, thanks
Beta Was this translation helpful? Give feedback.
All reactions
-
Note for Mac users:
the default start method on Mac is spawn, so the multiprocessing will not work on Mac out of the box.
To enable multiprocessing on Mac set the start method manually to 'fork' before running bt
import multiprocessing
multiprocessing.set_start_method("fork")
Beta Was this translation helpful? Give feedback.