mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-05-07 06:30:23 +00:00
test: update test pandas frequency usage
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user