diff --git a/pythclient/calendar.py b/pythclient/calendar.py index 63be202..29c5e94 100644 --- a/pythclient/calendar.py +++ b/pythclient/calendar.py @@ -38,6 +38,7 @@ datetime.datetime(2023, 11, 24, tzinfo=NY_TZ).date(), datetime.datetime(2024, 7, 3, tzinfo=NY_TZ).date(), datetime.datetime(2024, 11, 29, tzinfo=NY_TZ).date(), + datetime.datetime(2024, 12, 24, tzinfo=NY_TZ).date(), ] FX_METAL_OPEN_CLOSE_TIME = datetime.time(17, 0, 0, tzinfo=NY_TZ) @@ -76,6 +77,11 @@ def is_market_open(asset_type: str, dt: datetime.datetime) -> bool: if asset_type in ["fx", "metal"]: if date in FX_METAL_HOLIDAYS and time < FX_METAL_OPEN_CLOSE_TIME: return False + # If the next day is a holiday, the market is closed at 5pm ET + if ( + date + datetime.timedelta(days=1) in FX_METAL_HOLIDAYS + ) and time >= FX_METAL_OPEN_CLOSE_TIME: + return False # On Friday the market is closed after 5pm if day == 4 and time >= FX_METAL_OPEN_CLOSE_TIME: return False @@ -85,13 +91,6 @@ def is_market_open(asset_type: str, dt: datetime.datetime) -> bool: # On Sunday the market is closed before 5pm if day == 6 and time < FX_METAL_OPEN_CLOSE_TIME: return False - # On Sunday the market is closed after 5pm if the next day is a holiday - if ( - day == 6 - and time >= FX_METAL_OPEN_CLOSE_TIME - and (date + datetime.timedelta(days=1) in FX_METAL_HOLIDAYS) - ): - return False return True diff --git a/pythclient/calendar_full_intervals.py b/pythclient/calendar_full_intervals.py new file mode 100644 index 0000000..d439e7a --- /dev/null +++ b/pythclient/calendar_full_intervals.py @@ -0,0 +1,1109 @@ +import datetime + +EQUITY_2024_INTERVALS = [ + (datetime.date(2024, 1, 1), None), + (datetime.date(2024, 1, 2), "0930-1600"), + (datetime.date(2024, 1, 3), "0930-1600"), + (datetime.date(2024, 1, 4), "0930-1600"), + (datetime.date(2024, 1, 5), "0930-1600"), + (datetime.date(2024, 1, 6), None), + (datetime.date(2024, 1, 7), None), + (datetime.date(2024, 1, 8), "0930-1600"), + (datetime.date(2024, 1, 9), "0930-1600"), + (datetime.date(2024, 1, 10), "0930-1600"), + (datetime.date(2024, 1, 11), "0930-1600"), + (datetime.date(2024, 1, 12), "0930-1600"), + (datetime.date(2024, 1, 13), None), + (datetime.date(2024, 1, 14), None), + (datetime.date(2024, 1, 15), None), + (datetime.date(2024, 1, 16), "0930-1600"), + (datetime.date(2024, 1, 17), "0930-1600"), + (datetime.date(2024, 1, 18), "0930-1600"), + (datetime.date(2024, 1, 19), "0930-1600"), + (datetime.date(2024, 1, 20), None), + (datetime.date(2024, 1, 21), None), + (datetime.date(2024, 1, 22), "0930-1600"), + (datetime.date(2024, 1, 23), "0930-1600"), + (datetime.date(2024, 1, 24), "0930-1600"), + (datetime.date(2024, 1, 25), "0930-1600"), + (datetime.date(2024, 1, 26), "0930-1600"), + (datetime.date(2024, 1, 27), None), + (datetime.date(2024, 1, 28), None), + (datetime.date(2024, 1, 29), "0930-1600"), + (datetime.date(2024, 1, 30), "0930-1600"), + (datetime.date(2024, 1, 31), "0930-1600"), + (datetime.date(2024, 2, 1), "0930-1600"), + (datetime.date(2024, 2, 2), "0930-1600"), + (datetime.date(2024, 2, 3), None), + (datetime.date(2024, 2, 4), None), + (datetime.date(2024, 2, 5), "0930-1600"), + (datetime.date(2024, 2, 6), "0930-1600"), + (datetime.date(2024, 2, 7), "0930-1600"), + (datetime.date(2024, 2, 8), "0930-1600"), + (datetime.date(2024, 2, 9), "0930-1600"), + (datetime.date(2024, 2, 10), None), + (datetime.date(2024, 2, 11), None), + (datetime.date(2024, 2, 12), "0930-1600"), + (datetime.date(2024, 2, 13), "0930-1600"), + (datetime.date(2024, 2, 14), "0930-1600"), + (datetime.date(2024, 2, 15), "0930-1600"), + (datetime.date(2024, 2, 16), "0930-1600"), + (datetime.date(2024, 2, 17), None), + (datetime.date(2024, 2, 18), None), + (datetime.date(2024, 2, 19), None), + (datetime.date(2024, 2, 20), "0930-1600"), + (datetime.date(2024, 2, 21), "0930-1600"), + (datetime.date(2024, 2, 22), "0930-1600"), + (datetime.date(2024, 2, 23), "0930-1600"), + (datetime.date(2024, 2, 24), None), + (datetime.date(2024, 2, 25), None), + (datetime.date(2024, 2, 26), "0930-1600"), + (datetime.date(2024, 2, 27), "0930-1600"), + (datetime.date(2024, 2, 28), "0930-1600"), + (datetime.date(2024, 2, 29), "0930-1600"), + (datetime.date(2024, 3, 1), "0930-1600"), + (datetime.date(2024, 3, 2), None), + (datetime.date(2024, 3, 3), None), + (datetime.date(2024, 3, 4), "0930-1600"), + (datetime.date(2024, 3, 5), "0930-1600"), + (datetime.date(2024, 3, 6), "0930-1600"), + (datetime.date(2024, 3, 7), "0930-1600"), + (datetime.date(2024, 3, 8), "0930-1600"), + (datetime.date(2024, 3, 9), None), + (datetime.date(2024, 3, 10), None), + (datetime.date(2024, 3, 11), "0930-1600"), + (datetime.date(2024, 3, 12), "0930-1600"), + (datetime.date(2024, 3, 13), "0930-1600"), + (datetime.date(2024, 3, 14), "0930-1600"), + (datetime.date(2024, 3, 15), "0930-1600"), + (datetime.date(2024, 3, 16), None), + (datetime.date(2024, 3, 17), None), + (datetime.date(2024, 3, 18), "0930-1600"), + (datetime.date(2024, 3, 19), "0930-1600"), + (datetime.date(2024, 3, 20), "0930-1600"), + (datetime.date(2024, 3, 21), "0930-1600"), + (datetime.date(2024, 3, 22), "0930-1600"), + (datetime.date(2024, 3, 23), None), + (datetime.date(2024, 3, 24), None), + (datetime.date(2024, 3, 25), "0930-1600"), + (datetime.date(2024, 3, 26), "0930-1600"), + (datetime.date(2024, 3, 27), "0930-1600"), + (datetime.date(2024, 3, 28), "0930-1600"), + (datetime.date(2024, 3, 29), None), + (datetime.date(2024, 3, 30), None), + (datetime.date(2024, 3, 31), None), + (datetime.date(2024, 4, 1), "0930-1600"), + (datetime.date(2024, 4, 2), "0930-1600"), + (datetime.date(2024, 4, 3), "0930-1600"), + (datetime.date(2024, 4, 4), "0930-1600"), + (datetime.date(2024, 4, 5), "0930-1600"), + (datetime.date(2024, 4, 6), None), + (datetime.date(2024, 4, 7), None), + (datetime.date(2024, 4, 8), "0930-1600"), + (datetime.date(2024, 4, 9), "0930-1600"), + (datetime.date(2024, 4, 10), "0930-1600"), + (datetime.date(2024, 4, 11), "0930-1600"), + (datetime.date(2024, 4, 12), "0930-1600"), + (datetime.date(2024, 4, 13), None), + (datetime.date(2024, 4, 14), None), + (datetime.date(2024, 4, 15), "0930-1600"), + (datetime.date(2024, 4, 16), "0930-1600"), + (datetime.date(2024, 4, 17), "0930-1600"), + (datetime.date(2024, 4, 18), "0930-1600"), + (datetime.date(2024, 4, 19), "0930-1600"), + (datetime.date(2024, 4, 20), None), + (datetime.date(2024, 4, 21), None), + (datetime.date(2024, 4, 22), "0930-1600"), + (datetime.date(2024, 4, 23), "0930-1600"), + (datetime.date(2024, 4, 24), "0930-1600"), + (datetime.date(2024, 4, 25), "0930-1600"), + (datetime.date(2024, 4, 26), "0930-1600"), + (datetime.date(2024, 4, 27), None), + (datetime.date(2024, 4, 28), None), + (datetime.date(2024, 4, 29), "0930-1600"), + (datetime.date(2024, 4, 30), "0930-1600"), + (datetime.date(2024, 5, 1), "0930-1600"), + (datetime.date(2024, 5, 2), "0930-1600"), + (datetime.date(2024, 5, 3), "0930-1600"), + (datetime.date(2024, 5, 4), None), + (datetime.date(2024, 5, 5), None), + (datetime.date(2024, 5, 6), "0930-1600"), + (datetime.date(2024, 5, 7), "0930-1600"), + (datetime.date(2024, 5, 8), "0930-1600"), + (datetime.date(2024, 5, 9), "0930-1600"), + (datetime.date(2024, 5, 10), "0930-1600"), + (datetime.date(2024, 5, 11), None), + (datetime.date(2024, 5, 12), None), + (datetime.date(2024, 5, 13), "0930-1600"), + (datetime.date(2024, 5, 14), "0930-1600"), + (datetime.date(2024, 5, 15), "0930-1600"), + (datetime.date(2024, 5, 16), "0930-1600"), + (datetime.date(2024, 5, 17), "0930-1600"), + (datetime.date(2024, 5, 18), None), + (datetime.date(2024, 5, 19), None), + (datetime.date(2024, 5, 20), "0930-1600"), + (datetime.date(2024, 5, 21), "0930-1600"), + (datetime.date(2024, 5, 22), "0930-1600"), + (datetime.date(2024, 5, 23), "0930-1600"), + (datetime.date(2024, 5, 24), "0930-1600"), + (datetime.date(2024, 5, 25), None), + (datetime.date(2024, 5, 26), None), + (datetime.date(2024, 5, 27), None), + (datetime.date(2024, 5, 28), "0930-1600"), + (datetime.date(2024, 5, 29), "0930-1600"), + (datetime.date(2024, 5, 30), "0930-1600"), + (datetime.date(2024, 5, 31), "0930-1600"), + (datetime.date(2024, 6, 1), None), + (datetime.date(2024, 6, 2), None), + (datetime.date(2024, 6, 3), "0930-1600"), + (datetime.date(2024, 6, 4), "0930-1600"), + (datetime.date(2024, 6, 5), "0930-1600"), + (datetime.date(2024, 6, 6), "0930-1600"), + (datetime.date(2024, 6, 7), "0930-1600"), + (datetime.date(2024, 6, 8), None), + (datetime.date(2024, 6, 9), None), + (datetime.date(2024, 6, 10), "0930-1600"), + (datetime.date(2024, 6, 11), "0930-1600"), + (datetime.date(2024, 6, 12), "0930-1600"), + (datetime.date(2024, 6, 13), "0930-1600"), + (datetime.date(2024, 6, 14), "0930-1600"), + (datetime.date(2024, 6, 15), None), + (datetime.date(2024, 6, 16), None), + (datetime.date(2024, 6, 17), "0930-1600"), + (datetime.date(2024, 6, 18), "0930-1600"), + (datetime.date(2024, 6, 19), None), + (datetime.date(2024, 6, 20), "0930-1600"), + (datetime.date(2024, 6, 21), "0930-1600"), + (datetime.date(2024, 6, 22), None), + (datetime.date(2024, 6, 23), None), + (datetime.date(2024, 6, 24), "0930-1600"), + (datetime.date(2024, 6, 25), "0930-1600"), + (datetime.date(2024, 6, 26), "0930-1600"), + (datetime.date(2024, 6, 27), "0930-1600"), + (datetime.date(2024, 6, 28), "0930-1600"), + (datetime.date(2024, 6, 29), None), + (datetime.date(2024, 6, 30), None), + (datetime.date(2024, 7, 1), "0930-1600"), + (datetime.date(2024, 7, 2), "0930-1600"), + (datetime.date(2024, 7, 3), "0930-1300"), + (datetime.date(2024, 7, 4), None), + (datetime.date(2024, 7, 5), "0930-1600"), + (datetime.date(2024, 7, 6), None), + (datetime.date(2024, 7, 7), None), + (datetime.date(2024, 7, 8), "0930-1600"), + (datetime.date(2024, 7, 9), "0930-1600"), + (datetime.date(2024, 7, 10), "0930-1600"), + (datetime.date(2024, 7, 11), "0930-1600"), + (datetime.date(2024, 7, 12), "0930-1600"), + (datetime.date(2024, 7, 13), None), + (datetime.date(2024, 7, 14), None), + (datetime.date(2024, 7, 15), "0930-1600"), + (datetime.date(2024, 7, 16), "0930-1600"), + (datetime.date(2024, 7, 17), "0930-1600"), + (datetime.date(2024, 7, 18), "0930-1600"), + (datetime.date(2024, 7, 19), "0930-1600"), + (datetime.date(2024, 7, 20), None), + (datetime.date(2024, 7, 21), None), + (datetime.date(2024, 7, 22), "0930-1600"), + (datetime.date(2024, 7, 23), "0930-1600"), + (datetime.date(2024, 7, 24), "0930-1600"), + (datetime.date(2024, 7, 25), "0930-1600"), + (datetime.date(2024, 7, 26), "0930-1600"), + (datetime.date(2024, 7, 27), None), + (datetime.date(2024, 7, 28), None), + (datetime.date(2024, 7, 29), "0930-1600"), + (datetime.date(2024, 7, 30), "0930-1600"), + (datetime.date(2024, 7, 31), "0930-1600"), + (datetime.date(2024, 8, 1), "0930-1600"), + (datetime.date(2024, 8, 2), "0930-1600"), + (datetime.date(2024, 8, 3), None), + (datetime.date(2024, 8, 4), None), + (datetime.date(2024, 8, 5), "0930-1600"), + (datetime.date(2024, 8, 6), "0930-1600"), + (datetime.date(2024, 8, 7), "0930-1600"), + (datetime.date(2024, 8, 8), "0930-1600"), + (datetime.date(2024, 8, 9), "0930-1600"), + (datetime.date(2024, 8, 10), None), + (datetime.date(2024, 8, 11), None), + (datetime.date(2024, 8, 12), "0930-1600"), + (datetime.date(2024, 8, 13), "0930-1600"), + (datetime.date(2024, 8, 14), "0930-1600"), + (datetime.date(2024, 8, 15), "0930-1600"), + (datetime.date(2024, 8, 16), "0930-1600"), + (datetime.date(2024, 8, 17), None), + (datetime.date(2024, 8, 18), None), + (datetime.date(2024, 8, 19), "0930-1600"), + (datetime.date(2024, 8, 20), "0930-1600"), + (datetime.date(2024, 8, 21), "0930-1600"), + (datetime.date(2024, 8, 22), "0930-1600"), + (datetime.date(2024, 8, 23), "0930-1600"), + (datetime.date(2024, 8, 24), None), + (datetime.date(2024, 8, 25), None), + (datetime.date(2024, 8, 26), "0930-1600"), + (datetime.date(2024, 8, 27), "0930-1600"), + (datetime.date(2024, 8, 28), "0930-1600"), + (datetime.date(2024, 8, 29), "0930-1600"), + (datetime.date(2024, 8, 30), "0930-1600"), + (datetime.date(2024, 8, 31), None), + (datetime.date(2024, 9, 1), None), + (datetime.date(2024, 9, 2), None), + (datetime.date(2024, 9, 3), "0930-1600"), + (datetime.date(2024, 9, 4), "0930-1600"), + (datetime.date(2024, 9, 5), "0930-1600"), + (datetime.date(2024, 9, 6), "0930-1600"), + (datetime.date(2024, 9, 7), None), + (datetime.date(2024, 9, 8), None), + (datetime.date(2024, 9, 9), "0930-1600"), + (datetime.date(2024, 9, 10), "0930-1600"), + (datetime.date(2024, 9, 11), "0930-1600"), + (datetime.date(2024, 9, 12), "0930-1600"), + (datetime.date(2024, 9, 13), "0930-1600"), + (datetime.date(2024, 9, 14), None), + (datetime.date(2024, 9, 15), None), + (datetime.date(2024, 9, 16), "0930-1600"), + (datetime.date(2024, 9, 17), "0930-1600"), + (datetime.date(2024, 9, 18), "0930-1600"), + (datetime.date(2024, 9, 19), "0930-1600"), + (datetime.date(2024, 9, 20), "0930-1600"), + (datetime.date(2024, 9, 21), None), + (datetime.date(2024, 9, 22), None), + (datetime.date(2024, 9, 23), "0930-1600"), + (datetime.date(2024, 9, 24), "0930-1600"), + (datetime.date(2024, 9, 25), "0930-1600"), + (datetime.date(2024, 9, 26), "0930-1600"), + (datetime.date(2024, 9, 27), "0930-1600"), + (datetime.date(2024, 9, 28), None), + (datetime.date(2024, 9, 29), None), + (datetime.date(2024, 9, 30), "0930-1600"), + (datetime.date(2024, 10, 1), "0930-1600"), + (datetime.date(2024, 10, 2), "0930-1600"), + (datetime.date(2024, 10, 3), "0930-1600"), + (datetime.date(2024, 10, 4), "0930-1600"), + (datetime.date(2024, 10, 5), None), + (datetime.date(2024, 10, 6), None), + (datetime.date(2024, 10, 7), "0930-1600"), + (datetime.date(2024, 10, 8), "0930-1600"), + (datetime.date(2024, 10, 9), "0930-1600"), + (datetime.date(2024, 10, 10), "0930-1600"), + (datetime.date(2024, 10, 11), "0930-1600"), + (datetime.date(2024, 10, 12), None), + (datetime.date(2024, 10, 13), None), + (datetime.date(2024, 10, 14), "0930-1600"), + (datetime.date(2024, 10, 15), "0930-1600"), + (datetime.date(2024, 10, 16), "0930-1600"), + (datetime.date(2024, 10, 17), "0930-1600"), + (datetime.date(2024, 10, 18), "0930-1600"), + (datetime.date(2024, 10, 19), None), + (datetime.date(2024, 10, 20), None), + (datetime.date(2024, 10, 21), "0930-1600"), + (datetime.date(2024, 10, 22), "0930-1600"), + (datetime.date(2024, 10, 23), "0930-1600"), + (datetime.date(2024, 10, 24), "0930-1600"), + (datetime.date(2024, 10, 25), "0930-1600"), + (datetime.date(2024, 10, 26), None), + (datetime.date(2024, 10, 27), None), + (datetime.date(2024, 10, 28), "0930-1600"), + (datetime.date(2024, 10, 29), "0930-1600"), + (datetime.date(2024, 10, 30), "0930-1600"), + (datetime.date(2024, 10, 31), "0930-1600"), + (datetime.date(2024, 11, 1), "0930-1600"), + (datetime.date(2024, 11, 2), None), + (datetime.date(2024, 11, 3), None), + (datetime.date(2024, 11, 4), "0930-1600"), + (datetime.date(2024, 11, 5), "0930-1600"), + (datetime.date(2024, 11, 6), "0930-1600"), + (datetime.date(2024, 11, 7), "0930-1600"), + (datetime.date(2024, 11, 8), "0930-1600"), + (datetime.date(2024, 11, 9), None), + (datetime.date(2024, 11, 10), None), + (datetime.date(2024, 11, 11), "0930-1600"), + (datetime.date(2024, 11, 12), "0930-1600"), + (datetime.date(2024, 11, 13), "0930-1600"), + (datetime.date(2024, 11, 14), "0930-1600"), + (datetime.date(2024, 11, 15), "0930-1600"), + (datetime.date(2024, 11, 16), None), + (datetime.date(2024, 11, 17), None), + (datetime.date(2024, 11, 18), "0930-1600"), + (datetime.date(2024, 11, 19), "0930-1600"), + (datetime.date(2024, 11, 20), "0930-1600"), + (datetime.date(2024, 11, 21), "0930-1600"), + (datetime.date(2024, 11, 22), "0930-1600"), + (datetime.date(2024, 11, 23), None), + (datetime.date(2024, 11, 24), None), + (datetime.date(2024, 11, 25), "0930-1600"), + (datetime.date(2024, 11, 26), "0930-1600"), + (datetime.date(2024, 11, 27), "0930-1600"), + (datetime.date(2024, 11, 28), None), + (datetime.date(2024, 11, 29), "0930-1300"), + (datetime.date(2024, 11, 30), None), + (datetime.date(2024, 12, 1), None), + (datetime.date(2024, 12, 2), "0930-1600"), + (datetime.date(2024, 12, 3), "0930-1600"), + (datetime.date(2024, 12, 4), "0930-1600"), + (datetime.date(2024, 12, 5), "0930-1600"), + (datetime.date(2024, 12, 6), "0930-1600"), + (datetime.date(2024, 12, 7), None), + (datetime.date(2024, 12, 8), None), + (datetime.date(2024, 12, 9), "0930-1600"), + (datetime.date(2024, 12, 10), "0930-1600"), + (datetime.date(2024, 12, 11), "0930-1600"), + (datetime.date(2024, 12, 12), "0930-1600"), + (datetime.date(2024, 12, 13), "0930-1600"), + (datetime.date(2024, 12, 14), None), + (datetime.date(2024, 12, 15), None), + (datetime.date(2024, 12, 16), "0930-1600"), + (datetime.date(2024, 12, 17), "0930-1600"), + (datetime.date(2024, 12, 18), "0930-1600"), + (datetime.date(2024, 12, 19), "0930-1600"), + (datetime.date(2024, 12, 20), "0930-1600"), + (datetime.date(2024, 12, 21), None), + (datetime.date(2024, 12, 22), None), + (datetime.date(2024, 12, 23), "0930-1600"), + (datetime.date(2024, 12, 24), "0930-1300"), + (datetime.date(2024, 12, 25), None), + (datetime.date(2024, 12, 26), "0930-1600"), + (datetime.date(2024, 12, 27), "0930-1600"), + (datetime.date(2024, 12, 28), None), + (datetime.date(2024, 12, 29), None), + (datetime.date(2024, 12, 30), "0930-1600"), + (datetime.date(2024, 12, 31), "0930-1600"), +] + +FX_METAL_2024_INTERVALS = [ + (datetime.date(2023, 12, 31), None), + (datetime.date(2024, 1, 1), "1700-0000"), + (datetime.date(2024, 1, 2), "0000-0000"), + (datetime.date(2024, 1, 3), "0000-0000"), + (datetime.date(2024, 1, 4), "0000-0000"), + (datetime.date(2024, 1, 5), "0000-1700"), + (datetime.date(2024, 1, 6), None), + (datetime.date(2024, 1, 7), "1700-0000"), + (datetime.date(2024, 1, 8), "0000-0000"), + (datetime.date(2024, 1, 9), "0000-0000"), + (datetime.date(2024, 1, 10), "0000-0000"), + (datetime.date(2024, 1, 11), "0000-0000"), + (datetime.date(2024, 1, 12), "0000-1700"), + (datetime.date(2024, 1, 13), None), + (datetime.date(2024, 1, 14), "1700-0000"), + (datetime.date(2024, 1, 15), "0000-0000"), + (datetime.date(2024, 1, 16), "0000-0000"), + (datetime.date(2024, 1, 17), "0000-0000"), + (datetime.date(2024, 1, 18), "0000-0000"), + (datetime.date(2024, 1, 19), "0000-1700"), + (datetime.date(2024, 1, 20), None), + (datetime.date(2024, 1, 21), "1700-0000"), + (datetime.date(2024, 1, 22), "0000-0000"), + (datetime.date(2024, 1, 23), "0000-0000"), + (datetime.date(2024, 1, 24), "0000-0000"), + (datetime.date(2024, 1, 25), "0000-0000"), + (datetime.date(2024, 1, 26), "0000-1700"), + (datetime.date(2024, 1, 27), None), + (datetime.date(2024, 1, 28), "1700-0000"), + (datetime.date(2024, 1, 29), "0000-0000"), + (datetime.date(2024, 1, 30), "0000-0000"), + (datetime.date(2024, 1, 31), "0000-0000"), + (datetime.date(2024, 2, 1), "0000-0000"), + (datetime.date(2024, 2, 2), "0000-1700"), + (datetime.date(2024, 2, 3), None), + (datetime.date(2024, 2, 4), "1700-0000"), + (datetime.date(2024, 2, 5), "0000-0000"), + (datetime.date(2024, 2, 6), "0000-0000"), + (datetime.date(2024, 2, 7), "0000-0000"), + (datetime.date(2024, 2, 8), "0000-0000"), + (datetime.date(2024, 2, 9), "0000-1700"), + (datetime.date(2024, 2, 10), None), + (datetime.date(2024, 2, 11), "1700-0000"), + (datetime.date(2024, 2, 12), "0000-0000"), + (datetime.date(2024, 2, 13), "0000-0000"), + (datetime.date(2024, 2, 14), "0000-0000"), + (datetime.date(2024, 2, 15), "0000-0000"), + (datetime.date(2024, 2, 16), "0000-1700"), + (datetime.date(2024, 2, 17), None), + (datetime.date(2024, 2, 18), "1700-0000"), + (datetime.date(2024, 2, 19), "0000-0000"), + (datetime.date(2024, 2, 20), "0000-0000"), + (datetime.date(2024, 2, 21), "0000-0000"), + (datetime.date(2024, 2, 22), "0000-0000"), + (datetime.date(2024, 2, 23), "0000-1700"), + (datetime.date(2024, 2, 24), None), + (datetime.date(2024, 2, 25), "1700-0000"), + (datetime.date(2024, 2, 26), "0000-0000"), + (datetime.date(2024, 2, 27), "0000-0000"), + (datetime.date(2024, 2, 28), "0000-0000"), + (datetime.date(2024, 2, 29), "0000-0000"), + (datetime.date(2024, 3, 1), "0000-1700"), + (datetime.date(2024, 3, 2), None), + (datetime.date(2024, 3, 3), "1700-0000"), + (datetime.date(2024, 3, 4), "0000-0000"), + (datetime.date(2024, 3, 5), "0000-0000"), + (datetime.date(2024, 3, 6), "0000-0000"), + (datetime.date(2024, 3, 7), "0000-0000"), + (datetime.date(2024, 3, 8), "0000-1700"), + (datetime.date(2024, 3, 9), None), + (datetime.date(2024, 3, 10), "1700-0000"), + (datetime.date(2024, 3, 11), "0000-0000"), + (datetime.date(2024, 3, 12), "0000-0000"), + (datetime.date(2024, 3, 13), "0000-0000"), + (datetime.date(2024, 3, 14), "0000-0000"), + (datetime.date(2024, 3, 15), "0000-1700"), + (datetime.date(2024, 3, 16), None), + (datetime.date(2024, 3, 17), "1700-0000"), + (datetime.date(2024, 3, 18), "0000-0000"), + (datetime.date(2024, 3, 19), "0000-0000"), + (datetime.date(2024, 3, 20), "0000-0000"), + (datetime.date(2024, 3, 21), "0000-0000"), + (datetime.date(2024, 3, 22), "0000-1700"), + (datetime.date(2024, 3, 23), None), + (datetime.date(2024, 3, 24), "1700-0000"), + (datetime.date(2024, 3, 25), "0000-0000"), + (datetime.date(2024, 3, 26), "0000-0000"), + (datetime.date(2024, 3, 27), "0000-0000"), + (datetime.date(2024, 3, 28), "0000-0000"), + (datetime.date(2024, 3, 29), "0000-1700"), + (datetime.date(2024, 3, 30), None), + (datetime.date(2024, 3, 31), "1700-0000"), + (datetime.date(2024, 4, 1), "0000-0000"), + (datetime.date(2024, 4, 2), "0000-0000"), + (datetime.date(2024, 4, 3), "0000-0000"), + (datetime.date(2024, 4, 4), "0000-0000"), + (datetime.date(2024, 4, 5), "0000-1700"), + (datetime.date(2024, 4, 6), None), + (datetime.date(2024, 4, 7), "1700-0000"), + (datetime.date(2024, 4, 8), "0000-0000"), + (datetime.date(2024, 4, 9), "0000-0000"), + (datetime.date(2024, 4, 10), "0000-0000"), + (datetime.date(2024, 4, 11), "0000-0000"), + (datetime.date(2024, 4, 12), "0000-1700"), + (datetime.date(2024, 4, 13), None), + (datetime.date(2024, 4, 14), "1700-0000"), + (datetime.date(2024, 4, 15), "0000-0000"), + (datetime.date(2024, 4, 16), "0000-0000"), + (datetime.date(2024, 4, 17), "0000-0000"), + (datetime.date(2024, 4, 18), "0000-0000"), + (datetime.date(2024, 4, 19), "0000-1700"), + (datetime.date(2024, 4, 20), None), + (datetime.date(2024, 4, 21), "1700-0000"), + (datetime.date(2024, 4, 22), "0000-0000"), + (datetime.date(2024, 4, 23), "0000-0000"), + (datetime.date(2024, 4, 24), "0000-0000"), + (datetime.date(2024, 4, 25), "0000-0000"), + (datetime.date(2024, 4, 26), "0000-1700"), + (datetime.date(2024, 4, 27), None), + (datetime.date(2024, 4, 28), "1700-0000"), + (datetime.date(2024, 4, 29), "0000-0000"), + (datetime.date(2024, 4, 30), "0000-0000"), + (datetime.date(2024, 5, 1), "0000-0000"), + (datetime.date(2024, 5, 2), "0000-0000"), + (datetime.date(2024, 5, 3), "0000-1700"), + (datetime.date(2024, 5, 4), None), + (datetime.date(2024, 5, 5), "1700-0000"), + (datetime.date(2024, 5, 6), "0000-0000"), + (datetime.date(2024, 5, 7), "0000-0000"), + (datetime.date(2024, 5, 8), "0000-0000"), + (datetime.date(2024, 5, 9), "0000-0000"), + (datetime.date(2024, 5, 10), "0000-1700"), + (datetime.date(2024, 5, 11), None), + (datetime.date(2024, 5, 12), "1700-0000"), + (datetime.date(2024, 5, 13), "0000-0000"), + (datetime.date(2024, 5, 14), "0000-0000"), + (datetime.date(2024, 5, 15), "0000-0000"), + (datetime.date(2024, 5, 16), "0000-0000"), + (datetime.date(2024, 5, 17), "0000-1700"), + (datetime.date(2024, 5, 18), None), + (datetime.date(2024, 5, 19), "1700-0000"), + (datetime.date(2024, 5, 20), "0000-0000"), + (datetime.date(2024, 5, 21), "0000-0000"), + (datetime.date(2024, 5, 22), "0000-0000"), + (datetime.date(2024, 5, 23), "0000-0000"), + (datetime.date(2024, 5, 24), "0000-1700"), + (datetime.date(2024, 5, 25), None), + (datetime.date(2024, 5, 26), "1700-0000"), + (datetime.date(2024, 5, 27), "0000-0000"), + (datetime.date(2024, 5, 28), "0000-0000"), + (datetime.date(2024, 5, 29), "0000-0000"), + (datetime.date(2024, 5, 30), "0000-0000"), + (datetime.date(2024, 5, 31), "0000-1700"), + (datetime.date(2024, 6, 1), None), + (datetime.date(2024, 6, 2), "1700-0000"), + (datetime.date(2024, 6, 3), "0000-0000"), + (datetime.date(2024, 6, 4), "0000-0000"), + (datetime.date(2024, 6, 5), "0000-0000"), + (datetime.date(2024, 6, 6), "0000-0000"), + (datetime.date(2024, 6, 7), "0000-1700"), + (datetime.date(2024, 6, 8), None), + (datetime.date(2024, 6, 9), "1700-0000"), + (datetime.date(2024, 6, 10), "0000-0000"), + (datetime.date(2024, 6, 11), "0000-0000"), + (datetime.date(2024, 6, 12), "0000-0000"), + (datetime.date(2024, 6, 13), "0000-0000"), + (datetime.date(2024, 6, 14), "0000-1700"), + (datetime.date(2024, 6, 15), None), + (datetime.date(2024, 6, 16), "1700-0000"), + (datetime.date(2024, 6, 17), "0000-0000"), + (datetime.date(2024, 6, 18), "0000-0000"), + (datetime.date(2024, 6, 19), "0000-0000"), + (datetime.date(2024, 6, 20), "0000-0000"), + (datetime.date(2024, 6, 21), "0000-1700"), + (datetime.date(2024, 6, 22), None), + (datetime.date(2024, 6, 23), "1700-0000"), + (datetime.date(2024, 6, 24), "0000-0000"), + (datetime.date(2024, 6, 25), "0000-0000"), + (datetime.date(2024, 6, 26), "0000-0000"), + (datetime.date(2024, 6, 27), "0000-0000"), + (datetime.date(2024, 6, 28), "0000-1700"), + (datetime.date(2024, 6, 29), None), + (datetime.date(2024, 6, 30), "1700-0000"), + (datetime.date(2024, 7, 1), "0000-0000"), + (datetime.date(2024, 7, 2), "0000-0000"), + (datetime.date(2024, 7, 3), "0000-0000"), + (datetime.date(2024, 7, 4), "0000-0000"), + (datetime.date(2024, 7, 5), "0000-1700"), + (datetime.date(2024, 7, 6), None), + (datetime.date(2024, 7, 7), "1700-0000"), + (datetime.date(2024, 7, 8), "0000-0000"), + (datetime.date(2024, 7, 9), "0000-0000"), + (datetime.date(2024, 7, 10), "0000-0000"), + (datetime.date(2024, 7, 11), "0000-0000"), + (datetime.date(2024, 7, 12), "0000-1700"), + (datetime.date(2024, 7, 13), None), + (datetime.date(2024, 7, 14), "1700-0000"), + (datetime.date(2024, 7, 15), "0000-0000"), + (datetime.date(2024, 7, 16), "0000-0000"), + (datetime.date(2024, 7, 17), "0000-0000"), + (datetime.date(2024, 7, 18), "0000-0000"), + (datetime.date(2024, 7, 19), "0000-1700"), + (datetime.date(2024, 7, 20), None), + (datetime.date(2024, 7, 21), "1700-0000"), + (datetime.date(2024, 7, 22), "0000-0000"), + (datetime.date(2024, 7, 23), "0000-0000"), + (datetime.date(2024, 7, 24), "0000-0000"), + (datetime.date(2024, 7, 25), "0000-0000"), + (datetime.date(2024, 7, 26), "0000-1700"), + (datetime.date(2024, 7, 27), None), + (datetime.date(2024, 7, 28), "1700-0000"), + (datetime.date(2024, 7, 29), "0000-0000"), + (datetime.date(2024, 7, 30), "0000-0000"), + (datetime.date(2024, 7, 31), "0000-0000"), + (datetime.date(2024, 8, 1), "0000-0000"), + (datetime.date(2024, 8, 2), "0000-1700"), + (datetime.date(2024, 8, 3), None), + (datetime.date(2024, 8, 4), "1700-0000"), + (datetime.date(2024, 8, 5), "0000-0000"), + (datetime.date(2024, 8, 6), "0000-0000"), + (datetime.date(2024, 8, 7), "0000-0000"), + (datetime.date(2024, 8, 8), "0000-0000"), + (datetime.date(2024, 8, 9), "0000-1700"), + (datetime.date(2024, 8, 10), None), + (datetime.date(2024, 8, 11), "1700-0000"), + (datetime.date(2024, 8, 12), "0000-0000"), + (datetime.date(2024, 8, 13), "0000-0000"), + (datetime.date(2024, 8, 14), "0000-0000"), + (datetime.date(2024, 8, 15), "0000-0000"), + (datetime.date(2024, 8, 16), "0000-1700"), + (datetime.date(2024, 8, 17), None), + (datetime.date(2024, 8, 18), "1700-0000"), + (datetime.date(2024, 8, 19), "0000-0000"), + (datetime.date(2024, 8, 20), "0000-0000"), + (datetime.date(2024, 8, 21), "0000-0000"), + (datetime.date(2024, 8, 22), "0000-0000"), + (datetime.date(2024, 8, 23), "0000-1700"), + (datetime.date(2024, 8, 24), None), + (datetime.date(2024, 8, 25), "1700-0000"), + (datetime.date(2024, 8, 26), "0000-0000"), + (datetime.date(2024, 8, 27), "0000-0000"), + (datetime.date(2024, 8, 28), "0000-0000"), + (datetime.date(2024, 8, 29), "0000-0000"), + (datetime.date(2024, 8, 30), "0000-1700"), + (datetime.date(2024, 8, 31), None), + (datetime.date(2024, 9, 1), "1700-0000"), + (datetime.date(2024, 9, 2), "0000-0000"), + (datetime.date(2024, 9, 3), "0000-0000"), + (datetime.date(2024, 9, 4), "0000-0000"), + (datetime.date(2024, 9, 5), "0000-0000"), + (datetime.date(2024, 9, 6), "0000-1700"), + (datetime.date(2024, 9, 7), None), + (datetime.date(2024, 9, 8), "1700-0000"), + (datetime.date(2024, 9, 9), "0000-0000"), + (datetime.date(2024, 9, 10), "0000-0000"), + (datetime.date(2024, 9, 11), "0000-0000"), + (datetime.date(2024, 9, 12), "0000-0000"), + (datetime.date(2024, 9, 13), "0000-1700"), + (datetime.date(2024, 9, 14), None), + (datetime.date(2024, 9, 15), "1700-0000"), + (datetime.date(2024, 9, 16), "0000-0000"), + (datetime.date(2024, 9, 17), "0000-0000"), + (datetime.date(2024, 9, 18), "0000-0000"), + (datetime.date(2024, 9, 19), "0000-0000"), + (datetime.date(2024, 9, 20), "0000-1700"), + (datetime.date(2024, 9, 21), None), + (datetime.date(2024, 9, 22), "1700-0000"), + (datetime.date(2024, 9, 23), "0000-0000"), + (datetime.date(2024, 9, 24), "0000-0000"), + (datetime.date(2024, 9, 25), "0000-0000"), + (datetime.date(2024, 9, 26), "0000-0000"), + (datetime.date(2024, 9, 27), "0000-1700"), + (datetime.date(2024, 9, 28), None), + (datetime.date(2024, 9, 29), "1700-0000"), + (datetime.date(2024, 9, 30), "0000-0000"), + (datetime.date(2024, 10, 1), "0000-0000"), + (datetime.date(2024, 10, 2), "0000-0000"), + (datetime.date(2024, 10, 3), "0000-0000"), + (datetime.date(2024, 10, 4), "0000-1700"), + (datetime.date(2024, 10, 5), None), + (datetime.date(2024, 10, 6), "1700-0000"), + (datetime.date(2024, 10, 7), "0000-0000"), + (datetime.date(2024, 10, 8), "0000-0000"), + (datetime.date(2024, 10, 9), "0000-0000"), + (datetime.date(2024, 10, 10), "0000-0000"), + (datetime.date(2024, 10, 11), "0000-1700"), + (datetime.date(2024, 10, 12), None), + (datetime.date(2024, 10, 13), "1700-0000"), + (datetime.date(2024, 10, 14), "0000-0000"), + (datetime.date(2024, 10, 15), "0000-0000"), + (datetime.date(2024, 10, 16), "0000-0000"), + (datetime.date(2024, 10, 17), "0000-0000"), + (datetime.date(2024, 10, 18), "0000-1700"), + (datetime.date(2024, 10, 19), None), + (datetime.date(2024, 10, 20), "1700-0000"), + (datetime.date(2024, 10, 21), "0000-0000"), + (datetime.date(2024, 10, 22), "0000-0000"), + (datetime.date(2024, 10, 23), "0000-0000"), + (datetime.date(2024, 10, 24), "0000-0000"), + (datetime.date(2024, 10, 25), "0000-1700"), + (datetime.date(2024, 10, 26), None), + (datetime.date(2024, 10, 27), "1700-0000"), + (datetime.date(2024, 10, 28), "0000-0000"), + (datetime.date(2024, 10, 29), "0000-0000"), + (datetime.date(2024, 10, 30), "0000-0000"), + (datetime.date(2024, 10, 31), "0000-0000"), + (datetime.date(2024, 11, 1), "0000-1700"), + (datetime.date(2024, 11, 2), None), + (datetime.date(2024, 11, 3), "1700-0000"), + (datetime.date(2024, 11, 4), "0000-0000"), + (datetime.date(2024, 11, 5), "0000-0000"), + (datetime.date(2024, 11, 6), "0000-0000"), + (datetime.date(2024, 11, 7), "0000-0000"), + (datetime.date(2024, 11, 8), "0000-1700"), + (datetime.date(2024, 11, 9), None), + (datetime.date(2024, 11, 10), "1700-0000"), + (datetime.date(2024, 11, 11), "0000-0000"), + (datetime.date(2024, 11, 12), "0000-0000"), + (datetime.date(2024, 11, 13), "0000-0000"), + (datetime.date(2024, 11, 14), "0000-0000"), + (datetime.date(2024, 11, 15), "0000-1700"), + (datetime.date(2024, 11, 16), None), + (datetime.date(2024, 11, 17), "1700-0000"), + (datetime.date(2024, 11, 18), "0000-0000"), + (datetime.date(2024, 11, 19), "0000-0000"), + (datetime.date(2024, 11, 20), "0000-0000"), + (datetime.date(2024, 11, 21), "0000-0000"), + (datetime.date(2024, 11, 22), "0000-1700"), + (datetime.date(2024, 11, 23), None), + (datetime.date(2024, 11, 24), "1700-0000"), + (datetime.date(2024, 11, 25), "0000-0000"), + (datetime.date(2024, 11, 26), "0000-0000"), + (datetime.date(2024, 11, 27), "0000-0000"), + (datetime.date(2024, 11, 28), "0000-0000"), + (datetime.date(2024, 11, 29), "0000-1700"), + (datetime.date(2024, 11, 30), None), + (datetime.date(2024, 12, 1), "1700-0000"), + (datetime.date(2024, 12, 2), "0000-0000"), + (datetime.date(2024, 12, 3), "0000-0000"), + (datetime.date(2024, 12, 4), "0000-0000"), + (datetime.date(2024, 12, 5), "0000-0000"), + (datetime.date(2024, 12, 6), "0000-1700"), + (datetime.date(2024, 12, 7), None), + (datetime.date(2024, 12, 8), "1700-0000"), + (datetime.date(2024, 12, 9), "0000-0000"), + (datetime.date(2024, 12, 10), "0000-0000"), + (datetime.date(2024, 12, 11), "0000-0000"), + (datetime.date(2024, 12, 12), "0000-0000"), + (datetime.date(2024, 12, 13), "0000-1700"), + (datetime.date(2024, 12, 14), None), + (datetime.date(2024, 12, 15), "1700-0000"), + (datetime.date(2024, 12, 16), "0000-0000"), + (datetime.date(2024, 12, 17), "0000-0000"), + (datetime.date(2024, 12, 18), "0000-0000"), + (datetime.date(2024, 12, 19), "0000-0000"), + (datetime.date(2024, 12, 20), "0000-1700"), + (datetime.date(2024, 12, 21), None), + (datetime.date(2024, 12, 22), "1700-0000"), + (datetime.date(2024, 12, 23), "0000-0000"), + (datetime.date(2024, 12, 24), "0000-1700"), + (datetime.date(2024, 12, 25), "1700-0000"), + (datetime.date(2024, 12, 26), "0000-0000"), + (datetime.date(2024, 12, 27), "0000-1700"), + (datetime.date(2024, 12, 28), None), + (datetime.date(2024, 12, 29), "1700-0000"), + (datetime.date(2024, 12, 30), "0000-0000"), + (datetime.date(2024, 12, 31), "0000-0000"), +] + +RATES_2024_INTERVALS = [ + (datetime.date(2024, 1, 1), None), + (datetime.date(2024, 1, 2), "0800-1700"), + (datetime.date(2024, 1, 3), "0800-1700"), + (datetime.date(2024, 1, 4), "0800-1700"), + (datetime.date(2024, 1, 5), "0800-1700"), + (datetime.date(2024, 1, 6), None), + (datetime.date(2024, 1, 7), None), + (datetime.date(2024, 1, 8), "0800-1700"), + (datetime.date(2024, 1, 9), "0800-1700"), + (datetime.date(2024, 1, 10), "0800-1700"), + (datetime.date(2024, 1, 11), "0800-1700"), + (datetime.date(2024, 1, 12), "0800-1700"), + (datetime.date(2024, 1, 13), None), + (datetime.date(2024, 1, 14), None), + (datetime.date(2024, 1, 15), None), + (datetime.date(2024, 1, 16), "0800-1700"), + (datetime.date(2024, 1, 17), "0800-1700"), + (datetime.date(2024, 1, 18), "0800-1700"), + (datetime.date(2024, 1, 19), "0800-1700"), + (datetime.date(2024, 1, 20), None), + (datetime.date(2024, 1, 21), None), + (datetime.date(2024, 1, 22), "0800-1700"), + (datetime.date(2024, 1, 23), "0800-1700"), + (datetime.date(2024, 1, 24), "0800-1700"), + (datetime.date(2024, 1, 25), "0800-1700"), + (datetime.date(2024, 1, 26), "0800-1700"), + (datetime.date(2024, 1, 27), None), + (datetime.date(2024, 1, 28), None), + (datetime.date(2024, 1, 29), "0800-1700"), + (datetime.date(2024, 1, 30), "0800-1700"), + (datetime.date(2024, 1, 31), "0800-1700"), + (datetime.date(2024, 2, 1), "0800-1700"), + (datetime.date(2024, 2, 2), "0800-1700"), + (datetime.date(2024, 2, 3), None), + (datetime.date(2024, 2, 4), None), + (datetime.date(2024, 2, 5), "0800-1700"), + (datetime.date(2024, 2, 6), "0800-1700"), + (datetime.date(2024, 2, 7), "0800-1700"), + (datetime.date(2024, 2, 8), "0800-1700"), + (datetime.date(2024, 2, 9), "0800-1700"), + (datetime.date(2024, 2, 10), None), + (datetime.date(2024, 2, 11), None), + (datetime.date(2024, 2, 12), "0800-1700"), + (datetime.date(2024, 2, 13), "0800-1700"), + (datetime.date(2024, 2, 14), "0800-1700"), + (datetime.date(2024, 2, 15), "0800-1700"), + (datetime.date(2024, 2, 16), "0800-1700"), + (datetime.date(2024, 2, 17), None), + (datetime.date(2024, 2, 18), None), + (datetime.date(2024, 2, 19), None), + (datetime.date(2024, 2, 20), "0800-1700"), + (datetime.date(2024, 2, 21), "0800-1700"), + (datetime.date(2024, 2, 22), "0800-1700"), + (datetime.date(2024, 2, 23), "0800-1700"), + (datetime.date(2024, 2, 24), None), + (datetime.date(2024, 2, 25), None), + (datetime.date(2024, 2, 26), "0800-1700"), + (datetime.date(2024, 2, 27), "0800-1700"), + (datetime.date(2024, 2, 28), "0800-1700"), + (datetime.date(2024, 2, 29), "0800-1700"), + (datetime.date(2024, 3, 1), "0800-1700"), + (datetime.date(2024, 3, 2), None), + (datetime.date(2024, 3, 3), None), + (datetime.date(2024, 3, 4), "0800-1700"), + (datetime.date(2024, 3, 5), "0800-1700"), + (datetime.date(2024, 3, 6), "0800-1700"), + (datetime.date(2024, 3, 7), "0800-1700"), + (datetime.date(2024, 3, 8), "0800-1700"), + (datetime.date(2024, 3, 9), None), + (datetime.date(2024, 3, 10), None), + (datetime.date(2024, 3, 11), "0800-1700"), + (datetime.date(2024, 3, 12), "0800-1700"), + (datetime.date(2024, 3, 13), "0800-1700"), + (datetime.date(2024, 3, 14), "0800-1700"), + (datetime.date(2024, 3, 15), "0800-1700"), + (datetime.date(2024, 3, 16), None), + (datetime.date(2024, 3, 17), None), + (datetime.date(2024, 3, 18), "0800-1700"), + (datetime.date(2024, 3, 19), "0800-1700"), + (datetime.date(2024, 3, 20), "0800-1700"), + (datetime.date(2024, 3, 21), "0800-1700"), + (datetime.date(2024, 3, 22), "0800-1700"), + (datetime.date(2024, 3, 23), None), + (datetime.date(2024, 3, 24), None), + (datetime.date(2024, 3, 25), "0800-1700"), + (datetime.date(2024, 3, 26), "0800-1700"), + (datetime.date(2024, 3, 27), "0800-1700"), + (datetime.date(2024, 3, 28), "0800-1700"), + (datetime.date(2024, 3, 29), None), + (datetime.date(2024, 3, 30), None), + (datetime.date(2024, 3, 31), None), + (datetime.date(2024, 4, 1), "0800-1700"), + (datetime.date(2024, 4, 2), "0800-1700"), + (datetime.date(2024, 4, 3), "0800-1700"), + (datetime.date(2024, 4, 4), "0800-1700"), + (datetime.date(2024, 4, 5), "0800-1700"), + (datetime.date(2024, 4, 6), None), + (datetime.date(2024, 4, 7), None), + (datetime.date(2024, 4, 8), "0800-1700"), + (datetime.date(2024, 4, 9), "0800-1700"), + (datetime.date(2024, 4, 10), "0800-1700"), + (datetime.date(2024, 4, 11), "0800-1700"), + (datetime.date(2024, 4, 12), "0800-1700"), + (datetime.date(2024, 4, 13), None), + (datetime.date(2024, 4, 14), None), + (datetime.date(2024, 4, 15), "0800-1700"), + (datetime.date(2024, 4, 16), "0800-1700"), + (datetime.date(2024, 4, 17), "0800-1700"), + (datetime.date(2024, 4, 18), "0800-1700"), + (datetime.date(2024, 4, 19), "0800-1700"), + (datetime.date(2024, 4, 20), None), + (datetime.date(2024, 4, 21), None), + (datetime.date(2024, 4, 22), "0800-1700"), + (datetime.date(2024, 4, 23), "0800-1700"), + (datetime.date(2024, 4, 24), "0800-1700"), + (datetime.date(2024, 4, 25), "0800-1700"), + (datetime.date(2024, 4, 26), "0800-1700"), + (datetime.date(2024, 4, 27), None), + (datetime.date(2024, 4, 28), None), + (datetime.date(2024, 4, 29), "0800-1700"), + (datetime.date(2024, 4, 30), "0800-1700"), + (datetime.date(2024, 5, 1), "0800-1700"), + (datetime.date(2024, 5, 2), "0800-1700"), + (datetime.date(2024, 5, 3), "0800-1700"), + (datetime.date(2024, 5, 4), None), + (datetime.date(2024, 5, 5), None), + (datetime.date(2024, 5, 6), "0800-1700"), + (datetime.date(2024, 5, 7), "0800-1700"), + (datetime.date(2024, 5, 8), "0800-1700"), + (datetime.date(2024, 5, 9), "0800-1700"), + (datetime.date(2024, 5, 10), "0800-1700"), + (datetime.date(2024, 5, 11), None), + (datetime.date(2024, 5, 12), None), + (datetime.date(2024, 5, 13), "0800-1700"), + (datetime.date(2024, 5, 14), "0800-1700"), + (datetime.date(2024, 5, 15), "0800-1700"), + (datetime.date(2024, 5, 16), "0800-1700"), + (datetime.date(2024, 5, 17), "0800-1700"), + (datetime.date(2024, 5, 18), None), + (datetime.date(2024, 5, 19), None), + (datetime.date(2024, 5, 20), "0800-1700"), + (datetime.date(2024, 5, 21), "0800-1700"), + (datetime.date(2024, 5, 22), "0800-1700"), + (datetime.date(2024, 5, 23), "0800-1700"), + (datetime.date(2024, 5, 24), "0800-1700"), + (datetime.date(2024, 5, 25), None), + (datetime.date(2024, 5, 26), None), + (datetime.date(2024, 5, 27), None), + (datetime.date(2024, 5, 28), "0800-1700"), + (datetime.date(2024, 5, 29), "0800-1700"), + (datetime.date(2024, 5, 30), "0800-1700"), + (datetime.date(2024, 5, 31), "0800-1700"), + (datetime.date(2024, 6, 1), None), + (datetime.date(2024, 6, 2), None), + (datetime.date(2024, 6, 3), "0800-1700"), + (datetime.date(2024, 6, 4), "0800-1700"), + (datetime.date(2024, 6, 5), "0800-1700"), + (datetime.date(2024, 6, 6), "0800-1700"), + (datetime.date(2024, 6, 7), "0800-1700"), + (datetime.date(2024, 6, 8), None), + (datetime.date(2024, 6, 9), None), + (datetime.date(2024, 6, 10), "0800-1700"), + (datetime.date(2024, 6, 11), "0800-1700"), + (datetime.date(2024, 6, 12), "0800-1700"), + (datetime.date(2024, 6, 13), "0800-1700"), + (datetime.date(2024, 6, 14), "0800-1700"), + (datetime.date(2024, 6, 15), None), + (datetime.date(2024, 6, 16), None), + (datetime.date(2024, 6, 17), "0800-1700"), + (datetime.date(2024, 6, 18), "0800-1700"), + (datetime.date(2024, 6, 19), None), + (datetime.date(2024, 6, 20), "0800-1700"), + (datetime.date(2024, 6, 21), "0800-1700"), + (datetime.date(2024, 6, 22), None), + (datetime.date(2024, 6, 23), None), + (datetime.date(2024, 6, 24), "0800-1700"), + (datetime.date(2024, 6, 25), "0800-1700"), + (datetime.date(2024, 6, 26), "0800-1700"), + (datetime.date(2024, 6, 27), "0800-1700"), + (datetime.date(2024, 6, 28), "0800-1700"), + (datetime.date(2024, 6, 29), None), + (datetime.date(2024, 6, 30), None), + (datetime.date(2024, 7, 1), "0800-1700"), + (datetime.date(2024, 7, 2), "0800-1700"), + (datetime.date(2024, 7, 3), "0800-1300"), + (datetime.date(2024, 7, 4), None), + (datetime.date(2024, 7, 5), "0800-1700"), + (datetime.date(2024, 7, 6), None), + (datetime.date(2024, 7, 7), None), + (datetime.date(2024, 7, 8), "0800-1700"), + (datetime.date(2024, 7, 9), "0800-1700"), + (datetime.date(2024, 7, 10), "0800-1700"), + (datetime.date(2024, 7, 11), "0800-1700"), + (datetime.date(2024, 7, 12), "0800-1700"), + (datetime.date(2024, 7, 13), None), + (datetime.date(2024, 7, 14), None), + (datetime.date(2024, 7, 15), "0800-1700"), + (datetime.date(2024, 7, 16), "0800-1700"), + (datetime.date(2024, 7, 17), "0800-1700"), + (datetime.date(2024, 7, 18), "0800-1700"), + (datetime.date(2024, 7, 19), "0800-1700"), + (datetime.date(2024, 7, 20), None), + (datetime.date(2024, 7, 21), None), + (datetime.date(2024, 7, 22), "0800-1700"), + (datetime.date(2024, 7, 23), "0800-1700"), + (datetime.date(2024, 7, 24), "0800-1700"), + (datetime.date(2024, 7, 25), "0800-1700"), + (datetime.date(2024, 7, 26), "0800-1700"), + (datetime.date(2024, 7, 27), None), + (datetime.date(2024, 7, 28), None), + (datetime.date(2024, 7, 29), "0800-1700"), + (datetime.date(2024, 7, 30), "0800-1700"), + (datetime.date(2024, 7, 31), "0800-1700"), + (datetime.date(2024, 8, 1), "0800-1700"), + (datetime.date(2024, 8, 2), "0800-1700"), + (datetime.date(2024, 8, 3), None), + (datetime.date(2024, 8, 4), None), + (datetime.date(2024, 8, 5), "0800-1700"), + (datetime.date(2024, 8, 6), "0800-1700"), + (datetime.date(2024, 8, 7), "0800-1700"), + (datetime.date(2024, 8, 8), "0800-1700"), + (datetime.date(2024, 8, 9), "0800-1700"), + (datetime.date(2024, 8, 10), None), + (datetime.date(2024, 8, 11), None), + (datetime.date(2024, 8, 12), "0800-1700"), + (datetime.date(2024, 8, 13), "0800-1700"), + (datetime.date(2024, 8, 14), "0800-1700"), + (datetime.date(2024, 8, 15), "0800-1700"), + (datetime.date(2024, 8, 16), "0800-1700"), + (datetime.date(2024, 8, 17), None), + (datetime.date(2024, 8, 18), None), + (datetime.date(2024, 8, 19), "0800-1700"), + (datetime.date(2024, 8, 20), "0800-1700"), + (datetime.date(2024, 8, 21), "0800-1700"), + (datetime.date(2024, 8, 22), "0800-1700"), + (datetime.date(2024, 8, 23), "0800-1700"), + (datetime.date(2024, 8, 24), None), + (datetime.date(2024, 8, 25), None), + (datetime.date(2024, 8, 26), "0800-1700"), + (datetime.date(2024, 8, 27), "0800-1700"), + (datetime.date(2024, 8, 28), "0800-1700"), + (datetime.date(2024, 8, 29), "0800-1700"), + (datetime.date(2024, 8, 30), "0800-1700"), + (datetime.date(2024, 8, 31), None), + (datetime.date(2024, 9, 1), None), + (datetime.date(2024, 9, 2), None), + (datetime.date(2024, 9, 3), "0800-1700"), + (datetime.date(2024, 9, 4), "0800-1700"), + (datetime.date(2024, 9, 5), "0800-1700"), + (datetime.date(2024, 9, 6), "0800-1700"), + (datetime.date(2024, 9, 7), None), + (datetime.date(2024, 9, 8), None), + (datetime.date(2024, 9, 9), "0800-1700"), + (datetime.date(2024, 9, 10), "0800-1700"), + (datetime.date(2024, 9, 11), "0800-1700"), + (datetime.date(2024, 9, 12), "0800-1700"), + (datetime.date(2024, 9, 13), "0800-1700"), + (datetime.date(2024, 9, 14), None), + (datetime.date(2024, 9, 15), None), + (datetime.date(2024, 9, 16), "0800-1700"), + (datetime.date(2024, 9, 17), "0800-1700"), + (datetime.date(2024, 9, 18), "0800-1700"), + (datetime.date(2024, 9, 19), "0800-1700"), + (datetime.date(2024, 9, 20), "0800-1700"), + (datetime.date(2024, 9, 21), None), + (datetime.date(2024, 9, 22), None), + (datetime.date(2024, 9, 23), "0800-1700"), + (datetime.date(2024, 9, 24), "0800-1700"), + (datetime.date(2024, 9, 25), "0800-1700"), + (datetime.date(2024, 9, 26), "0800-1700"), + (datetime.date(2024, 9, 27), "0800-1700"), + (datetime.date(2024, 9, 28), None), + (datetime.date(2024, 9, 29), None), + (datetime.date(2024, 9, 30), "0800-1700"), + (datetime.date(2024, 10, 1), "0800-1700"), + (datetime.date(2024, 10, 2), "0800-1700"), + (datetime.date(2024, 10, 3), "0800-1700"), + (datetime.date(2024, 10, 4), "0800-1700"), + (datetime.date(2024, 10, 5), None), + (datetime.date(2024, 10, 6), None), + (datetime.date(2024, 10, 7), "0800-1700"), + (datetime.date(2024, 10, 8), "0800-1700"), + (datetime.date(2024, 10, 9), "0800-1700"), + (datetime.date(2024, 10, 10), "0800-1700"), + (datetime.date(2024, 10, 11), "0800-1700"), + (datetime.date(2024, 10, 12), None), + (datetime.date(2024, 10, 13), None), + (datetime.date(2024, 10, 14), "0800-1700"), + (datetime.date(2024, 10, 15), "0800-1700"), + (datetime.date(2024, 10, 16), "0800-1700"), + (datetime.date(2024, 10, 17), "0800-1700"), + (datetime.date(2024, 10, 18), "0800-1700"), + (datetime.date(2024, 10, 19), None), + (datetime.date(2024, 10, 20), None), + (datetime.date(2024, 10, 21), "0800-1700"), + (datetime.date(2024, 10, 22), "0800-1700"), + (datetime.date(2024, 10, 23), "0800-1700"), + (datetime.date(2024, 10, 24), "0800-1700"), + (datetime.date(2024, 10, 25), "0800-1700"), + (datetime.date(2024, 10, 26), None), + (datetime.date(2024, 10, 27), None), + (datetime.date(2024, 10, 28), "0800-1700"), + (datetime.date(2024, 10, 29), "0800-1700"), + (datetime.date(2024, 10, 30), "0800-1700"), + (datetime.date(2024, 10, 31), "0800-1700"), + (datetime.date(2024, 11, 1), "0800-1700"), + (datetime.date(2024, 11, 2), None), + (datetime.date(2024, 11, 3), None), + (datetime.date(2024, 11, 4), "0800-1700"), + (datetime.date(2024, 11, 5), "0800-1700"), + (datetime.date(2024, 11, 6), "0800-1700"), + (datetime.date(2024, 11, 7), "0800-1700"), + (datetime.date(2024, 11, 8), "0800-1700"), + (datetime.date(2024, 11, 9), None), + (datetime.date(2024, 11, 10), None), + (datetime.date(2024, 11, 11), "0800-1700"), + (datetime.date(2024, 11, 12), "0800-1700"), + (datetime.date(2024, 11, 13), "0800-1700"), + (datetime.date(2024, 11, 14), "0800-1700"), + (datetime.date(2024, 11, 15), "0800-1700"), + (datetime.date(2024, 11, 16), None), + (datetime.date(2024, 11, 17), None), + (datetime.date(2024, 11, 18), "0800-1700"), + (datetime.date(2024, 11, 19), "0800-1700"), + (datetime.date(2024, 11, 20), "0800-1700"), + (datetime.date(2024, 11, 21), "0800-1700"), + (datetime.date(2024, 11, 22), "0800-1700"), + (datetime.date(2024, 11, 23), None), + (datetime.date(2024, 11, 24), None), + (datetime.date(2024, 11, 25), "0800-1700"), + (datetime.date(2024, 11, 26), "0800-1700"), + (datetime.date(2024, 11, 27), "0800-1700"), + (datetime.date(2024, 11, 28), None), + (datetime.date(2024, 11, 29), "0800-1300"), + (datetime.date(2024, 11, 30), None), + (datetime.date(2024, 12, 1), None), + (datetime.date(2024, 12, 2), "0800-1700"), + (datetime.date(2024, 12, 3), "0800-1700"), + (datetime.date(2024, 12, 4), "0800-1700"), + (datetime.date(2024, 12, 5), "0800-1700"), + (datetime.date(2024, 12, 6), "0800-1700"), + (datetime.date(2024, 12, 7), None), + (datetime.date(2024, 12, 8), None), + (datetime.date(2024, 12, 9), "0800-1700"), + (datetime.date(2024, 12, 10), "0800-1700"), + (datetime.date(2024, 12, 11), "0800-1700"), + (datetime.date(2024, 12, 12), "0800-1700"), + (datetime.date(2024, 12, 13), "0800-1700"), + (datetime.date(2024, 12, 14), None), + (datetime.date(2024, 12, 15), None), + (datetime.date(2024, 12, 16), "0800-1700"), + (datetime.date(2024, 12, 17), "0800-1700"), + (datetime.date(2024, 12, 18), "0800-1700"), + (datetime.date(2024, 12, 19), "0800-1700"), + (datetime.date(2024, 12, 20), "0800-1700"), + (datetime.date(2024, 12, 21), None), + (datetime.date(2024, 12, 22), None), + (datetime.date(2024, 12, 23), "0800-1700"), + (datetime.date(2024, 12, 24), "0800-1300"), + (datetime.date(2024, 12, 25), None), + (datetime.date(2024, 12, 26), "0800-1700"), + (datetime.date(2024, 12, 27), "0800-1700"), + (datetime.date(2024, 12, 28), None), + (datetime.date(2024, 12, 29), None), + (datetime.date(2024, 12, 30), "0800-1700"), + (datetime.date(2024, 12, 31), "0800-1700"), +] diff --git a/setup.py b/setup.py index 51e0a81..bea9a0a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='pythclient', - version='0.1.19', + version='0.1.20', packages=['pythclient'], author='Pyth Developers', author_email='contact@pyth.network', diff --git a/tests/test_calendar.py b/tests/test_calendar.py index e149975..802548e 100644 --- a/tests/test_calendar.py +++ b/tests/test_calendar.py @@ -3,6 +3,7 @@ from pythclient.calendar import (get_next_market_close, get_next_market_open, is_market_open) +from pythclient.calendar_full_intervals import EQUITY_2024_INTERVALS, FX_METAL_2024_INTERVALS, RATES_2024_INTERVALS NY_TZ = ZoneInfo("America/New_York") UTC_TZ = ZoneInfo("UTC") @@ -46,6 +47,7 @@ def format_datetime_to_unix_timestamp(dt: datetime.datetime): unix_timestamp_utc = int(timestamp) return unix_timestamp_utc + def test_is_market_open(): # equity # weekday, within equity market hours @@ -378,3 +380,42 @@ def test_get_next_market_close(): assert get_next_market_close("crypto", CRYPTO_OPEN_WED_2023_6_21_12) == None assert get_next_market_close("crypto", CRYPTO_OPEN_SUN_2023_6_18_12) == None + +def test_is_market_open_full(): + start_date = datetime.datetime(2024, 1, 1, tzinfo=NY_TZ) + end_date = datetime.datetime(2025, 1, 1, tzinfo=NY_TZ) + asset_types = ["equity", "fx", "metal", "rates", "crypto"] + + # Define the intervals + intervals = { + "equity": {date: interval for date, interval in EQUITY_2024_INTERVALS}, + "fx": {date: interval for date, interval in FX_METAL_2024_INTERVALS}, + "metal": {date: interval for date, interval in FX_METAL_2024_INTERVALS}, + "rates": {date: interval for date, interval in RATES_2024_INTERVALS} + } + + current_date = start_date + while current_date < end_date: + for at in asset_types: + if at == "crypto": + continue + # Get the interval for the date + interval = intervals[at].get(current_date.date()) + + if interval is None: + should_be_open = False + else: + start_time, end_time = [datetime.datetime.strptime(t, "%H%M").time() for t in interval.split('-')] + if start_time < end_time: + should_be_open = start_time <= current_date.time() < end_time + else: # Over midnight + should_be_open = start_time <= current_date.time() + + # Check if the market is open + is_open = is_market_open(at, current_date) + + # Assert that the market is open if and only if it should be open + assert is_open == should_be_open, f"Failed for asset type: {at}, date: {current_date}" + + # Add one minute to the current date + current_date += datetime.timedelta(minutes=1)