Architecture
High-Level Flow
Market Data (Hyperliquid API)
│
▼
┌─────────────────────────┐
│ OHLCV + Order Book │◄──── Coinglass On-Chain Data
│ Multi-Timeframe │ (OI, Funding, LSR, Liquidations)
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Market Regime Detector │ ──► 9 States (Strong Trend, Ranging, Volatile...)
│ + Adaptive Parameters │
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Strategy Engine │ ──► 13+ Strategies run in parallel
│ (Confluence-based) │ Each generates scored signals
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Signal Quality Pipeline │
│ ┌───────────────┐ │
│ │ Tier 2 Quality│ │ ──► Quality filters, R:R validation
│ │ ML Filter │ │ ──► Gradient Boosted decision
│ │ Correlation │ │ ──► Portfolio exposure check
│ │ Tiered Conf. │ │ ──► Confidence erosion protection
│ │ Entry Timing │ │ ──► Candle close, chase detection
│ └───────────────┘ │
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ AI Validation │ ──► Claude AI evaluates thesis
│ (ECTRA AI v2.0) │ APPROVE / ADJUST / REJECT
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Risk Manager │ ──► Position sizing, leverage calc
│ + Feature Gate │ Tier-based access control
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Execution Engine │ ──► Hyperliquid order placement
│ (execute.py) │ 5-sig-fig price rounding
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Position Management │
│ ┌───────────────┐ │
│ │ ATR Trailing │ │ ──► Volatility-based trail
│ │ Smart S/R │ │ ──► Ichimoku + Pivot S/R trail
│ │ CG Trailing │ │ ──► Coinglass-intelligence trail
│ │ Thesis Monitor│ │ ──► Continuous thesis validation
│ └───────────────┘ │
└─────────┬───────────────┘
│
▼
┌─────────────────────────┐
│ Telegram + Persistence │ ──► Alerts, commands, trade journal
│ + Trading Metrics │ SQLite state persistence
└─────────────────────────┘Module Map (64 Files)
Core Engine
Module
Purpose
Strategy Modules
Module
Strategy
Category
Analysis & Intelligence
Module
Purpose
AI & Machine Learning
Module
Purpose
Risk & Quality
Module
Purpose
Trailing Stop Systems
Module
Purpose
Interface & Infrastructure
Module
Purpose