Skip to content

Commit 23fedd2

Browse files
authoredJun 27, 2023
refactor (#34)
* refactor * fix pytest failing * bump
1 parent 17005ee commit 23fedd2

File tree

2 files changed

+92
-250
lines changed

2 files changed

+92
-250
lines changed
 

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name='pythclient',
10-
version='0.1.7',
10+
version='0.1.8',
1111
packages=['pythclient'],
1212
author='Pyth Developers',
1313
author_email='contact@pyth.network',

‎tests/test_calendar.py

Lines changed: 91 additions & 249 deletions
Original file line numberDiff line numberDiff line change
@@ -1,361 +1,203 @@
11
import datetime
22
from zoneinfo import ZoneInfo
33

4-
import pytest
5-
6-
from pythclient.calendar import (
7-
get_next_market_close,
8-
get_next_market_open,
9-
is_market_open,
10-
)
4+
from pythclient.calendar import (get_next_market_close, get_next_market_open,
5+
is_market_open)
116

127
NY_TZ = ZoneInfo("America/New_York")
138
UTC_TZ = ZoneInfo("UTC")
149

10+
# Define constants for equity market
11+
EQUITY_OPEN_WED_2023_6_21_12 = datetime.datetime(2023, 6, 21, 12, 0, 0, tzinfo=NY_TZ)
12+
EQUITY_CLOSE_WED_2023_6_21_17 = datetime.datetime(2023, 6, 21, 17, 0, 0, tzinfo=NY_TZ)
13+
EQUITY_CLOSE_SAT_2023_6_10_17 = datetime.datetime(2023, 6, 10, 17, 0, 0, tzinfo=NY_TZ)
14+
EQUITY_HOLIDAY_MON_2023_6_19 = datetime.datetime(2023, 6, 19, tzinfo=NY_TZ)
15+
EQUITY_EARLY_CLOSE_OPEN_FRI_2023_11_24_14 = datetime.datetime(2023, 11, 24, 11, 0, 0, tzinfo=NY_TZ)
16+
EQUITY_EARLY_CLOSE_CLOSE_FRI_2023_11_24_14 = datetime.datetime(2023, 11, 24, 14, 0, 0, tzinfo=NY_TZ)
1517

16-
@pytest.fixture
17-
def equity_open_weekday_datetime():
18-
# A weekday, within equity market hours
19-
return datetime.datetime(2023, 6, 21, 12, 0, 0, tzinfo=NY_TZ)
20-
21-
22-
@pytest.fixture
23-
def equity_close_weekday_datetime():
24-
# A weekday, out of equity market hours
25-
return datetime.datetime(2023, 6, 21, 17, 0, 0, tzinfo=NY_TZ)
26-
27-
28-
@pytest.fixture
29-
def equity_close_weekend_datetime():
30-
# A weekend, out of equity market hours
31-
return datetime.datetime(2023, 6, 10, 17, 0, 0, tzinfo=NY_TZ)
32-
33-
34-
@pytest.fixture
35-
def equity_holiday_datetime():
36-
# A weekday, NYSE holiday
37-
return datetime.datetime(2023, 6, 19, tzinfo=NY_TZ)
38-
39-
40-
@pytest.fixture
41-
def equity_early_holiday_open_datetime():
42-
# A weekday, NYSE early close holiday
43-
return datetime.datetime(2023, 11, 24, 11, 0, 0, tzinfo=NY_TZ)
44-
45-
46-
@pytest.fixture
47-
def equity_early_holiday_close_datetime():
48-
# A weekday, NYSE early close holiday
49-
return datetime.datetime(2023, 11, 24, 14, 0, 0, tzinfo=NY_TZ)
50-
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)
20+
FX_METAL_CLOSE_SUN_2023_6_18_16 = datetime.datetime(2023, 6, 18, 16, 0, 0, tzinfo=NY_TZ)
21+
FX_METAL_HOLIDAY_SUN_2023_1_1 = datetime.datetime(2023, 1, 1, tzinfo=NY_TZ)
5122

