Label night-session products and hide day-only symbols at night.

Mark tradable varieties with a night tag; during 21:00-02:30 filter out index futures and other products without night sessions from symbol picker and recommend list.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 22:27:47 +08:00
parent f2940d41e9
commit 7f8b4cfefd
11 changed files with 193 additions and 13 deletions
+13
View File
@@ -45,6 +45,19 @@ def is_trading_session(now: Optional[datetime] = None) -> bool:
return False
def is_night_trading_session(now: Optional[datetime] = None) -> bool:
"""当前是否处于夜盘时段(21:00–02:30,且整体仍在交易时段内)。"""
if not is_trading_session(now):
return False
d = now or datetime.now(TZ)
if d.tzinfo is None:
d = d.replace(tzinfo=TZ)
else:
d = d.astimezone(TZ)
t = d.hour * 60 + d.minute
return t >= 21 * 60 or t < 2 * 60 + 30
def _session_open_allowed(day: datetime, hour: int, minute: int) -> bool:
wd = day.weekday()
if (hour, minute) == (9, 0) or (hour, minute) == (13, 30):