Skip to content

Commit 63e5446

Browse files
authored
fix(backend): fix timezone change error (#241)
<!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes # <!-- Issue # here --> ## 📑 Description <!-- Add a brief description of the pr --> <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ## ✅ Checks <!-- Make sure your pr passes the CI checks and do check the following fields as needed - --> - [ ] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [ ] All the tests have passed - [ ] Branch name follows `type/descript` (e.g. `feature/add-llm-agents`) - [ ] Ready for code review ## ℹ Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behavior, etc. -->
1 parent 2690462 commit 63e5446

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

backend/app/config.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import sys
3-
from datetime import datetime, time
3+
from datetime import datetime
44
from enum import Enum
55
from typing import List, Tuple
66

@@ -122,26 +122,7 @@ def is_trading_day() -> bool:
122122

123123

124124
def should_run_trading_cycle() -> bool:
125-
if not is_trading_day():
126-
return False
127-
128-
utc_now = datetime.now(pytz.UTC)
129-
current_utc_time = utc_now.time()
130-
131-
est_now = utc_now.astimezone(pytz.timezone("US/Eastern"))
132-
133-
from datetime import timedelta
134-
135-
is_dst = est_now.dst() != timedelta(0)
136-
137-
if is_dst:
138-
run_window_start = time(18, 55) # UTC 18:55 (美东 2:55 PM EDT)
139-
run_window_end = time(20, 5) # UTC 20:05 (美东 4:05 PM EDT)
140-
else:
141-
run_window_start = time(19, 55) # UTC 19:55 (美东 2:55 PM EST)
142-
run_window_end = time(21, 5) # UTC 21:05 (美东 4:05 PM EST)
143-
144-
return run_window_start <= current_utc_time <= run_window_end
125+
return is_trading_day()
145126

146127

147128
def is_market_hours() -> bool:

0 commit comments

Comments
 (0)