52-
@pytest.fixture
53-
def fx_metal_open_weekday_datetime():
54-
# A weekday, within fx & metal market hours
55-
return datetime.datetime(2023, 6, 21, 22, 0, 0, tzinfo=NY_TZ)
23+
# Define constants for cryptocurrency market
24+
CRYPTO_OPEN_WED_2023_6_21_12 = datetime.datetime(2023, 6, 21, 12, 0, 0, tzinfo=NY_TZ)
25+
CRYPTO_OPEN_SUN_2023_6_18_12 = datetime.datetime(2023, 6, 18, 12, 0, 0, tzinfo=NY_TZ)
5626

27+
def format_datetime_to_utc_iso_string(dt: datetime.datetime):
28+
return dt.astimezone(UTC_TZ).strftime("%Y-%m-%dT%H:%M:%S") + "Z"
5729

58-
@pytest.fixture
59-
def fx_metal_close_weekend_datetime():
60-
# A weekend, out of fx & metal market hours
61-
return datetime.datetime(2023, 6, 18, 16, 0, 0, tzinfo=NY_TZ)
62-
63-
64-
@pytest.fixture
65-
def fx_metal_holiday_datetime():
66-
# CBOE holiday
67-
return datetime.datetime(2023, 1, 1, tzinfo=NY_TZ)
68-
69-
70-
@pytest.fixture
71-
def crypto_open_weekday_datetime():
72-
return datetime.datetime(2023, 6, 21, 12, 0, 0, tzinfo=NY_TZ)
73-
74-
75-
@pytest.fixture
76-
def crypto_open_weekend_datetime():
77-
return datetime.datetime(2023, 6, 18, 12, 0, 0, tzinfo=NY_TZ)
78-
79-
80-
def test_is_market_open(
81-
equity_open_weekday_datetime,
82-
equity_close_weekday_datetime,
83-
equity_close_weekend_datetime,
84-
equity_holiday_datetime,
85-
equity_early_holiday_open_datetime,
86-
equity_early_holiday_close_datetime,
87-
fx_metal_open_weekday_datetime,
88-
fx_metal_close_weekend_datetime,
89-
fx_metal_holiday_datetime,
90-
crypto_open_weekday_datetime,
91-
crypto_open_weekend_datetime,
92-
):
30+
def test_is_market_open():
9331
# equity
9432
# weekday, within equity market hours
95-
assert is_market_open("equity", equity_open_weekday_datetime) == True
33+
assert is_market_open("equity", EQUITY_OPEN_WED_2023_6_21_12) == True
9634

9735
# weekday, out of equity market hours
98-
assert is_market_open("equity", equity_close_weekday_datetime) == False
36+
assert is_market_open("equity", EQUITY_CLOSE_WED_2023_6_21_17) == False
9937

10038
# weekend, out of equity market hours
101-
assert is_market_open("equity", equity_close_weekend_datetime) == False
39+
assert is_market_open("equity", EQUITY_CLOSE_SAT_2023_6_10_17) == False
10240

10341
# weekday, NYSE holiday
104-
assert is_market_open("equity", equity_holiday_datetime) == False
42+
assert is_market_open("equity", EQUITY_HOLIDAY_MON_2023_6_19) == False
10543

10644
# weekday, NYSE early close holiday
107-
assert is_market_open("equity", equity_early_holiday_open_datetime) == True
108-
assert is_market_open("equity", equity_early_holiday_close_datetime) == False
45+
assert is_market_open("equity", EQUITY_EARLY_CLOSE_OPEN_FRI_2023_11_24_14) == True
46+
assert is_market_open("equity", EQUITY_EARLY_CLOSE_CLOSE_FRI_2023_11_24_14) == False
10947

11048
# fx & metal
11149
# weekday, within fx & metal market hours
112-
assert is_market_open("fx", fx_metal_open_weekday_datetime) == True
113-
assert is_market_open("metal", fx_metal_open_weekday_datetime) == True
50+
assert is_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_22) == True
51+
assert is_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_22) == True
11452

