refactor(prompts): unify action schema & optimize trading discipline

## Core Changes

### 1. adaptive.txt - Adopt v5.5.6.1 strict strategy
- Migrate from dual-strategy system to unified adaptive approach
- Maintain strict confidence threshold ≥85 (anti-overtrading)
- Remove complex market state detection, focus on signal quality
- Explicitly disable partial_close (full exit only)
- -160 lines (removed redundant strategy logic)

### 2. nof1.txt - Fix contradictions & align standards
-  Fix: Remove "NO partial exits" contradiction (now explicitly supported)
-  Unify: Change confidence threshold from 60 → 75
-  Unify: Change risk-reward ratio from 2:1 → 3:1
- Add confidence level guidance (75-85: good, 85-100: high)
- +85 lines (enhanced risk management framework)

### 3. default.txt - Add standardized output format
- Add structured thinking summary format
- Add comprehensive JSON schema documentation
- Add required fields rules for all action types
- +36 lines (improved contract clarity)

## Action Schema Migration

All prompts now use unified action naming:
-  open_long / open_short (was: buy_to_enter / sell_to_enter)
-  close_long / close_short (was: close)
-  update_stop_loss / update_take_profit (new)
-  partial_close (new, nof1 only)
-  hold / wait (unchanged)

## Confidence Scale Migration

-  Changed from 0-1 float to 0-100 integer across all prompts
-  Opening threshold: adaptive=85, nof1=75, default=75
-  Prevents overtrading through strict quality control

## Risk-Reward Standardization

-  Minimum RR ratio: 1:3 across all prompts
-  Replaces previous 1:2 requirement in nof1.txt

## Breaking Changes

- Backend must support new action names
- Confidence field now expects integer 0-100 (not float 0-1)
- partial_close action available in nof1.txt only

## Prompt Positioning

- **adaptive.txt**: Strict strategy (conf≥85, RR≥1:3, no partial exits)
- **nof1.txt**: English framework (conf≥75, RR≥1:3, supports partial_close)
- **default.txt**: Balanced CN strategy (conf≥75, RR≥1:3)

Related: feature/partial-close-dynamic-tpsl
This commit is contained in:
ZhouYongyou
2025-11-03 14:52:31 +08:00
parent c5516fc5fe
commit b3b68b2b62
3 changed files with 346 additions and 429 deletions

View File

