refactor(decision): relax minimum position size constraints for flexibility

## Changes
### Prompt Layer (Soft Guidance)
**Before**:
- BTC/ETH ≥100 USDT | 山寨币 ≥15 USDT (硬性要求)
**After**:
- 统一建议 ≥12 USDT (软性建议)
- 更简洁,不区分币种
- 给 AI 更多决策空间
### Validation Layer (Lower Thresholds)
**Before**:
- BTC/ETH: 100 USDT (硬性)
- 山寨币: 15 USDT (硬性)
**After**:
- BTC/ETH: 60 USDT (-40%, 更灵活)
- 山寨币: 12 USDT (-20%, 更合理)
## Rationale
### Why Relax?
1. **Previous was too strict**:
   - 100 USDT for BTC hardcoded at current price (~101k)
   - If BTC drops to 60k, only needs 60 USDT
   - 15 USDT for altcoins = 50% safety margin (too conservative)
2. **Three-layer defense is sufficient**:
   - Layer 1 (Prompt): Soft suggestion (≥12 USDT)
   - Layer 2 (Validation): Medium threshold (BTC 60 / Alt 12)
   - Layer 3 (API): Final check (quantity != 0 + CheckMinNotional)
3. **User feedback**: Original constraints too restrictive
### Safety Preserved
 API layer still prevents:
- quantity = 0 errors (formatted precision check)
- Below min notional (CheckMinNotional)
 Validation still blocks obviously small amounts
 Prompt guides AI toward safe amounts
## Testing
| Symbol | Amount | Old | New | Result |
|--------|--------|-----|-----|--------|
| BTCUSDT | 50 USDT |  Rejected |  Rejected |  Correct (too small) |
| BTCUSDT | 70 USDT |  Rejected |  Pass |  More flexible |
| ADAUSDT | 11 USDT |  Rejected |  Rejected |  Correct (too small) |
| ADAUSDT | 13 USDT |  Rejected |  Pass |  More flexible |
## Impact
-  More flexible for price fluctuations
-  Better user experience for small accounts
-  Still prevents API errors
-  AI has more decision space
This commit is contained in:
ZhouYongyou
2025-11-05 01:16:34 +08:00
parent 1cb5c268c5
commit 7027d7a2e1
+3 -3
View File
@@ -268,7 +268,7 @@ func buildSystemPrompt(accountEquity float64, btcEthLeverage, altcoinLeverage in
accountEquity*0.8, accountEquity*1.5, accountEquity*5, accountEquity*10))
sb.WriteString(fmt.Sprintf("4. 杠杆限制: **山寨币最大%dx杠杆** | **BTC/ETH最大%dx杠杆** (⚠️ 严格执行,不可超过)\n", altcoinLeverage, btcEthLeverage))
sb.WriteString("5. 保证金: 总使用率 ≤ 90%\n")
sb.WriteString("6. 最小开仓金额: **BTC/ETH ≥100 USDT | 山寨币 ≥15 USDT** (⚠️ 低于此金额会因精度问题导致开仓失败)\n\n")
sb.WriteString("6. 开仓金额: 建议 **≥12 USDT** (交易所最小名义价值 10 USDT + 安全边际)\n\n")
// 3. 输出格式 - 动态生成
sb.WriteString("#输出格式\n\n")
@@ -537,8 +537,8 @@ func validateDecision(d *Decision, accountEquity float64, btcEthLeverage, altcoi
// ✅ 验证最小开仓金额(防止数量格式化为 0 的错误)
// Binance 最小名义价值 10 USDT + 安全边际
const minPositionSizeGeneral = 15.0
const minPositionSizeBTCETH = 100.0 // BTC/ETH 因价格高和精度限制需要更大金额
const minPositionSizeGeneral = 12.0 // 10 + 20% 安全边际
const minPositionSizeBTCETH = 60.0 // BTC/ETH 因价格高和精度限制需要更大金额(更灵活)
if d.Symbol == "BTCUSDT" || d.Symbol == "ETHUSDT" {
if d.PositionSizeUSD < minPositionSizeBTCETH {