11553
# weekday, out of fx & metal market hours
116-
assert is_market_open("fx", fx_metal_close_weekend_datetime) == False
117-
assert is_market_open("metal", fx_metal_close_weekend_datetime) == False
54+
assert is_market_open("fx", FX_METAL_CLOSE_SUN_2023_6_18_16) == False
55+
assert is_market_open("metal", FX_METAL_CLOSE_SUN_2023_6_18_16) == False
11856

11957
# fx & metal holiday
120-
assert is_market_open("fx", fx_metal_holiday_datetime) == False
121-
assert is_market_open("metal", fx_metal_holiday_datetime) == False
58+
assert is_market_open("fx", FX_METAL_HOLIDAY_SUN_2023_1_1) == False
59+
assert is_market_open("metal", FX_METAL_HOLIDAY_SUN_2023_1_1) == False
12260

12361
# crypto
124-
assert is_market_open("crypto", crypto_open_weekday_datetime) == True
125-
assert is_market_open("crypto", crypto_open_weekend_datetime) == True
126-
127-
128-
def test_get_next_market_open(
129-
equity_open_weekday_datetime,
130-
equity_close_weekday_datetime,
131-
equity_close_weekend_datetime,
132-
equity_holiday_datetime,
133-
equity_early_holiday_open_datetime,
134-
equity_early_holiday_close_datetime,
135-
fx_metal_open_weekday_datetime,
136-
fx_metal_close_weekend_datetime,
137-
fx_metal_holiday_datetime,
138-
crypto_open_weekday_datetime,
139-
crypto_open_weekend_datetime,
140-
):
62+
assert is_market_open("crypto", CRYPTO_OPEN_WED_2023_6_21_12) == True
63+
assert is_market_open("crypto", CRYPTO_OPEN_SUN_2023_6_18_12) == True
64+
65+
66+
def test_get_next_market_open():
14167
# equity within market hours
14268
assert (
143-
get_next_market_open("equity", equity_open_weekday_datetime)
144-
== datetime.datetime(2023, 6, 22, 9, 30, 0, tzinfo=NY_TZ)
145-
.astimezone(UTC_TZ)
146-
.strftime("%Y-%m-%dT%H:%M:%S")
147-
+ "Z"
69+
get_next_market_open("equity", EQUITY_OPEN_WED_2023_6_21_12)
70+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 22, 9, 30, 0, tzinfo=NY_TZ))
14871
)
14972

15073
# equity out of market hours
15174
assert (
152-
get_next_market_open("equity", equity_close_weekday_datetime)
153-
== datetime.datetime(2023, 6, 22, 9, 30, 0, tzinfo=NY_TZ)
154-
.astimezone(UTC_TZ)
155-
.strftime("%Y-%m-%dT%H:%M:%S")
156-
+ "Z"
75+
get_next_market_open("equity", EQUITY_CLOSE_WED_2023_6_21_17)
76+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 22, 9, 30, 0, tzinfo=NY_TZ))
15777
)
15878

15979
# equity weekend
16080
assert (
161-
get_next_market_open("equity", equity_close_weekend_datetime)
162-
== datetime.datetime(2023, 6, 12, 9, 30, 0, tzinfo=NY_TZ)
163-
.astimezone(UTC_TZ)
164-
.strftime("%Y-%m-%dT%H:%M:%S")
165-
+ "Z"
81+
get_next_market_open("equity", EQUITY_CLOSE_SAT_2023_6_10_17)
82+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 12, 9, 30, 0, tzinfo=NY_TZ))
16683
)
16784

16885
# equity holiday
16986
assert (
170-
get_next_market_open("equity", equity_holiday_datetime)
171-
== datetime.datetime(2023, 6, 20, 9, 30, 0, tzinfo=NY_TZ)
172-
.astimezone(UTC_TZ)
173-
.strftime("%Y-%m-%dT%H:%M:%S")
174-
+ "Z"
87+
get_next_market_open("equity", EQUITY_HOLIDAY_MON_2023_6_19)
88+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 20, 9, 30, 0, tzinfo=NY_TZ))
17589
)
17690

