MCPcopy Create free account
hub / github.com/kernc/backtesting.py / _round_timedelta

Function _round_timedelta

backtesting/_stats.py:94–98  ·  view source on GitHub ↗
(value, _period=_data_period(index))

Source from the content-addressed store, hash-verified

92 durations = trades_df['Duration']
93
94 def _round_timedelta(value, _period=_data_period(index)):
95 if not isinstance(value, pd.Timedelta):
96 return value
97 resolution = getattr(_period, 'resolution_string', None) or _period.resolution
98 return value.ceil(resolution)
99
100 s = pd.Series(dtype=object)
101 s.loc['Start'] = index[0]

Callers 1

compute_statsFunction · 0.85

Calls 1

_data_periodFunction · 0.85

Tested by

no test coverage detected