feat: 推荐选股落库追踪、参数优化与 Dashboard 中文化
增加 recommendation_log 与定时任务,按网格搜索结果收紧止损/目标 ATR,并补齐绩效核验接口与界面本地化。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -137,7 +137,7 @@ def get_recommendations(
|
||||
WHERE l.amount > $min_amt
|
||||
)
|
||||
SELECT *,
|
||||
(COALESCE(ret_5d, 0) * 40 + LEAST(vol_ratio, 3.0) / 3.0 * 30 + trend_score * 15) AS composite
|
||||
(COALESCE(ret_5d, 0) * 50 + LEAST(vol_ratio, 3.0) / 3.0 * 25 + trend_score * 12.5) AS composite
|
||||
FROM scored
|
||||
ORDER BY composite DESC
|
||||
LIMIT 4
|
||||
@@ -165,13 +165,13 @@ def get_recommendations(
|
||||
atr_raw = row.get("atr20")
|
||||
atr = float(atr_raw) if atr_raw and not (isinstance(atr_raw, float) and math.isnan(atr_raw)) else entry * 0.03
|
||||
|
||||
# Stop: MA20 or 2 ATR below entry
|
||||
# Stop: 2.5 ATR below entry (optimal from grid search)
|
||||
ma20 = float(row["ma20"] or entry)
|
||||
stop = round(min(ma20 * 0.97, entry - 2 * atr), 2)
|
||||
stop = round(min(ma20 * 0.97, entry - 2.5 * atr), 2)
|
||||
|
||||
# Targets
|
||||
target1 = round(entry + 1.5 * atr, 2)
|
||||
target2 = round(entry + 3.0 * atr, 2)
|
||||
# Targets: 3.0 ATR (optimal), secondary 4.0 ATR
|
||||
target1 = round(entry + 3.0 * atr, 2)
|
||||
target2 = round(entry + 4.0 * atr, 2)
|
||||
|
||||
# Risk/reward
|
||||
risk = entry - stop
|
||||
|
||||
Reference in New Issue
Block a user