17791
# equity early close holiday
17892
assert (
179-
get_next_market_open("equity", equity_early_holiday_open_datetime)
180-
== datetime.datetime(2023, 11, 27, 9, 30, 0, tzinfo=NY_TZ)
181-
.astimezone(UTC_TZ)
182-
.strftime("%Y-%m-%dT%H:%M:%S")
183-
+ "Z"
93+
get_next_market_open("equity", EQUITY_EARLY_CLOSE_OPEN_FRI_2023_11_24_14)
94+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 11, 27, 9, 30, 0, tzinfo=NY_TZ))
18495
)
18596
assert (
186-
get_next_market_open("equity", equity_early_holiday_close_datetime)
187-
== datetime.datetime(2023, 11, 27, 9, 30, 0, tzinfo=NY_TZ)
188-
.astimezone(UTC_TZ)
189-
.strftime("%Y-%m-%dT%H:%M:%S")
190-
+ "Z"
97+
get_next_market_open("equity", EQUITY_EARLY_CLOSE_CLOSE_FRI_2023_11_24_14)
98+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 11, 27, 9, 30, 0, tzinfo=NY_TZ))
19199
)
192100

193101
# fx & metal within market hours
194102
assert (
195-
get_next_market_open("fx", fx_metal_open_weekday_datetime)
196-
== datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ)
197-
.astimezone(UTC_TZ)
198-
.strftime("%Y-%m-%dT%H:%M:%S")
199-
+ "Z"
103+
get_next_market_open("fx", FX_METAL_OPEN_WED_2023_6_21_22)
104+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ))
200105
)
201106
assert (
202-
get_next_market_open("metal", fx_metal_open_weekday_datetime)
203-
== datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ)
204-
.astimezone(UTC_TZ)
205-
.strftime("%Y-%m-%dT%H:%M:%S")
206-
+ "Z"
107+
get_next_market_open("metal", FX_METAL_OPEN_WED_2023_6_21_22)
108+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 25, 17, 0, 0, tzinfo=NY_TZ))
207109
)
208110

209111
# fx & metal out of market hours
210112
assert (
211-
get_next_market_open("fx", fx_metal_close_weekend_datetime)
212-
== datetime.datetime(2023, 6, 18, 17, 0, 0, tzinfo=NY_TZ)
213-
.astimezone(UTC_TZ)
214-
.strftime("%Y-%m-%dT%H:%M:%S")
215-
+ "Z"
113+
get_next_market_open("fx", FX_METAL_CLOSE_SUN_2023_6_18_16)
114+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 18, 17, 0, 0, tzinfo=NY_TZ))
216115
)
217116
assert (
218-
get_next_market_open("metal", fx_metal_close_weekend_datetime)
219-
== datetime.datetime(2023, 6, 18, 17, 0, 0, tzinfo=NY_TZ)
220-
.astimezone(UTC_TZ)
221-
.strftime("%Y-%m-%dT%H:%M:%S")
222-
+ "Z"
117+
get_next_market_open("metal", FX_METAL_CLOSE_SUN_2023_6_18_16)
118+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 18, 17, 0, 0, tzinfo=NY_TZ))
223119
)
224120

225121
# fx & metal holiday
226122
assert (
227-
get_next_market_open("fx", fx_metal_holiday_datetime)
228-
== datetime.datetime(2023, 1, 2, 17, 0, 0, tzinfo=NY_TZ)
229-
.astimezone(UTC_TZ)
230-
.strftime("%Y-%m-%dT%H:%M:%S")
231-
+ "Z"
123+
get_next_market_open("fx", FX_METAL_HOLIDAY_SUN_2023_1_1)
124+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 1, 2, 17, 0, 0, tzinfo=NY_TZ))
232125
)
233126
assert (
234-
get_next_market_open("metal", fx_metal_holiday_datetime)
235-
== datetime.datetime(2023, 1, 2, 17, 0, 0, tzinfo=NY_TZ)
236-
.astimezone(UTC_TZ)
237-
.strftime("%Y-%m-%dT%H:%M:%S")
238-
+ "Z"
127+
get_next_market_open("metal", FX_METAL_HOLIDAY_SUN_2023_1_1)
128+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 1, 2, 17, 0, 0, tzinfo=NY_TZ))
239129
)
240130

