Fix recommend table missing trend/daily stats when CTP klines are sparse.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user