Spectre Trading System Upgrade Roadmap
Created 2026-03-31 from deep research across market microstructure, ML/AI, portfolio optimization, and crypto alpha sources.
Current State
- 54 pairs active on Hyperliquid
- 8 strategies (MR, TF, Breakout, FundingReversion, Momentum, VWAP, CascadeRecovery, OBVDivergence)
- 14 external data sources collected but MOST ARE UNUSED in decisions
- Order flow collected but observational only
- Funding divergence z-scores computed but not consumed
- ML feature extraction exists but model is mocked (weights.ml = 0.0)
- Regime detection exists but not weighted in decision scoring
Phase 1: Wire Existing Signals (HIGHEST ROI — data already collected)
1A. Drawdown-Dependent Quadratic Sizing
- What: Replace flat 0.75x drawdown penalty with quadratic curve
- Formula:
sizing_mult = 1.0 - 0.8 * (drawdown / criticalDD)^2, floor at 0.20
- Why: Linear penalty is too aggressive at small drawdowns, too lenient at large ones. Quadratic is proportional to actual pain (Chan framework).
- Impact: Better recovery from small drawdowns, faster circuit-breaking on large ones
- Effort: 30 min | File: risk-manager.ts
1B. Wire Fear & Greed as Macro Regime Filter
- What: Use Alternative.me Fear & Greed (already fetched) to modulate sizing
- Logic: Extreme Fear (<20) = boost MR entries by 15%. Extreme Greed (>80) = reduce all entries by 15%. Normal = no change.
- Why: Extreme readings are reliable contrarian signals over 1-4 week horizons (research-backed)
- Impact: ~5-10% edge on entries during extreme sentiment
- Effort: 30 min | File: signal-pipeline.ts
1C. Wire Funding Divergence Z-Score into Strategy Selection
- What: Already computed every 60s (720h rolling z-score). Use as conviction modifier.
- Logic: When z > 2.0 and signal is SHORT → boost 15%. When z < -2.0 and signal is LONG → boost 15%. When z opposes → reduce 10%.
- Why: 11.4% average divergence between HL and Binance. Structural alpha.
- Impact: Already partially integrated in signal-pipeline. Needs strengthening.
- Effort: 30 min | File: signal-pipeline.ts (already has partial hook)
1D. Wire Deribit DVOL as Volatility Regime Input
- What: BTC implied vol (DVOL) already fetched. Use to detect vol regime changes before realized vol catches up.
- Logic: DVOL rising sharply = incoming volatility → tighten SLs, reduce size. DVOL extremely low = vol expansion coming → prepare for breakouts.
- Why: Implied vol leads realized vol by hours to days
- Impact: Earlier regime detection, fewer surprise liquidations
- Effort: 45 min | File: regime-detector.ts, signal-pipeline.ts
1E. Wire CoinGlass Liquidation Data into TP Targeting
- What: Already fetched. Use aggregate liquidation volumes to set TP levels.
- Logic: Large liquidation clusters in our direction = extend TP (cascade incoming). Against our direction = tighten TP.
- Impact: Already partially integrated (liquidation-aware TP). Needs full CoinGlass integration.
- Effort: 30 min | Files: signal-pipeline.ts
Phase 2: Upgrade Existing Modules (HIGH ROI)
2A. Upgrade Order Flow to Full OFI (Cont-Kukanov-Stoikov)
- What: Replace simple bid/ask ratio with academic OFI formula
- Formula: Track L2 changes between snapshots, compute net flow per level
- Why: OFI alone = Sharpe 3.68 (beats 54-feature ML models). Our current ratio is a crude approximation.
- Impact: Dramatically better short-term direction prediction
- Effort: 2-3 hours | File: order-flow.ts
2B. Add CVD (Cumulative Volume Delta) Tracking
- What: Track aggressive buy vs sell volume from HL trades
- Why: CVD divergence from price = strong reversal signal. HL tags buyer/seller directly.
- Impact: New leading indicator for MR entries
- Effort: 2 hours | New module or extend order-flow.ts
2C. Add Funding Rate Velocity
- What: Track rate of change of funding, not just level
- Why: Sudden spikes predict reversals better than sustained high funding
- Impact: Sharper FundingReversion entries
- Effort: 1 hour | File: funding-divergence-collector.ts
2D. Upgrade Regime Detection with HMM
- What: 3-state Hidden Markov Model on returns + volatility
- Why: HMM captures regime persistence better than threshold-based detection
- Impact: More accurate regime classification, fewer false transitions
- Effort: 4 hours | File: regime-detector.ts (+ new HMM library)
2E. Add VPIN (Volume-Synchronized Probability of Informed Trading)
- What: Volume-bucketed buy/sell imbalance proxy
- Why: Predicts extreme price movements and flash crashes. Regime filter: >0.7 = momentum, <0.3 = reversion
- Impact: Better strategy routing
- Effort: 2 hours | File: order-flow.ts or new module
Phase 3: New Data Sources (MEDIUM ROI — need API integration)
3A. Stablecoin Supply Monitoring
- What: Track USDT/USDC supply changes, large mint/burn events
- Why: 95.24% correlation with BTC price. $250M+ mints precede buying by 24-72h.
- Source: CryptoQuant API (free tier) or on-chain monitoring
- Effort: 2-3 hours | File: external-data.ts
3B. Coinbase Premium Index
- What: BTC price on Coinbase vs global average
- Why: Institutional demand indicator. Negative streaks precede drops by 1-3 days.
- Source: CryptoQuant or computed from Coinbase + Binance APIs
- Effort: 1-2 hours | File: external-data.ts
3C. BTC-SPX Macro Correlation Tracker
- What: Rolling 30-day correlation between BTC and SPX/QQQ
- Why: BTC-QQQ correlation hit 0.87. When corr > 0.8, SPX direction dominates.
- Source: Yahoo Finance free API for SPX data
- Effort: 2 hours | File: external-data.ts
3D. Options Max Pain Integration
- What: Deribit BTC options max pain + OI concentration by strike
- Why: Price gravitates toward max pain in final 2-3 days before expiry
- Source: Deribit API (already have DVOL connection, extend)
- Effort: 2-3 hours | File: external-data.ts
Phase 4: ML Pipeline (TRANSFORMATIVE — needs foundation)
4A. Data Collection Pipeline
- What: Start storing all features + outcomes in DB for ML training
- Why: Need 30+ days of feature snapshots before XGBoost can train
- Impact: Foundation for everything in Phase 4
- Effort: 3-4 hours | New: data collection job
4B. XGBoost Direction Model
- What: Train gradient boosting on collected features for 15m direction prediction
- Why: XGBoost beats LSTM consistently (55.9% accuracy, Sharpe 1.78)
- Effort: 4-6 hours | Python: training script + ONNX export
4C. Enable ML Weight in Decision Engine
- What: Switch weights.ml from 0.0 to 0.3-0.5 once model is trained
- Why: ML captures non-linear relationships that rules-based strategies miss
- Effort: 1 hour | File: decision-engine.ts
4D. CPCV Backtesting Upgrade
- What: Replace 70/30 split with Combinatorial Purged Cross-Validation
- Why: CPCV proven superior to walk-forward for anti-overfitting (de Prado)
- Effort: 4-6 hours | Python: optimization pipeline upgrade
4E. DCC-GARCH Dynamic Correlation
- What: Replace static correlation clusters with DCC-GARCH
- Why: Crypto correlations are non-stationary. Static clusters fail during crashes.
- Effort: 4-6 hours | Python library + integration
4F. LLM Sentiment Pipeline
- What: Use CryptoPanic news (already fetched) with LLM for sentiment scoring
- Why: GPT sentiment = Sharpe 3.05 on news data
- Effort: 4-6 hours | File: llm-assessor.ts (extend)**
Priority Matrix
| Item | ROI/Hour | Effort | Impact | Dependencies |
|------|----------|--------|--------|-------------|
| 1A Quadratic DD | Very High | 30min | Medium | None |
| 1B Fear & Greed | Very High | 30min | Medium | None |
| 1C Funding Z-Score | Very High | 30min | High | None |
| 1D Deribit DVOL | High | 45min | Medium | None |
| 1E CoinGlass Liq | High | 30min | Medium | None |
| 2A Full OFI | Very High | 3h | Very High | None |
| 2B CVD | High | 2h | High | None |
| 2C Funding Velocity | High | 1h | Medium | None |
| 2D HMM Regime | Medium | 4h | High | None |
| 2E VPIN | Medium | 2h | Medium | None |
| 3A Stablecoin | Medium | 3h | High | API key |
| 3B Coinbase Premium | Medium | 2h | Medium | API |
| 4A Data Collection | Critical | 4h | Foundation | None |
| 4B XGBoost | High | 6h | Very High | 4A + 30 days data |
| 4F LLM Sentiment | Medium | 6h | High | API costs |
Implementation Order (Optimal Path)
- Phase 1 (all items) — 2-3 hours total, immediate impact
- 4A Data Collection — start ASAP, needs time to accumulate
- 2A Full OFI — single highest-impact upgrade
- 2B CVD — complements OFI
- 2C Funding Velocity — quick win
- 3A-3D New data sources — parallel work
- 2D HMM Regime — after data collection proves which regimes matter
- 4B-4F ML Pipeline — once 30+ days of features collected