241131
# crypto
242-
assert get_next_market_open("crypto", crypto_open_weekday_datetime) == None
243-
assert get_next_market_open("crypto", crypto_open_weekend_datetime) == None
244-
245-
246-
def test_get_next_market_close(
247-
equity_open_weekday_datetime,
248-
equity_close_weekday_datetime,
249-
equity_close_weekend_datetime,
250-
equity_holiday_datetime,
251-
equity_early_holiday_open_datetime,
252-
equity_early_holiday_close_datetime,
253-
fx_metal_open_weekday_datetime,
254-
fx_metal_close_weekend_datetime,
255-
fx_metal_holiday_datetime,
256-
crypto_open_weekday_datetime,
257-
crypto_open_weekend_datetime,
258-
):
132+
assert get_next_market_open("crypto", CRYPTO_OPEN_WED_2023_6_21_12) == None
133+
assert get_next_market_open("crypto", CRYPTO_OPEN_SUN_2023_6_18_12) == None
134+
135+
136+
def test_get_next_market_close():
259137
# equity within market hours
260138
assert (
261-
get_next_market_close("equity", equity_open_weekday_datetime)
262-
== datetime.datetime(2023, 6, 21, 16, 0, 0, tzinfo=NY_TZ)
263-
.astimezone(UTC_TZ)
264-
.strftime("%Y-%m-%dT%H:%M:%S")
265-
+ "Z"
139+
get_next_market_close("equity", EQUITY_OPEN_WED_2023_6_21_12)
140+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 21, 16, 0, 0, tzinfo=NY_TZ))
266141
)
267142

268143
# equity out of market hours
269144
assert (
270-
get_next_market_close("equity", equity_close_weekday_datetime)
271-
== datetime.datetime(2023, 6, 22, 16, 0, 0, tzinfo=NY_TZ)
272-
.astimezone(UTC_TZ)
273-
.strftime("%Y-%m-%dT%H:%M:%S")
274-
+ "Z"
145+
get_next_market_close("equity", EQUITY_CLOSE_WED_2023_6_21_17)
146+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 22, 16, 0, 0, tzinfo=NY_TZ))
275147
)
276148

277149
# equity weekend
278150
assert (
279-
get_next_market_close("equity", equity_close_weekend_datetime)
280-
== datetime.datetime(2023, 6, 12, 16, 0, 0, tzinfo=NY_TZ)
281-
.astimezone(UTC_TZ)
282-
.strftime("%Y-%m-%dT%H:%M:%S")
283-
+ "Z"
151+
get_next_market_close("equity", EQUITY_CLOSE_SAT_2023_6_10_17)
152+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 12, 16, 0, 0, tzinfo=NY_TZ))
284153
)
285154

286155
# equity holiday
287156
assert (
288-
get_next_market_close("equity", equity_holiday_datetime)
289-
== datetime.datetime(2023, 6, 20, 16, 0, 0, tzinfo=NY_TZ)
290-
.astimezone(UTC_TZ)
291-
.strftime("%Y-%m-%dT%H:%M:%S")
292-
+ "Z"
157+
get_next_market_close("equity", EQUITY_HOLIDAY_MON_2023_6_19)
158+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 20, 16, 0, 0, tzinfo=NY_TZ))
293159
)
294160

