From 8ce0adf62a221e1da454816d45b5b87526cdd8eb Mon Sep 17 00:00:00 2001 From: ZhouYongyou <128128010+zhouyongyou@users.noreply.github.com> Date: Fri, 7 Nov 2025 08:46:37 +0800 Subject: [PATCH] fix(prompts): correct risk_usd formula - remove duplicate leverage multiplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem (Issue #592) risk_usd formula incorrectly multiplies leverage twice: - Incorrect: risk_usd = |Entry - Stop| × Position Size × Leverage ❌ This causes AI to calculate risk as 10x (or leverage倍) higher than actual. ## Root Cause Position Size already includes leverage effect: - Position Size (coins) = position_size_usd / price - position_size_usd = margin × leverage - Therefore: Position Size = (margin × leverage) / price Multiplying leverage again amplifies risk calculation by "leverage" times. ## Example Scenario: $100 margin, 10x leverage, 0.02 BTC position, $500 stop distance **Correct calculation:** risk_usd = $500 × 0.02 = $10 ✅ Risk % = 10% of margin (reasonable) **Incorrect calculation (current):** risk_usd = $500 × 0.02 × 10 = $100 ❌ Risk % = 100% of margin (completely wrong!) ## Impact - AI miscalculates risk as "leverage" times higher - May refuse valid trades thinking risk is too high - Risk control logic becomes ineffective - Potential for position sizing errors ## Solution Correct formula: risk_usd = |Entry - Stop| × Position Size (coins) Added warnings: - CN: ⚠️ 不要再乘杠杆:仓位数量已包含杠杆效应 - EN: ⚠️ Do NOT multiply by leverage: Position Size already includes leverage effect ## Modified Files - prompts/adaptive.txt (line 404) - prompts/nof1.txt (line 104) Closes #592 --- prompts/adaptive.txt | 3 ++- prompts/nof1.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/prompts/adaptive.txt b/prompts/adaptive.txt index 4990ad23..a61c271d 100644 --- a/prompts/adaptive.txt +++ b/prompts/adaptive.txt @@ -401,7 +401,8 @@ - >95: 风险预算 2.5%(谨慎使用,警惕过度自信) 5. **risk_usd** (风险金额) - - 计算公式: |入场价 - 止损价| × 仓位数量 × 杠杆 + - 计算公式: |入场价 - 止损价| × 仓位数量 + - ⚠️ **不要再乘杠杆**:仓位数量 = position_size_usd / 价格,已包含杠杆效应 - 必须 ≤ 账户净值 × 风险预算(1.5-2.5%) 6. **slippage_buffer** (滑点缓冲 - V5.5.1 新增) diff --git a/prompts/nof1.txt b/prompts/nof1.txt index f4985468..6b7df707 100644 --- a/prompts/nof1.txt +++ b/prompts/nof1.txt @@ -101,7 +101,8 @@ For EVERY trade decision, you MUST specify: - 80-100: Very high confidence (use cautiously, beware overconfidence) 5. **risk_usd** (float): Dollar amount at risk (distance from entry to stop loss) - - Calculate as: |Entry Price - Stop Loss| × Position Size × Leverage + - Calculate as: |Entry Price - Stop Loss| × Position Size (in coins) + - ⚠️ **Do NOT multiply by leverage**: Position Size already includes leverage effect # PERFORMANCE METRICS & FEEDBACK