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

Function _batch

backtesting/_util.py:68–72  ·  view source on GitHub ↗
(seq)

Source from the content-addressed store, hash-verified

66
67
68def _batch(seq):
69 # XXX: Replace with itertools.batched
70 n = np.clip(int(len(seq) // (os.cpu_count() or 1)), 1, 300)
71 for i in range(0, len(seq), n):
72 yield seq[i:i + n]
73
74
75def _data_period(index) -> Union[pd.Timedelta, Number]:

Callers 2

_optimize_gridMethod · 0.85
runMethod · 0.85

Calls

no outgoing calls

Tested by 1

_optimize_gridMethod · 0.68