295161
# equity early close holiday
296162
assert (
297-
get_next_market_close("equity", equity_early_holiday_open_datetime)
298-
== datetime.datetime(2023, 11, 24, 13, 0, 0, tzinfo=NY_TZ)
299-
.astimezone(UTC_TZ)
300-
.strftime("%Y-%m-%dT%H:%M:%S")
301-
+ "Z"
163+
get_next_market_close("equity", EQUITY_EARLY_CLOSE_OPEN_FRI_2023_11_24_14)
164+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 11, 24, 13, 0, 0, tzinfo=NY_TZ))
302165
)
303166
assert (
304-
get_next_market_close("equity", equity_early_holiday_close_datetime)
305-
== datetime.datetime(2023, 11, 27, 16, 0, 0, tzinfo=NY_TZ)
306-
.astimezone(UTC_TZ)
307-
.strftime("%Y-%m-%dT%H:%M:%S")
308-
+ "Z"
167+
get_next_market_close("equity", EQUITY_EARLY_CLOSE_CLOSE_FRI_2023_11_24_14)
168+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 11, 27, 16, 0, 0, tzinfo=NY_TZ))
309169
)
310170

311171
# fx & metal within market hours
312172
assert (
313-
get_next_market_close("fx", fx_metal_open_weekday_datetime)
314-
== datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)
315-
.astimezone(UTC_TZ)
316-
.strftime("%Y-%m-%dT%H:%M:%S")
317-
+ "Z"
173+
get_next_market_close("fx", FX_METAL_OPEN_WED_2023_6_21_22)
174+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ))
318175
)
319176
assert (
320-
get_next_market_close("metal", fx_metal_open_weekday_datetime)
321-
== datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)
322-
.astimezone(UTC_TZ)
323-
.strftime("%Y-%m-%dT%H:%M:%S")
324-
+ "Z"
177+
get_next_market_close("metal", FX_METAL_OPEN_WED_2023_6_21_22)
178+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ))
325179
)
326180

327181
# fx & metal out of market hours
328182
assert (
329-
get_next_market_close("fx", fx_metal_close_weekend_datetime)
330-
== datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)
331-
.astimezone(UTC_TZ)
332-
.strftime("%Y-%m-%dT%H:%M:%S")
333-
+ "Z"
183+
get_next_market_close("fx", FX_METAL_CLOSE_SUN_2023_6_18_16)
184+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ))
334185
)
335186
assert (
336-
get_next_market_close("metal", fx_metal_close_weekend_datetime)
337-
== datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ)
338-
.astimezone(UTC_TZ)
339-
.strftime("%Y-%m-%dT%H:%M:%S")
340-
+ "Z"
187+
get_next_market_close("metal", FX_METAL_CLOSE_SUN_2023_6_18_16)
188+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 6, 23, 17, 0, 0, tzinfo=NY_TZ))
341189
)
342190

343191
# fx & metal holiday
344192
assert (
345-
get_next_market_close("fx", fx_metal_holiday_datetime)
346-
== datetime.datetime(2023, 1, 6, 17, 0, 0, tzinfo=NY_TZ)
347-
.astimezone(UTC_TZ)
348-
.strftime("%Y-%m-%dT%H:%M:%S")
349-
+ "Z"
193+
get_next_market_close("fx", FX_METAL_HOLIDAY_SUN_2023_1_1)
194+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 1, 6, 17, 0, 0, tzinfo=NY_TZ))
350195
)
351196
assert (
352-
get_next_market_close("metal", fx_metal_holiday_datetime)
353-
== datetime.datetime(2023, 1, 6, 17, 0, 0, tzinfo=NY_TZ)
354-
.astimezone(UTC_TZ)
355-
.strftime("%Y-%m-%dT%H:%M:%S")
356-
+ "Z"
197+
get_next_market_close("metal", FX_METAL_HOLIDAY_SUN_2023_1_1)
198+
== format_datetime_to_utc_iso_string(datetime.datetime(2023, 1, 6, 17, 0, 0, tzinfo=NY_TZ))
357199
)
358200

359201
# crypto
360-
assert get_next_market_close("crypto", crypto_open_weekday_datetime) == None
361-
assert get_next_market_close("crypto", crypto_open_weekend_datetime) == None
202+
assert get_next_market_close("crypto", CRYPTO_OPEN_WED_2023_6_21_12) == None
203+
assert get_next_market_close("crypto", CRYPTO_OPEN_SUN_2023_6_18_12) == None

0 commit comments

Comments
 (0)
Please sign in to comment.