feat: add test for trades_data_minmax

This commit is contained in:
Matthias 2024-08-13 06:43:26 +02:00
parent 3f4c19abbc
commit 9bfd0cb63c

View File

@ -534,6 +534,24 @@ def test_datahandler_trades_get_available_data(testdatadir):
assert set(paircombs) == {"XRP/ETH"} assert set(paircombs) == {"XRP/ETH"}
def test_datahandler_trades_data_min_max(testdatadir):
dh = FeatherDataHandler(testdatadir)
min_max = dh.trades_data_min_max("XRP/ETH", TradingMode.SPOT)
assert len(min_max) == 3
# Empty pair
min_max = dh.trades_data_min_max("NADA/ETH", TradingMode.SPOT)
assert len(min_max) == 3
assert min_max[0] == datetime.fromtimestamp(0, tz=timezone.utc)
assert min_max[0] == min_max[1]
# Existing pair ...
min_max = dh.trades_data_min_max("XRP/ETH", TradingMode.SPOT)
assert len(min_max) == 3
assert min_max[0] == datetime(2019, 10, 11, 0, 0, 11, 620000, tzinfo=timezone.utc)
assert min_max[1] == datetime(2019, 10, 13, 11, 19, 28, 844000, tzinfo=timezone.utc)
def test_gethandlerclass(): def test_gethandlerclass():
cl = get_datahandlerclass("json") cl = get_datahandlerclass("json")
assert cl == JsonDataHandler assert cl == JsonDataHandler