Fix empty recommend list and CTP premarket auto-connect.

Correct main_code order in product refresh, refresh on CTP connect, and limit reconnect to trading or premarket windows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-29 08:24:10 +08:00
parent f8ff97f93d
commit b02c9d6ca0
10 changed files with 297 additions and 27 deletions
+1 -1
View File
@@ -295,6 +295,7 @@ def list_product_recommendations(
try:
quote = quote_fn(ths) or {}
price = quote.get("price")
main_code = (quote.get("ths_code") or "").strip()
row = assess_product_for_capital(
product, capital, price,
max_margin_pct=max_margin_pct,
@@ -302,7 +303,6 @@ def list_product_recommendations(
ctp_connected=ctp_connected,
main_code=main_code,
)
main_code = (quote.get("ths_code") or "").strip()
row["main_code"] = main_code
if main_code:
row.update(analyze_product_daily(main_code))