fix(HEL-356): use completed history for intraday metrics

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总管
2026-09-09 11:29:52 +08:00
co-authored by multica-agent
parent 16843bdc7e
commit cb45d742da
4 changed files with 32 additions and 8 deletions
+4 -1
View File
@@ -217,11 +217,14 @@ class HeavenMarketContextMixin:
start_date = (
datetime.strptime(trade_date, "%Y%m%d") - timedelta(days=20)
).strftime("%Y%m%d")
history_end = (
datetime.strptime(trade_date, "%Y%m%d") - timedelta(days=1)
).strftime("%Y%m%d")
for quote in quotes:
ts_code = code_map[str(quote.get("code") or "")]
history = client.query(
"index_daily",
{"ts_code": ts_code, "start_date": start_date, "end_date": trade_date},
{"ts_code": ts_code, "start_date": start_date, "end_date": history_end},
"ts_code,trade_date,close,pct_chg",
)
history.sort(key=lambda item: str(item.get("trade_date") or ""))