mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2025-12-06 13:54:41 +08:00
fix(prompts): reduce margin usage from 95% to 88% for Hyperliquid liquidation buffer (#666)
## Problem Users with small accounts (<$200) encounter Hyperliquid error: "Insufficient margin to place order. asset=1" Real case: $98.89 account failed to open position ## Root Cause 5% reserve insufficient for: - Trading fees (~0.04%) - Slippage (0.01-0.1%) - Liquidation margin buffer (Hyperliquid requirement) Additionally, undefined "Allocation %" parameter caused confusion. ## Solution 1. Reduce margin usage rate from 95% to 88% (reserve 12%) 2. Remove undefined "Allocation %" parameter 3. Add small account example ($98.89) for clarity ## Example ($98.89 account) Before: $93.95 margin → $4.75 remaining ❌ After: $87.02 margin → $11.87 remaining ✅ ## Modified Files - prompts/adaptive.txt - prompts/default.txt - prompts/nof1.txt ## Testing Verified with $98.89 account on z-dev branch - successful order placement Fixes #549
This commit is contained in:
committed by
GitHub
parent
05ec599e22
commit
47357dfdbf
@@ -345,15 +345,20 @@
|
||||
**重要**:position_size_usd 是**名义价值**(包含杠杆),非保证金需求。
|
||||
|
||||
**计算步骤**:
|
||||
1. **可用保证金** = Available Cash × 0.95 × Allocation %(预留5%给手续费)
|
||||
1. **可用保证金** = Available Cash × 0.88(预留12%给手续费、滑点与清算保证金缓冲)
|
||||
2. **名义价值** = 可用保证金 × Leverage
|
||||
3. **position_size_usd** = 名义价值(这是 JSON 中应填写的值)
|
||||
4. **Position Size (Coins)** = position_size_usd / Current Price
|
||||
|
||||
**示例**:Available Cash = $500, Leverage = 5x, Allocation = 100%
|
||||
- 可用保证金 = $500 × 0.95 × 100% = $475
|
||||
- position_size_usd = $475 × 5 = **$2,375** ← JSON 中填写此值
|
||||
- 实际占用保证金 = $475,剩余 $25 用于手续费
|
||||
**示例**:Available Cash = $500, Leverage = 5x
|
||||
- 可用保证金 = $500 × 0.88 = $440
|
||||
- position_size_usd = $440 × 5 = **$2,200** ← JSON 中填写此值
|
||||
- 实际占用保证金 = $440,剩余 $60 用于手续费、滑点与清算保护
|
||||
|
||||
**示例2(小账户)**:Available Cash = $98.89, Leverage = 5x
|
||||
- 可用保证金 = $98.89 × 0.88 = $87.02
|
||||
- position_size_usd = $87.02 × 5 = **$435.10** ← JSON 中填写此值
|
||||
- 实际占用保证金 = $87.02,剩余 $11.87 用于手续费、滑点与清算保护
|
||||
|
||||
## 杠杆选择指引
|
||||
|
||||
|
||||
@@ -111,15 +111,15 @@
|
||||
**重要**:`position_size_usd` 是**名义价值**(包含杠杆),非保证金需求。
|
||||
|
||||
**计算步骤**:
|
||||
1. **可用保证金** = Available Cash × 0.95 × 配置比例(预留5%手续费)
|
||||
1. **可用保证金** = Available Cash × 0.88(预留12%给手续费、滑点与清算保证金缓冲)
|
||||
2. **名义价值** = 可用保证金 × Leverage
|
||||
3. **position_size_usd** = 名义价值(JSON中填写此值)
|
||||
4. **实际币数** = position_size_usd / Current Price
|
||||
|
||||
**示例**:可用资金 $500,杠杆 5x,配置 100%
|
||||
- 可用保证金 = $500 × 0.95 = $475
|
||||
- position_size_usd = $475 × 5 = **$2,375** ← JSON填此值
|
||||
- 实际占用保证金 = $475,剩余 $25 用于手续费
|
||||
**示例**:可用资金 $500,杠杆 5x
|
||||
- 可用保证金 = $500 × 0.88 = $440
|
||||
- position_size_usd = $440 × 5 = **$2,200** ← JSON填此值
|
||||
- 实际占用保证金 = $440,剩余 $60 用于手续费、滑点与清算保护
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -55,15 +55,15 @@ You have exactly SIX possible actions per decision cycle:
|
||||
|
||||
## Calculation Steps:
|
||||
|
||||
1. **Available Margin** = Available Cash × 0.95 × Allocation % (reserve 5% for fees)
|
||||
1. **Available Margin** = Available Cash × 0.88 (reserve 12% for fees, slippage & liquidation margin buffer)
|
||||
2. **Notional Value** = Available Margin × Leverage
|
||||
3. **position_size_usd** = Notional Value (this is the value for JSON)
|
||||
4. **Position Size (Coins)** = position_size_usd / Current Price
|
||||
|
||||
**Example**: Available Cash = $500, Leverage = 5x, Allocation = 100%
|
||||
- Available Margin = $500 × 0.95 × 100% = $475
|
||||
- position_size_usd = $475 × 5 = **$2,375** ← Fill this value in JSON
|
||||
- Actual margin used = $475, remaining $25 for fees
|
||||
**Example**: Available Cash = $500, Leverage = 5x
|
||||
- Available Margin = $500 × 0.88 = $440
|
||||
- position_size_usd = $440 × 5 = **$2,200** ← Fill this value in JSON
|
||||
- Actual margin used = $440, remaining $60 for fees, slippage & liquidation protection
|
||||
|
||||
## Sizing Considerations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user