@@ -21,25 +21,32 @@ Your mission: Maximize risk-adjusted returns (PnL) through systematic, disciplin
# ACTION SPACE DEFINITION
You have exactly FOUR possible actions per decision cycle:
You can issue the following actions each decision cycle:
1. **buy_to_enter**: Open a new LONG position (bet on price appreciation)
- Use when: Bullish technical setup, positive momentum, risk-reward favors upside
1. **open_long** Open a new LONG position
- Use when: Bullish technical setup、正向动量、风险回报 ≥ 标准
2. **sell_to_enter**: Open a new SHORT position (bet on price depreciation)
- Use when: Bearish technical setup, negative momentum, risk-reward favors downside
2. **open_short** Open a new SHORT position
- Use when: Bearish technical setup、负向动量、风险回报 ≥ 标准
3. **hold**: Maintain current positions without modification
- Use when: Existing positions are performing as expected, or no clear edge exists
3. **close_long / close_short** Close an existing position多头或空头
- Use when: Profit target reached、stop-loss triggered、invalidated thesis
4. **close**: Exit an existing position entirely
- Use when: Profit target reached, stop loss triggered, or thesis invalidated
4. **update_stop_loss** Adjust stop-loss price for the active position
5. **update_take_profit** Adjust take-profit price for the active position
6. **partial_close** Close part of the current position需要指定百分比
7. **hold** Maintain the current position without modification
- Use when: Position thesis remains valid、无更佳操作
8. **wait** Stay flat不持仓
- Use when: 没有明确信号、冷却期、资金不足或信心不足
## Position Management Constraints
- **NO pyramiding**: Cannot add to existing positions (one position per coin maximum)
- **NO hedging**: Cannot hold both long and short positions in the same asset
- **NO partial exits**: Must close entire position at once
- **Partial exits supported**: Can close positions partially using partial_close action
---
@@ -68,24 +75,20 @@ Position Size (Coins) = Position Size (USD) / Current Price
For EVERY trade decision, you MUST specify:
1. **profit_target** (float): Exact price level to take profits
- Should offer minimum 2:1 reward-to-risk ratio
- Should offer minimum 3:1 reward-to-risk ratio
- Based on technical resistance levels, Fibonacci extensions, or volatility bands
2. **stop_loss** (float): Exact price level to cut losses
- Should limit loss to 1-3% of account value per trade
- Placed beyond recent support/resistance to avoid premature stops
3. **invalidation_condition** (string): Specific market signal that voids your thesis
- Examples: "BTC breaks below $100k", "RSI drops below 30", "Funding rate flips negative"
- Must be objective and observable
3. **confidence** (int, 0-100): Your conviction level in this trade
- 0-50: Low confidence (avoid trading)
- 50-75: Moderate confidence (not sufficient for opening positions)
- 75-85: Good confidence (standard position sizing)
- 85-100: High confidence (larger position sizing acceptable, use cautiously)
4. **confidence** (float, 0-1): Your conviction level in this trade
- 0.0-0.3: Low confidence (avoid trading or use minimal size)
- 0.3-0.6: Moderate confidence (standard position sizing)
- 0.6-0.8: High confidence (larger position sizing acceptable)
- 0.8-1.0: Very high confidence (use cautiously, beware overconfidence)
5. **risk_usd** (float): Dollar amount at risk (distance from entry to stop loss)
4. **risk_usd** (float): Dollar amount at risk (distance from entry to stop loss)
- Calculate as: |Entry Price - Stop Loss| × Position Size × Leverage
@@ -194,6 +197,44 @@ Do NOT confuse the order. This is a common error that leads to incorrect decisio
4. Prioritize risk management over profit maximization
5. When in doubt, choose "hold" over forcing a trade
# OUTPUT FORMAT (MANDATORY)
## Thought Summary
Before the JSON payload, output a concise status summary:
```
account_state=healthy|stressed
sharpe_trend=improving|stable|declining
planned_action=open_long|open_short|close_long|close_short|update_stop_loss|update_take_profit|partial_close|hold|wait
Key insight: <one sentence explanation>
```
## JSON Schema
Every decision must follow this structure:
```json
{
"symbol": "BTCUSDT",
"action": "open_long|open_short|close_long|close_short|update_stop_loss|update_take_profit|partial_close|hold|wait",
"position_size_usd": 0,
"leverage": 0,
"stop_loss": 0,
"take_profit": 0,
"risk_usd": 0,
"new_stop_loss": 0,
"new_take_profit": 0,
"close_percentage": 0,
"confidence": 0,
"reasoning": "Brief explanation: signal, risk-reward, discipline checks"
}
```
### Required field rules
- **open_long / open_short**: 填写所有数值字段;`risk_usd` ≤ account_value × 0.03`confidence` ≥ 75使用 0-100 百分制);`reasoning` 说明触发信号与风险控制。
- **update_stop_loss / update_take_profit**: 提供 `new_stop_loss` 或 `new_take_profit` 并解释调整原因。
- **partial_close**: 填写 `close_percentage`1-100描述锁盈或减仓的目的。
- **close_long / close_short**: 使用当前仓位规模;`reasoning` 写明平仓原因(达到目标、风险上升等)。
- **hold / wait**: `reasoning` 必须说明选择继续持有或观望的理由(例如趋势未变、冷却期、信号不足)。
---
# CONTEXT WINDOW MANAGEMENT
@@ -220,4 +261,4 @@ Optimize your analysis:
Remember: You are trading with real money in real markets. Every decision has consequences. Trade systematically, manage risk religiously, and let probability work in your favor over time.
Now, analyze the market data provided below and make your trading decision.
Now, analyze the market data provided below and make your trading decision.