mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-10 06:20:58 +08:00
## Problem Merged WebSocket architecture (nofxaios/dev) only supported 3m/4h intervals, but adaptive.txt v5.5.6.1 requires 15m/1h data for: - BTC state evaluation (line 105-107) - Multi-confirmation checklist (line 146, 159) - False breakout detection (line 176, 182) - Confidence scoring (line 197) ## Solution Add 15m and 1h timeframe support across WebSocket pipeline: ### 1. market/monitor.go (+64/-40 lines) - Add klineDataMap15m and klineDataMap1h to WSMonitor struct - Update subKlineTime: ["3m", "4h"] → ["3m", "15m", "1h", "4h"] - Extend initializeHistoricalData() to load 15m/1h historical klines - Update getKlineDataMap() switch to handle all 4 timeframes - Fix bug: line 109 used wrong variable (klines vs klines4h) ### 2. market/types.go (+26/-1 lines) - Add MidTermData15m struct (15-minute short-term trend filtering) - Add MidTermData1h struct (1-hour mid-term trend confirmation) - Update Data struct to include: - MidTermSeries15m *MidTermData15m - MidTermSeries1h *MidTermData1h ### 3. market/data.go (+171/-2 lines) - Update Get() to fetch klines15m and klines1h via WebSocket - Implement calculateMidTermSeries15m() - computes EMA20, MACD, RSI7/14 for 15m - Implement calculateMidTermSeries1h() - computes EMA20, MACD, RSI7/14 for 1h - Update Format() to output 15m/1h series data for AI prompt context ## Impact Assessment ### WebSocket Load (Binance limit: 1024 streams/connection) - 8 coins × 4 timeframes = 32 streams (3% usage) ✅ - 100 coins × 4 timeframes = 400 streams (39% usage) ✅ - 250 coins × 4 timeframes = 1000 streams (98% usage) ⚠️ ### Benefits - Enables adaptive.txt standard mode: 15m/1h/4h multi-timeframe confirmation - Restores false breakout detection: 15m RSI vs 1h RSI divergence checks - Improves confidence scoring: 15m/1h/4h MACD alignment validation - Zero REST API calls (WebSocket cache, no rate limit risk) ## Testing Notes - Monitor initial subscription logs for "已加载 X 的历史K线数据-15m/1h" - Verify AI prompts contain "Mid-term series (15-minute intervals)" section - Check decision logs reference 15m/1h indicators in reasoning Related: adaptive.txt v5.5.6.1 requirements, NoFxAiOS/dev WebSocket merge