Commit Graph

15 Commits

Author SHA1 Message Date
ZhouYongyou
221b03b383 refactor(prompts): enhance partial_close guidance in adaptive & nof1
## Core Changes

### 1. adaptive.txt - Chinese Enhanced Version
- Add comprehensive partial close guidance chapter (line 137-143)
- Update action table with detailed field requirements (line 131)
- Clarify remaining position management strategy (line 273)
- Add compatibility note for close_percentage field (line 276)
- Update base trading constraints to support partial exits (line 69)
- Changes: +13/-4 lines

### 2. nof1.txt - English Enhanced Version
- Add 'PARTIAL CLOSE & DYNAMIC TP/SL GUIDANCE' chapter (line 55-87)
- Enhance partial_close action definition with use cases (line 37-39)
- Update Required field rules (full English translation + enhancements)
- Add example reasoning for multi-stage exit strategy
- Improve all field rules documentation consistency
- Changes: +43/-6 lines

## Benefits
-  Both prompts now have complete partial_close operation guidance
-  Unified standards: clear percentages (25%/50%/75%), remaining position management
-  Language consistency: adaptive (Chinese) / nof1 (English)
-  Practical examples included to guide AI decision-making
-  Detailed instructions for simultaneous TP/SL adjustments

## Backend Compatibility
- All features supported by backend (decision/engine.go)
- No breaking changes
- partial_close, update_stop_loss, update_take_profit all validated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 19:23:04 +08:00
ZhouYongyou
bead75ef8f merge: Sync with NoFxAiOS/dev - adopt WebSocket architecture
Merged 54 commits from upstream (NoFxAiOS/dev @ 8832557)

## Key Changes

### 🚀 WebSocket Real-time Data Architecture
-  NEW: WebSocket client with auto-reconnect (websocket_client.go)
-  NEW: Market data monitor with combined streams (monitor.go)
-  NEW: K-line caching system (combined_streams.go)
-  UPGRADE: market/data.go now uses WebSocket instead of REST API
- 🎯 Benefits: Lower latency, reduced API limits, auto-reconnect

### 📝 Documentation & CI/CD
-  NEW: Comprehensive troubleshooting guides (EN + ZH-CN)
-  UPGRADE: Enhanced PR workflow with checks
-  NEW: PR title guide & template improvements
-  UPDATE: FAQ expanded with common issues

### 🔧 Conflict Resolution
- market/data.go: Adopted upstream WebSocket version
- prompts/adaptive.txt: Kept our v5.5.6.1 (conf≥85, strict strategy)

### 📊 Stats
- Files changed: 40+
- New files: 12 (WebSocket modules, docs, CI)
- Commits merged: 54

Related: feature/partial-close-dynamic-tpsl
Upstream: NoFxAiOS/nofx @ 8832557
2025-11-03 18:40:54 +08:00
ZhouYongyou
b3b68b2b62 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
2025-11-03 14:52:31 +08:00
tinkle-community
ed4a7a2d20 Merge pull request #268 from yutou123/dev 2025-11-03 06:59:28 +08:00
ZhouYongyou
bad79337fb docs(prompts): Update AI prompt to support dynamic TP/SL features (v5.5.1)
- Add 3 new action types: update_stop_loss, update_take_profit, partial_close
- Introduce "Zero Principle" (疑惑优先) for risk control
- Expand decision flow to 8 steps with critical safeguards:
  * Step 2: Consecutive loss pause (2x→45min, 3x→24h, 4x→72h)
  * Step 5: BTC status check (multi-timeframe MACD confirmation)
  * Step 6: Long/short confirmation checklist (≥5/8 indicators)
  * Step 7: Fake breakout detection (RSI multi-timeframe + candle patterns)
  * Step 8: Objective confidence scoring (base 60 + conditions)
