diff --git a/frontend/app/paper-v52/page.tsx b/frontend/app/paper-v52/page.tsx index 62c98a7..b60907a 100644 --- a/frontend/app/paper-v52/page.tsx +++ b/frontend/app/paper-v52/page.tsx @@ -290,8 +290,7 @@ function ActivePositions({ strategy }: { strategy: StrategyFilter }) { const frScore = factors?.funding_rate?.score ?? 0; const liqScore = factors?.liquidation?.score ?? 0; const entry = p.entry_price || 0; - const atr = p.atr_at_entry || 1; - const riskDist = 2.0 * 0.7 * atr; + const riskDist = p.risk_distance || Math.abs(entry - (p.sl_price || entry)) || 1; const fullR = riskDist > 0 ? (p.direction === "LONG" ? (currentPrice - entry) / riskDist : (entry - currentPrice) / riskDist) : 0; const tp1R = riskDist > 0 ? (p.direction === "LONG" ? ((p.tp1_price || 0) - entry) / riskDist : (entry - (p.tp1_price || 0)) / riskDist) : 0; const unrealR = p.tp1_hit ? 0.5 * tp1R + 0.5 * fullR : fullR; @@ -322,6 +321,7 @@ function ActivePositions({ strategy }: { strategy: StrategyFilter }) {
入场: ${fmtPrice(p.entry_price)} + {new Date(p.entry_ts).toLocaleString("zh-CN", {hour12:false, month:"2-digit", day:"2-digit", hour:"2-digit", minute:"2-digit", second:"2-digit", fractionalSecondDigits:3} as any)} 现价: ${currentPrice ? fmtPrice(currentPrice) : "-"} TP1: ${fmtPrice(p.tp1_price)}{p.tp1_hit ? " ✅" : ""} TP2: ${fmtPrice(p.tp2_price)} diff --git a/frontend/app/paper/page.tsx b/frontend/app/paper/page.tsx index ca5eb96..9a73c05 100644 --- a/frontend/app/paper/page.tsx +++ b/frontend/app/paper/page.tsx @@ -226,8 +226,7 @@ function ActivePositions() { const holdMin = Math.round((Date.now() - p.entry_ts) / 60000); const currentPrice = wsPrices[p.symbol] || p.current_price || 0; const entry = p.entry_price || 0; - const atr = p.atr_at_entry || 1; - const riskDist = 2.0 * 0.7 * atr; + const riskDist = p.risk_distance || Math.abs(entry - (p.sl_price || entry)) || 1; // TP1触发后只剩半仓:0.5×TP1锁定 + 0.5×当前浮盈 const fullR = riskDist > 0 ? (p.direction === "LONG" ? (currentPrice - entry) / riskDist : (entry - currentPrice) / riskDist) : 0; const tp1R = riskDist > 0 ? (p.direction === "LONG" ? ((p.tp1_price || 0) - entry) / riskDist : (entry - (p.tp1_price || 0)) / riskDist) : 0; @@ -252,8 +251,9 @@ function ActivePositions() { {holdMin}m
-
+
入场: ${fmtPrice(p.entry_price)} + {new Date(p.entry_ts).toLocaleString("zh-CN", {hour12:false, year:undefined, month:"2-digit", day:"2-digit", hour:"2-digit", minute:"2-digit", second:"2-digit", fractionalSecondDigits:3} as any)} 现价: ${currentPrice ? fmtPrice(currentPrice) : "-"} TP1: ${fmtPrice(p.tp1_price)}{p.tp1_hit ? " ✅" : ""} TP2: ${fmtPrice(p.tp2_price)}