fix: TradingView K线图表并修复品种推荐为空。

- 行情页改用 Lightweight Charts 标准蜡烛图(红跌绿涨)
- 修复 fee_rates 缺 source 列导致推荐刷新失败
- 空缓存自动重试,持仓页实时兜底计算推荐列表

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 12:33:49 +08:00
parent 074551490f
commit 32f1fa2c66
8 changed files with 458 additions and 527 deletions
+2 -5
View File
@@ -12,10 +12,9 @@ from db_conn import connect_db
from kline_stream import sse_format
from recommend_store import (
load_recommend_cache,
recommend_cache_stale,
recommend_cache_needs_refresh,
recommend_payload,
refresh_recommend_cache,
rows_missing_max_lots,
)
logger = logging.getLogger(__name__)
@@ -78,9 +77,7 @@ def start_recommend_worker(
mode = get_mode_fn() if get_mode_fn else "simulation"
max_pct = float(get_max_margin_pct_fn()) if get_max_margin_pct_fn else 30.0
cached = load_recommend_cache(conn)
if recommend_cache_stale(cached.get("updated_at")) or rows_missing_max_lots(
cached.get("rows") or [],
):
if recommend_cache_needs_refresh(cached, capital=capital):
refresh_recommend_cache(
conn, capital, quote_fn, trading_mode=mode, max_margin_pct=max_pct,
)