| <mxfile host="app.diagrams.net" modified="2026-02-06T12:30:00.000Z" agent="draw.io" version="21.0.0" type="device"> |
| <diagram name="DRL Trading System Architecture" id="trading-system"> |
| <mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1200" math="0" shadow="0"> |
| <root> |
| <mxCell id="0" /> |
| <mxCell id="1" parent="0" /> |
| |
| |
| <mxCell id="title" value="π€ DRL Trading System - Complete Architecture" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=24;fontStyle=1;fontColor=#1a1a1a;" vertex="1" parent="1"> |
| <mxGeometry x="400" y="20" width="600" height="40" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="data-sources-group" value="π‘ Data Sources" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=14;" vertex="1" parent="1"> |
| <mxGeometry x="40" y="80" width="200" height="400" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="binance-api" value="Binance API
(OHLCV + Futures)" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="data-sources-group"> |
| <mxGeometry x="20" y="50" width="160" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="binance-ls" value="Binance L/S Ratio
(Crowding Signal)" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="data-sources-group"> |
| <mxGeometry x="20" y="110" width="160" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="binance-oi" value="Binance OI
(Open Interest)" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="data-sources-group"> |
| <mxGeometry x="20" y="170" width="160" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="top-traders" value="Top Traders
(Smart Money)" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="data-sources-group"> |
| <mxGeometry x="20" y="230" width="160" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="fear-greed" value="Fear & Greed Index
(Sentiment)" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="data-sources-group"> |
| <mxGeometry x="20" y="290" width="160" height="50" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="features-group" value="π§ Feature Engineering" style="swimlane;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;fontSize=14;" vertex="1" parent="1"> |
| <mxGeometry x="280" y="80" width="220" height="400" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="ultimate-features" value="Ultimate Feature Engine
(125+ Features)" style="rounded=1;whiteSpace=wrap;fillColor=#e1d5e7;strokeColor=#9673a6;fontStyle=1;" vertex="1" parent="features-group"> |
| <mxGeometry x="20" y="50" width="180" height="60" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="technical" value="Technical Indicators
RSI, MACD, BB, ATR..." style="rounded=1;whiteSpace=wrap;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="features-group"> |
| <mxGeometry x="20" y="120" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="volatility" value="Volatility Analysis
ATR, HV, IV Proxy" style="rounded=1;whiteSpace=wrap;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="features-group"> |
| <mxGeometry x="20" y="170" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="whale-tracker" value="π Whale Tracker
(4 FREE Sources)" style="rounded=1;whiteSpace=wrap;fillColor=#ffe6cc;strokeColor=#d79b00;fontStyle=1;" vertex="1" parent="features-group"> |
| <mxGeometry x="20" y="225" width="180" height="55" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="correlation" value="Correlation Engine
Multi-Asset Signals" style="rounded=1;whiteSpace=wrap;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="features-group"> |
| <mxGeometry x="20" y="290" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="observation" value="Normalized Observation
(125 dims β Model)" style="rounded=1;whiteSpace=wrap;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;" vertex="1" parent="features-group"> |
| <mxGeometry x="20" y="345" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="brain-group" value="π§ DRL Brain" style="swimlane;startSize=30;fillColor=#f8cecc;strokeColor=#b85450;fontStyle=1;fontSize=14;" vertex="1" parent="1"> |
| <mxGeometry x="540" y="80" width="220" height="400" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="ppo-agent" value="PPO Agent
(Stable Baselines3)" style="rounded=1;whiteSpace=wrap;fillColor=#f8cecc;strokeColor=#b85450;fontStyle=1;" vertex="1" parent="brain-group"> |
| <mxGeometry x="20" y="50" width="180" height="60" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="policy-net" value="Policy Network
Ο(a|s) β Action Probs" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="brain-group"> |
| <mxGeometry x="20" y="120" width="180" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="value-net" value="Value Network
V(s) β State Value" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="brain-group"> |
| <mxGeometry x="20" y="180" width="180" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="action-output" value="Action Output
0=HOLD, 1=BUY, 2=SELL" style="rounded=1;whiteSpace=wrap;fillColor=#e1d5e7;strokeColor=#9673a6;fontStyle=1;" vertex="1" parent="brain-group"> |
| <mxGeometry x="20" y="250" width="180" height="50" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="vec-normalize" value="VecNormalize
Observation Scaling" style="rounded=1;whiteSpace=wrap;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="brain-group"> |
| <mxGeometry x="20" y="310" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="risk-group" value="β οΈ Risk Management" style="swimlane;startSize=30;fillColor=#ffe6cc;strokeColor=#d79b00;fontStyle=1;fontSize=14;" vertex="1" parent="1"> |
| <mxGeometry x="800" y="80" width="220" height="400" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="whale-filter" value="π Whale Filter
Block Bad Trades" style="rounded=1;whiteSpace=wrap;fillColor=#ffe6cc;strokeColor=#d79b00;fontStyle=1;" vertex="1" parent="risk-group"> |
| <mxGeometry x="20" y="50" width="180" height="55" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="stop-loss" value="Stop Loss
1.5% Max Loss" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="risk-group"> |
| <mxGeometry x="20" y="115" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="take-profit" value="Take Profit
2.5% Target" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="risk-group"> |
| <mxGeometry x="20" y="170" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="circuit-breaker" value="Circuit Breaker
5% Daily Loss Limit" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="risk-group"> |
| <mxGeometry x="20" y="225" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="cooldown" value="Trade Cooldown
30min Min Hold" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="risk-group"> |
| <mxGeometry x="20" y="280" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="position-size" value="Position Sizing
50% of Balance" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="risk-group"> |
| <mxGeometry x="20" y="335" width="180" height="45" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="execution-group" value="π° Trade Execution" style="swimlane;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;fontSize=14;" vertex="1" parent="1"> |
| <mxGeometry x="1060" y="80" width="200" height="400" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="live-trading" value="Live Trading Agent
(live_trading.py)" style="rounded=1;whiteSpace=wrap;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;" vertex="1" parent="execution-group"> |
| <mxGeometry x="15" y="50" width="170" height="55" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="dry-run" value="π§ͺ Dry Run Mode
Simulated Trades" style="rounded=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="execution-group"> |
| <mxGeometry x="15" y="115" width="170" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="open-position" value="Open Position
LONG / SHORT" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="execution-group"> |
| <mxGeometry x="15" y="170" width="170" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="close-position" value="Close Position
+ P&L Calculation" style="rounded=1;whiteSpace=wrap;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="execution-group"> |
| <mxGeometry x="15" y="225" width="170" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="state-persist" value="State Persistence
trading_state.json" style="rounded=1;whiteSpace=wrap;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="execution-group"> |
| <mxGeometry x="15" y="280" width="170" height="45" as="geometry" /> |
| </mxCell> |
| |
| <mxCell id="trade-log" value="Trade Log
trades.csv" style="rounded=1;whiteSpace=wrap;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="execution-group"> |
| <mxGeometry x="15" y="335" width="170" height="45" as="geometry" /> |
| </mxCell> |
| |
| |
| |
| <mxCell id="arrow1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;curved=1;strokeWidth=2;strokeColor=#6c8ebf;" edge="1" parent="1"> |
| <mxGeometry relative="1" as="geometry"> |
| <mxPoint x="240" y="200" as="sourcePoint" /> |
| <mxPoint x="280" y="200" as="targetPoint" /> |
| </mxGeometry> |
| </mxCell> |
| <mxCell id="arrow1-label" value="Market Data" style="text;html=1;align=center;verticalAlign=middle;fontSize=10;fontColor=#6c8ebf;" vertex="1" parent="1"> |
| <mxGeometry x="240" y="175" width="60" height="20" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="arrow2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;curved=1;strokeWidth=2;strokeColor=#82b366;" edge="1" parent="1"> |
| <mxGeometry relative="1" as="geometry"> |
| <mxPoint x="500" y="280" as="sourcePoint" /> |
| <mxPoint x="540" y="280" as="targetPoint" /> |
| </mxGeometry> |
| </mxCell> |
| <mxCell id="arrow2-label" value="125 Features" style="text;html=1;align=center;verticalAlign=middle;fontSize=10;fontColor=#82b366;" vertex="1" parent="1"> |
| <mxGeometry x="500" y="255" width="60" height="20" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="arrow3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;curved=1;strokeWidth=2;strokeColor=#b85450;" edge="1" parent="1"> |
| <mxGeometry relative="1" as="geometry"> |
| <mxPoint x="760" y="280" as="sourcePoint" /> |
| <mxPoint x="800" y="280" as="targetPoint" /> |
| </mxGeometry> |
| </mxCell> |
| <mxCell id="arrow3-label" value="Action" style="text;html=1;align=center;verticalAlign=middle;fontSize=10;fontColor=#b85450;" vertex="1" parent="1"> |
| <mxGeometry x="760" y="255" width="50" height="20" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="arrow4" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;curved=1;strokeWidth=2;strokeColor=#d79b00;" edge="1" parent="1"> |
| <mxGeometry relative="1" as="geometry"> |
| <mxPoint x="1020" y="280" as="sourcePoint" /> |
| <mxPoint x="1060" y="280" as="targetPoint" /> |
| </mxGeometry> |
| </mxCell> |
| <mxCell id="arrow4-label" value="Filtered" style="text;html=1;align=center;verticalAlign=middle;fontSize=10;fontColor=#d79b00;" vertex="1" parent="1"> |
| <mxGeometry x="1020" y="255" width="50" height="20" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="whale-detail" value="π Whale Tracker (4 Sources)
βββββββββββββββββββββ
1. Binance L/S (25%) - Crowding
2. OI Trend (25%) - Smart Money
3. Top Traders (25%) - Positioning
4. Fear/Greed (25%) - Sentiment
βββββββββββββββββββββ
Confidence β₯50% β HIGH
2+ Signals Agree β Block Trades" style="shape=note;whiteSpace=wrap;strokeColor=#d79b00;fillColor=#fff2cc;align=left;verticalAlign=top;spacingLeft=10;fontSize=11;" vertex="1" parent="1"> |
| <mxGeometry x="40" y="510" width="240" height="160" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="loop-detail" value="π Trading Loop (Every 30 min)
βββββββββββββββββββββ
1. Fetch latest 720 candles
2. Compute 125 features
3. Get whale signals (4 sources)
4. Model predicts action
5. Whale filter checks confidence
6. Risk checks (SL/TP/Circuit)
7. Execute or block trade
8. Log and persist state" style="shape=note;whiteSpace=wrap;strokeColor=#82b366;fillColor=#d5e8d4;align=left;verticalAlign=top;spacingLeft=10;fontSize=11;" vertex="1" parent="1"> |
| <mxGeometry x="300" y="510" width="240" height="160" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="signal-legend" value="π Signal Interpretation
βββββββββββββββββββββ
Score > +0.15 β BULLISH
Score < -0.15 β BEARISH
Otherwise β NEUTRAL
βββββββββββββββββββββ
HIGH CONF + Bearish β Block LONG
HIGH CONF + Bullish β Block SHORT
LOW CONF β Allow all trades" style="shape=note;whiteSpace=wrap;strokeColor=#9673a6;fillColor=#e1d5e7;align=left;verticalAlign=top;spacingLeft=10;fontSize=11;" vertex="1" parent="1"> |
| <mxGeometry x="560" y="510" width="240" height="160" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="status-box" value="β
Current Status
βββββββββββββββββββββ
Mode: DRY-RUN
Position: LONG
Return: +1.0%
Confidence: 50% (HIGH)
βββββββββββββββββββββ
Whale Filter: ACTIVE" style="shape=note;whiteSpace=wrap;strokeColor=#82b366;fillColor=#d5e8d4;align=left;verticalAlign=top;spacingLeft=10;fontSize=11;fontStyle=1;" vertex="1" parent="1"> |
| <mxGeometry x="820" y="510" width="200" height="160" as="geometry" /> |
| </mxCell> |
| |
| |
| <mxCell id="files-box" value="π Key Files
βββββββββββββββββββββ
live_trading.py - Main loop
src/brain/agent.py - PPO agent
src/features/ultimate_features.py
src/features/whale_tracker.py
src/backtest/data_loader.py
config/config.yaml" style="shape=note;whiteSpace=wrap;strokeColor=#6c8ebf;fillColor=#dae8fc;align=left;verticalAlign=top;spacingLeft=10;fontSize=11;" vertex="1" parent="1"> |
| <mxGeometry x="1040" y="510" width="220" height="160" as="geometry" /> |
| </mxCell> |
| |
| </root> |
| </mxGraphModel> |
| </diagram> |
| </mxfile> |
|
|