Skip to content

Commit 05a18d0

Browse files
committed
REF: Avoid FutureWarning on pandas 0.25.0
1 parent 332079b commit 05a18d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backtesting/backtesting.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,10 @@ def _drawdown_duration_peaks(dd, index):
874874
df.index = data.index.tz_convert(None)
875875

876876
def _round_timedelta(value, _period=_data_period(df)):
877-
return value.ceil(_period.resolution) if isinstance(value, pd.Timedelta) else value
877+
if not isinstance(value, pd.Timedelta):
878+
return value
879+
resolution = getattr(_period, 'resolution_string', None) or _period.resolution
880+
return value.ceil(resolution)
878881

879882
s = pd.Series()
880883
s['Start'] = df.index[0]

0 commit comments

Comments
 (0)