fix(HEL-207): 收盘后改走日线,禁止误调 rt_k,回退旧快照记失败

将实时窗口与调度窗口统一到 15:05;盘后优先日线并补关闭盘后同步;沿用旧快照时 sync/job 记 failed。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-08-28 08:00:08 +00:00
co-authored by Cursor multica-agent
parent 8a5e78f022
commit cf206c7de9
4 changed files with 270 additions and 15 deletions
+3 -13
View File
@@ -26,18 +26,8 @@ class DashboardMixin:
)
daily = self._load_daily(trade_date)
if (
not daily
and requested_date == datetime.now().astimezone().strftime("%Y%m%d")
and trade_date == requested_date
and datetime.now().astimezone().time().replace(tzinfo=None) >= dt_time(9, 15)
):
return self._realtime_dashboard(
requested_date,
trade_date,
previous_trade_date,
)
if not daily:
# 15:05 后只走日线;日线未就绪时不得回退调用无权限的 rt_k。
raise TushareError(f"No daily data returned for {trade_date}")
notices: list[str] = []
@@ -96,13 +86,13 @@ class DashboardMixin:
@staticmethod
def should_use_realtime(requested_date: str, trade_date: str) -> bool:
"""Use rt_k for today's open market until end-of-day datasets settle."""
"""Use rt_k only inside the intraday window; 15:05+ must use daily bars."""
now = datetime.now().astimezone()
today = now.strftime("%Y%m%d")
return (
requested_date == today
and trade_date == today
and dt_time(9, 15) <= now.time().replace(tzinfo=None) < dt_time(16, 30)
and dt_time(9, 15) <= now.time().replace(tzinfo=None) < dt_time(15, 5)
)
def _realtime_dashboard(