Fix recommend table missing trend/daily stats when CTP klines are sparse.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-03 13:00:03 +08:00
parent 08be5f34c8
commit 61481d5749
2 changed files with 13 additions and 5 deletions
+11 -4
View File
@@ -51,17 +51,24 @@ def rows_missing_max_lots(rows: list[dict]) -> bool:
def rows_missing_trend(rows: list[dict]) -> bool:
"""缓存是否为旧版(缺少走势字段)。"""
"""缓存是否为旧版(缺少走势字段或走势未算出)。"""
if not rows:
return False
return any("trend" not in r for r in rows)
return any("trend" not in r or not str(r.get("trend") or "").strip() for r in rows)
def rows_missing_daily_stats(rows: list[dict]) -> bool:
"""缓存是否为旧版(缺少跳空/量价字段)。"""
"""缓存是否为旧版(缺少跳空/量价字段或日线统计未算出)。"""
if not rows:
return False
return any("gap" not in r for r in rows)
return any(
r.get("status") in ("ok", "margin_ok")
and (
"gap" not in r
or r.get("prev_close") in (None, "", 0)
)
for r in rows
)
def rows_missing_category(rows: list[dict]) -> bool: