fastquant icon indicating copy to clipboard operation
fastquant copied to clipboard

Add an option to change the number of cores

Open mikeejazmines opened this issue 3 years ago • 2 comments

resolves #370

Description

There is a feature in backtrader wherein you are able to change the max number of CPUs used to utilize multiprocessing. This has been included as a configurable option in the fastquant backtest wrapper. By default, it will be set to 1. Set it to None to utilize all available cores.

Documentation: https://www.backtrader.com/blog/posts/2015-07-23-multicore-optimization/multicore-optimization/ https://github.com/mementum/backtrader/blob/0fa63ef4a35dc53cc7320813f8b15480c8f85517/backtrader/cerebro.py#L80

Checklist

  • [x] I am making a pull request from a branch other than master
  • [x] I have read the CONTRIBUTING.md

mikeejazmines avatar Dec 18 '21 06:12 mikeejazmines

Testing this there is an issue of Can't pickle local object 'initalize_data.<locals>.CustomData'

This was brought up already in this thread https://community.backtrader.com/topic/2919/error-in-multi-core-optimization however i havent found a solution for this

mikeejazmines avatar Dec 20 '21 10:12 mikeejazmines

This would not work given the current usage of multiprocessing. This does not allow the serialization of lambda, and needs to use dill for pickling.

mikeejazmines avatar Jan 17 '22 02:01 mikeejazmines