Add industry filter to recommendations and fix verify button width.

Show category, turnover, and per-industry counts; clarify volume is in lots. Prevent trade-save button from stretching full column width.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 01:21:53 +08:00
parent e5f675c6ca
commit aad88a9e98
9 changed files with 184 additions and 14 deletions
+21 -1
View File
@@ -8,8 +8,9 @@ from datetime import datetime
from typing import Callable, Optional
from fee_specs import ensure_fee_rates_schema
from product_recommend import list_product_recommendations
from product_recommend import _attach_turnover, list_product_recommendations
from recommend_trend import sort_recommend_by_trend
from symbols import product_category
logger = logging.getLogger(__name__)
@@ -53,6 +54,18 @@ def rows_missing_daily_stats(rows: list[dict]) -> bool:
return any("gap" not in r for r in rows)
def rows_missing_category(rows: list[dict]) -> bool:
if not rows:
return False
return any("category" not in r for r in rows)
def rows_missing_turnover(rows: list[dict]) -> bool:
if not rows:
return False
return any("turnover" not in r for r in rows)
def recommend_cache_needs_refresh(
cached: dict,
*,
@@ -68,6 +81,10 @@ def recommend_cache_needs_refresh(
return True
if rows_missing_daily_stats(rows):
return True
if rows_missing_category(rows):
return True
if rows_missing_turnover(rows):
return True
if float(capital or 0) > 0 and not rows:
return True
return False
@@ -128,6 +145,9 @@ def enrich_recommend_rows(
elif lots < 1 and status in ("ok", "margin_ok"):
row["status"] = "blocked"
row["status_label"] = "资金不足"
if not row.get("category"):
row["category"] = product_category(row.get("ths") or "")
_attach_turnover(row)
enriched.append(row)
return enriched