diff --git a/backend/signal_engine.py b/backend/signal_engine.py index dc7eec2..fae313e 100644 --- a/backend/signal_engine.py +++ b/backend/signal_engine.py @@ -367,8 +367,8 @@ class SymbolState: cur.execute( """ SELECT - COALESCE(SUM(CASE WHEN side='SELL' THEN usd_value ELSE 0 END), 0) as long_liq, - COALESCE(SUM(CASE WHEN side='BUY' THEN usd_value ELSE 0 END), 0) as short_liq + COALESCE(SUM(CASE WHEN side='LONG' THEN usd_value ELSE 0 END), 0) as long_liq, + COALESCE(SUM(CASE WHEN side='SHORT' THEN usd_value ELSE 0 END), 0) as short_liq FROM liquidations WHERE symbol=%s AND trade_time >= %s """, @@ -494,15 +494,15 @@ class SymbolState: fr_score = 0 if "funding_rate" in enabled_signals and funding_rate is not None: fr_abs = abs(funding_rate) - if fr_abs >= 0.001: # extreme ±0.1% - # Extreme: penalize if going WITH the crowd - if (direction == "LONG" and funding_rate > 0.001) or (direction == "SHORT" and funding_rate < -0.001): + if fr_abs >= 0.0003: # extreme ±0.03% — 很高的FR,逆向减分 + # 做多但FR极高(多头拥挤)= 危险,减分 + if (direction == "LONG" and funding_rate > 0) or (direction == "SHORT" and funding_rate < 0): fr_score = -5 else: - fr_score = 5 - elif fr_abs >= 0.0003: # moderate ±0.03% - # Moderate: reward going AGAINST the crowd - if (direction == "LONG" and funding_rate < -0.0003) or (direction == "SHORT" and funding_rate > 0.0003): + fr_score = 5 # 反向操作,加分 + elif fr_abs >= 0.00005: # moderate ±0.005% — 轻度偏移,顺向加分 + # 做多且FR为负(空头付钱给多头)= 顺势,加分 + if (direction == "LONG" and funding_rate < 0) or (direction == "SHORT" and funding_rate > 0): fr_score = 5 else: fr_score = 0 diff --git a/frontend/app/paper/page.tsx b/frontend/app/paper/page.tsx index fceecb8..ee55560 100644 --- a/frontend/app/paper/page.tsx +++ b/frontend/app/paper/page.tsx @@ -346,8 +346,7 @@ function ActivePositions({ strategy }: { strategy: StrategyFilter }) { {isV52 && (
-
✨ Funding Rate Score: {frScore >= 0 ? "+" : ""}{frScore}
-
✨ Liquidation Score: {liqScore >= 0 ? "+" : ""}{liqScore}
+ {isV52 &&
FR {frScore >= 0 ? "+" : ""}{frScore} · Liq {liqScore >= 0 ? "+" : ""}{liqScore}
}
)} @@ -525,10 +524,7 @@ function TradeHistory({ strategy }: { strategy: StrategyFilter }) { -
{t.score}
-
- {isV52 ? `✨ FR ${frScore >= 0 ? "+" : ""}${frScore} · Liq ${liqScore >= 0 ? "+" : ""}${liqScore}` : "FR/Liq 仅V5.2"} -
+
{t.score}{isV52 && (frScore !== 0 || liqScore !== 0) ? ({frScore > 0 ? "+" : ""}{frScore}/{liqScore > 0 ? "+" : ""}{liqScore}) : ""}
{holdMin}m diff --git a/signal-engine.log b/signal-engine.log index e69de29..6647fe5 100644 --- a/signal-engine.log +++ b/signal-engine.log @@ -0,0 +1,11 @@ +2026-03-01 23:06:35,118 [INFO] signal-engine: 已加载策略配置: v51_baseline, v52_8signals +2026-03-01 23:06:37,990 [INFO] signal-engine: [BTCUSDT] 冷启动完成: 加载425,636条历史数据 (窗口=4h) +2026-03-01 23:06:41,185 [INFO] signal-engine: [ETHUSDT] 冷启动完成: 加载474,707条历史数据 (窗口=4h) +2026-03-01 23:06:41,583 [INFO] signal-engine: [XRPUSDT] 冷启动完成: 加载63,246条历史数据 (窗口=4h) +2026-03-01 23:06:42,041 [INFO] signal-engine: [SOLUSDT] 冷启动完成: 加载70,472条历史数据 (窗口=4h) +2026-03-01 23:06:42,041 [INFO] signal-engine: === Signal Engine (PG) 启动完成 === +2026-03-01 23:06:42,270 [INFO] signal-engine: [BTCUSDT] 🚨 信号[v51_baseline]: LONG score=90 price=65362.8 +2026-03-01 23:06:42,270 [INFO] signal-engine: [BTCUSDT] 🚨 信号[v52_8signals]: LONG score=90 price=65362.8 +2026-03-01 23:06:42,726 [INFO] signal-engine: [SOLUSDT] 🚨 信号[v51_baseline]: LONG score=92 price=82.8 +2026-03-01 23:06:42,726 [INFO] signal-engine: [SOLUSDT] 🚨 信号[v52_8signals]: LONG score=92 price=82.8 +2026-03-01 23:07:14,105 [INFO] signal-engine: 冷启动保护期结束,模拟盘开仓已启用