Add daily trend status to product recommendations with breakout priority
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,6 +8,7 @@ from typing import Callable, Optional
|
||||
|
||||
from contract_specs import get_contract_spec
|
||||
from fee_specs import calc_fee_breakdown
|
||||
from recommend_trend import analyze_product_trend, sort_recommend_by_trend
|
||||
from symbols import PRODUCTS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -126,6 +127,8 @@ def list_product_recommendations(
|
||||
)
|
||||
main_code = (quote.get("ths_code") or "").strip()
|
||||
row["main_code"] = main_code
|
||||
if main_code:
|
||||
row.update(analyze_product_trend(main_code))
|
||||
return row
|
||||
except Exception as exc:
|
||||
logger.warning("recommend product failed %s: %s", ths, exc)
|
||||
@@ -141,6 +144,4 @@ def list_product_recommendations(
|
||||
|
||||
with ThreadPoolExecutor(max_workers=10) as pool:
|
||||
rows = list(pool.map(_one, PRODUCTS))
|
||||
order = {"ok": 0, "margin_ok": 1, "blocked": 2, "no_price": 3}
|
||||
rows.sort(key=lambda r: (order.get(r["status"], 9), -(r.get("max_lots") or 0)))
|
||||
return rows
|
||||
return sort_recommend_by_trend(rows)
|
||||
|
||||
Reference in New Issue
Block a user