test: update test

This commit is contained in:
Matthias
2025-09-12 06:45:27 +02:00
parent 70d7dcd189
commit 0111e97856

View File

@@ -101,8 +101,6 @@ def test_merge_informative_pair_monthly():
candle1 = result.loc[(result["date"] == "2022-12-31T22:00:00.000Z")]
assert candle1.iloc[0]["date"] == pd.Timestamp("2022-12-31T22:00:00.000Z")
assert candle1.iloc[0]["date_1M"] == pd.Timestamp("2022-11-01T00:00:00.000Z")
prev_m_vol = informative.loc[informative["date"] == "2022-11-01T00:00:00.000", "volume"]
assert candle1.iloc[0]["volume_1M"] == prev_m_vol.iloc[0]
candle2 = result.loc[(result["date"] == "2022-12-31T23:00:00.000Z")]
assert candle2.iloc[0]["date"] == pd.Timestamp("2022-12-31T23:00:00.000Z")
@@ -111,14 +109,20 @@ def test_merge_informative_pair_monthly():
# Candle is empty, as the start-date did fail.
candle3 = result.loc[(result["date"] == "2022-11-30T22:00:00.000Z")]
assert candle3.iloc[0]["date"] == pd.Timestamp("2022-11-30T22:00:00.000Z")
prev_m_vol = informative.loc[informative["date"] == "2022-10-01 00:00:00+00:00", "volume"]
assert candle3.iloc[0]["volume_1M"] == prev_m_vol.iloc[0]
# Merged on prior month
assert candle3.iloc[0]["date_1M"] == pd.Timestamp("2022-10-01T00:00:00.000Z")
# First candle with 1M data merged.
candle4 = result.loc[(result["date"] == "2022-11-30T23:00:00.000Z")]
assert candle4.iloc[0]["date"] == pd.Timestamp("2022-11-30T23:00:00.000Z")
assert candle4.iloc[0]["date_1M"] == pd.Timestamp("2022-11-01T00:00:00.000Z")
# Very first candle in the result dataframe
# Merged the latest informative candle before the start-date
candle5 = result.iloc[0]
assert candle5["date"] == pd.Timestamp("2022-11-28T00:00:00.000Z")
assert candle5["date_1M"] == pd.Timestamp("2022-10-01T00:00:00.000Z")
def test_merge_informative_pair_same():
data = generate_test_data("15m", 40)