test: update test pandas frequency usage

This commit is contained in:
Matthias
2026-04-12 13:49:17 +02:00
parent 15bba1b0d0
commit cd5ea969c4

View File

@@ -207,10 +207,13 @@ def test_ohlcv_to_dataframe_multi(timeframe):
data1 = data.copy()
if timeframe in ("1M", "3M", "1y"):
data1.loc[:, "date"] = data1.loc[:, "date"] + pd.to_timedelta("1w")
data1.loc[:, "date"] = data1.loc[:, "date"] + pd.to_timedelta("1W")
else:
# Shift by half a timeframe
data1.loc[:, "date"] = data1.loc[:, "date"] + (pd.to_timedelta(timeframe) / 2)
timeframe_f = (
timeframe.upper() if timeframe.endswith("d") or timeframe.endswith("w") else timeframe
)
data1.loc[:, "date"] = data1.loc[:, "date"] + (pd.to_timedelta(timeframe_f) / 2)
df2 = ohlcv_to_dataframe(data1, timeframe, "UNITTEST/USDT")
assert len(df2) == len(data) - 1