- Add signal priority ranking (trend resonance > volume > BTC > RSI...)
- Add dynamic TP/SL strategies with examples
- Increase confidence threshold: 0.6 → 0.85 for opening positions
- Add cooldown rules and slippage buffer (0.05%)
- Optimize prompt length: 4445 words → 1500 words (-66%)

Key improvements in v5.5.1:
 BTC status check - Most critical protection for altcoin trading
 Long/short checklist - 5/8 indicators required, prevent false signals
 Objective confidence scoring - Base 60 + condition adjustments
 Fake breakout logic - RSI multi-timeframe + candle filters
 Consecutive loss pause - 2x/3x/4x trigger different cooldowns
 OI confirmation - >+5% for real breakout validation
 Signal priority ranking - Trend resonance > volume > BTC...
 Slippage handling - 0.05% buffer + profit check

Design philosophy: Let AI autonomously judge trend vs chop, trust strong reasoning models.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 01:59:54 +08:00
芋头
2bb28a1738 文件命名空格问题 2025-11-03 00:16:28 +08:00
芋头
0f25e56b13 补充提示词 2025-11-02 23:56:32 +08:00
ZhouYongyou
37df286a31 fix: 恢復 adaptive.txt 中被誤刪的動態止盈止損說明
問題:merge dev 時,dev 分支的刪減版覆蓋了 feature 的完整版
原因:dev 分支為避免生產錯誤暫時刪除了這些說明
解決:feature 分支已實現完整功能,應恢復這些說明

恢復內容:
- 策略 A(震盪市):追蹤止損指導 + 動態調整示例
- 策略 B(趨勢市):分批止盈邏輯 + 追蹤止損指導 + 動態調整示例

功能支持:
- update_stop_loss ✓
- update_take_profit ✓
- partial_close ✓
2025-11-02 07:35:56 +08:00
ZhouYongyou
adb7e55f90 Merge branch 'dev' into feature/partial-close-dynamic-tpsl 2025-11-02 07:27:01 +08:00
ZhouYongyou
f15d82b13a 修復生產錯誤:刪除 adaptive.txt 中不支持的動態調整功能描述
問題:AI 生成 update_stop_loss 決策但被拒絕為無效動作
原因:adaptive.txt 描述了動態止損功能,但 dev 分支代碼未實現

刪除內容:
- 震盪策略:追蹤止損(持倉中動態調整)段落
- 趨勢策略:分批止盈、追蹤止損段落
- 策略選擇:追蹤止損計劃
- 持倉動態調整範例

結果:提示詞與代碼功能完全匹配,避免 AI 生成無效決策

相關 issue:生產環境報錯 '无效的action:update_stop_loss'
後續計劃:在 feature/partial-close-dynamic-tpsl 測試完成後再合併動態功能
2025-11-02 06:03:56 +08:00
ZhouYongyou
b145471895 docs(adaptive): 添加數據解釋和參考示例,採用"解釋+參考"方式
改動說明:
- 新增「數據框架說明」章節:詳細說明 4 個時間框架的覆蓋時間和用途
  * 3分鐘序列(30分鐘):實時價格、放量檢測、買賣壓力
  * 15分鐘序列(2.5小時):震盪區間識別
  * 1小時序列(10小時):中期趨勢確認
  * 4小時序列(40小時):大趨勢判斷

- 新增「關鍵數據解讀」章節:
  * BuySellRatio 含義和參考範圍(0.6-0.7 強買壓,0.3-0.4 強賣壓)
  * 成交量分析:放量檢測標準(1.5-2 倍平均)
  * RSI 參考範圍:根據市場波動性調整(震盪市 30-40/60-70)

- 新增「入場信號參考示例」章節:
  * 震盪策略入場信號(區間下沿做多、上沿做空)
  * 趨勢策略入場信號(趨勢突破參考)

- 補充「避免低質量信號」:
  * 新增:震盪市在區間中部交易(應等待區間邊界)
  * 新增:缺乏買賣壓力確認(BuySellRatio 中性時謹慎)

