|
16 | 16 | EQUITY_EARLY_CLOSE_CLOSE_FRI_2023_11_24_14 = datetime.datetime(2023, 11, 24, 14, 0, 0, tzinfo=NY_TZ) |
17 | 17 |
|
18 | 18 | # Define constants for fx & metal market |
19 | | -FX_METAL_OPEN_WED_2023_6_21_22 = datetime.datetime(2023, 6, 21, 22, 0, 0, tzinfo=NY_TZ) |
| 19 | +FX_METAL_OPEN_WED_2023_6_21_21 = datetime.datetime(2023, 6, 21, 21, 0, 0, tzinfo=NY_TZ) |
| 20 | +FX_METAL_OPEN_WED_2023_6_21_23 = datetime.datetime(2023, 6, 21, 23, 0, 0, tzinfo=NY_TZ) |
20 | 21 | FX_METAL_CLOSE_SUN_2023_6_18_16 = datetime.datetime(2023, 6, 18, 16, 0, 0, tzinfo=NY_TZ) |
21 | 22 | FX_METAL_HOLIDAY_SUN_2023_1_1 = datetime.datetime(2023, 1, 1, tzinfo=NY_TZ) |
22 | 23 |
|
@@ -51,8 +52,8 @@ def test_is_market_open(): |
51 | 52 |
|
52 | 53 | # fx & metal |
53 | 54 | # weekday, within fx & metal market hours |
54 | | - assert is_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_22) == True |
55 | | - assert is_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_22) == True |
| 55 | + assert is_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_21) == True |
| 56 | + assert is_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_21) == True |
56 | 57 |
|
57 | 58 | # weekday, out of fx & metal market hours |
58 | 59 | assert is_market_open("fx", FX_METAL_CLOSE_SUN_2023_6_18_16) == False |
@@ -102,13 +103,22 @@ def test_get_next_market_open(): |
102 | 103 | == format_datetime_to_unix_timestamp(datetime.datetime(2023, 11, 27, 9, 30, 0, tzinfo=NY_TZ)) |
103 | 104 | ) |
104 | 105 |
|
105 | | - # fx & metal within market hours |
| 106 | + # fx & metal within market hours (before 10pm UTC) |
106 | 107 | assert ( |
107 | | - get_next_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_22) |
| 108 | + get_next_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_21) |
108 | 109 | == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ)) |
109 | 110 | ) |
110 | 111 | assert ( |
111 | | - get_next_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_22) |
| 112 | + get_next_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_21) |
| 113 | + == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ)) |
| 114 | + ) |
| 115 | + # fx & metal within market hours (after 10pm UTC) |
| 116 | + assert ( |
| 117 | + get_next_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_23) |
| 118 | + == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ)) |
| 119 | + ) |
| 120 | + assert ( |
| 121 | + get_next_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_23) |
112 | 122 | == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ)) |
113 | 123 | ) |
114 | 124 |
|
@@ -172,13 +182,23 @@ def test_get_next_market_close(): |
172 | 182 | == format_datetime_to_unix_timestamp(datetime.datetime(2023, 11, 27, 16, 0, 0, tzinfo=NY_TZ)) |
173 | 183 | ) |
174 | 184 |
|
175 | | - # fx & metal within market hours |
| 185 | + # fx & metal within market hours (before 10pm UTC) |
| 186 | + assert ( |
| 187 | + get_next_market_close("fx", FX_METAL_OPEN_WED_2023_6_21_21) |
| 188 | + == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)) |
| 189 | + ) |
| 190 | + assert ( |
| 191 | + get_next_market_close("metal", FX_METAL_OPEN_WED_2023_6_21_21) |
| 192 | + == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)) |
| 193 | + ) |
| 194 | + |
| 195 | + # fx & metal within market hours (after 10pm UTC) |
176 | 196 | assert ( |
177 | | - get_next_market_close("fx", FX_METAL_OPEN_WED_2023_6_21_22) |
| 197 | + get_next_market_close("fx", FX_METAL_OPEN_WED_2023_6_21_23) |
178 | 198 | == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)) |
179 | 199 | ) |
180 | 200 | assert ( |
181 | | - get_next_market_close("metal", FX_METAL_OPEN_WED_2023_6_21_22) |
| 201 | + get_next_market_close("metal", FX_METAL_OPEN_WED_2023_6_21_23) |
182 | 202 | == format_datetime_to_unix_timestamp(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)) |
183 | 203 | ) |
184 | 204 |
|
|
0 commit comments