From 9bfd0cb63cdcac421b97bf6861815f542c136f70 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 13 Aug 2024 06:43:26 +0200 Subject: [PATCH] feat: add test for trades_data_minmax --- tests/data/test_datahandler.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/data/test_datahandler.py b/tests/data/test_datahandler.py index 38f658dfb..99af63eca 100644 --- a/tests/data/test_datahandler.py +++ b/tests/data/test_datahandler.py @@ -534,6 +534,24 @@ def test_datahandler_trades_get_available_data(testdatadir): 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(): cl = get_datahandlerclass("json") assert cl == JsonDataHandler