設計哲學:
- 採用「解釋 + 參考示例」方式,而非硬編碼固定規則
- 所有參考數值都明確標註「你可以根據市場狀態自主調整」
- 強調根據市場波動性、趨勢強度自主判斷
- 激發 AI 的判斷能力,而非限制其靈活性
- 通過夏普比率反饋實現自我進化

改動統計:
- 原文件:259 行
- 新文件:366 行(+107 行)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 05:53:01 +08:00
ZhouYongyou
7f741c4a7d docs(adaptive): 添加數據解釋和參考示例,採用"解釋+參考"方式
改動說明:
- 新增「數據框架說明」章節:詳細說明 4 個時間框架的覆蓋時間和用途
- 新增「關鍵數據解讀」章節:
  * BuySellRatio 含義和參考範圍(0.6-0.7 強買壓,0.3-0.4 強賣壓)
  * 成交量分析:放量檢測標準(1.5-2 倍平均)
  * RSI 參考範圍:根據市場波動性調整(震盪市 30-40/60-70)
- 新增「入場信號參考示例」章節:
  * 震盪策略入場信號(區間下沿做多、上沿做空)
  * 趨勢策略入場信號(趨勢突破參考)
- 補充「避免低質量信號」:
  * 新增:震盪市在區間中部交易(應等待區間邊界)
  * 新增:缺乏買賣壓力確認(BuySellRatio 中性時謹慎)

設計哲學:
- 採用「解釋 + 參考示例」方式,而非硬編碼固定規則
- 所有參考數值都明確標註「你可以根據市場狀態自主調整」
- 強調根據市場波動性、趨勢強度自主判斷
- 激發 AI 的判斷能力,而非限制其靈活性
- 通過夏普比率反饋實現自我進化

改動統計:+111 行(增加詳細解釋和示例)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 05:48:28 +08:00
ZhouYongyou
82660b12c5 feat: 添加部分平仓和动态止盈止损功能
新增功能:
- update_stop_loss: 调整止损价格(追踪止损)
- update_take_profit: 调整止盈价格(技术位优化)
- partial_close: 部分平仓(分批止盈)

实现细节:
- Decision struct 新增字段:NewStopLoss, NewTakeProfit, ClosePercentage
- 新增执行函数:executeUpdateStopLossWithRecord, executeUpdateTakeProfitWithRecord, executePartialCloseWithRecord
- 修复持仓字段获取 bug(使用 "side" 并转大写)
- 更新 adaptive.txt 文档,包含详细使用示例和策略建议
- 优先级排序:平仓 > 调整止盈止损 > 开仓

命名统一:
- 与社区 PR #197 保持一致,使用 update_* 而非 adjust_*
- 独有功能:partial_close(部分平仓)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 05:32:23 +08:00
ZhouYongyou
b908fac92f feat: 創建 adaptive.txt 自適應雙策略模板
新增 prompts/adaptive.txt 模板,包含:

## 核心特性
- 市場狀態判斷(震盪/趨勢,多指標交叉驗證)
- 雙策略系統:
  * 策略 A: 震盪交易(高勝率低盈虧比)
  * 策略 B: 趨勢跟隨(中等勝率高盈虧比)
- 技術位優先止盈機制(EMA20、前高前低、整數關口)
- 動態追踪止損(鎖定利潤,避免回撤)
- 夏普比率自我進化(交易質量 > 交易頻率)

## 使用方式
用戶可在 Web UI 選擇此模板,或繼續使用 default/nof1

## 技術實現
- 259 行完整策略指導
- 與現有模板系統兼容
- engine.go 保留硬編碼作為 fallback

相關文檔:TEMPLATE_MIGRATION_PLAN.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 01:06:11 +08:00
SkywalkerJi
4250c11ddf Supports custom system prompts and custom models. 2025-11-01 19:45:54 +08:00