MCPcopy Index your code
hub / github.com/kernc/backtesting.py / Pool

Function Pool

backtesting/__init__.py:74–90  ·  view source on GitHub ↗
(processes=None, initializer=None, initargs=())

Source from the content-addressed store, hash-verified

72
73# Add overridable backtesting.Pool used for parallel optimization
74def Pool(processes=None, initializer=None, initargs=()):
75 import multiprocessing as mp
76 if mp.get_start_method() == 'spawn':
77 import warnings
78 warnings.warn(
79 "If you want to use multi-process optimization with "
80 "`multiprocessing.get_start_method() == 'spawn'` (e.g. on Windows),"
81 "set `backtesting.Pool = multiprocessing.Pool` (or of the desired context) "
82 "and hide `bt.optimize()` call behind a `if __name__ == '__main__'` guard. "
83 "Currently using thread-based paralellism, "
84 "which might be slightly slower for non-numpy / non-GIL-releasing code. "
85 "See https://github.com/kernc/backtesting.py/issues/1256",
86 category=RuntimeWarning, stacklevel=3)
87 from multiprocessing.dummy import Pool
88 return Pool(processes, initializer, initargs)
89 else:
90 return mp.Pool(processes, initializer, initargs)

Callers 2

_optimize_gridMethod · 0.85
runMethod · 0.85

Calls

no outgoing calls

Tested by 1

_optimize_gridMethod · 0.68