How zero-was-here/tradingbot works
This repository is an XAUUSD deep-reinforcement-learning trading system. Its main workflow gathers market and event data, builds multi-timeframe and macro features, trains or evaluates a policy in a trading environment, then uses live adapters for broker execution. The README also describes risk controls, backtesting, sentiment, and production monitoring. Some subsystems are documented but their wiring is not visible in the sampled source, so uncertain call relationships are omitted.
Main entry points: god_mode_features.py Multi-source features · live_trade_mt5.py MT5 live adapter · live_trade_metaapi.py MetaAPI live adapter · train_dreamer.py Dreamer training
Components 23
Market data
- Market data loading
data/load_data.py - Macro data fetching
data/fetch_correlations.py - Macro data merging
data/merge_macro.py - Sentiment analysis
data/sentiment_analysis.py - Economic calendar
data/economic_calendar.py
Features and policy
- Feature engineering
features/make_features.py - Multi-source features
features/god_mode_features.py - Macro features
features/macro_features.py - Dreamer agent
models/dreamer_agent.py - PPO policy
train/train_ppo.py - Position and risk controls
models/risk_supervisor.py
Simulation and validation
- Trading environment
env/xauusd_env.py - Execution cost model
env/realistic_execution.py - Dreamer training
train/train_dreamer.py - Backtesting
backtest/backtest_engine.py - Model evaluation
evaluate_model.py - Crisis validation
eval/crisis_validation.py
Live operations
- MT5 live adapter
live_trade_mt5.py - MetaAPI live adapter
live_trade_metaapi.py - Production monitoring
monitoring/production_monitor.py
Other components
- Trader / operator
- Market data sources
- Trading broker
Connections 28
- Trader / operator → Dreamer training: starts training
- Trader / operator → Model evaluation: requests evaluation
- Trader / operator → MT5 live adapter: starts live trading
- Trader / operator → MetaAPI live adapter: starts live trading
- Market data sources → Market data loading: provides prices
- Market data sources → Macro data fetching: provides macro data
- Market data loading → Feature engineering: supplies market data
- Macro data fetching → Macro data merging: supplies macro data
- Macro data merging → Macro features: supplies merged data
- Sentiment analysis → Feature engineering: provides sentiment
- Economic calendar → Multi-source features: provides event features
- Feature engineering → Multi-source features: builds feature set
- Macro features → Multi-source features: adds macro signals
- Multi-source features → Dreamer training: supplies training features
- Dreamer training → Trading environment: trains through
- Dreamer training → Dreamer agent: updates agent
- PPO policy → Trading environment: trains through
- Backtesting → Trading environment: simulates trades
- Trading environment → Execution cost model: models fill costs
- Model evaluation → Multi-source features: loads feature set
- Model evaluation → Dreamer agent: evaluates agent
- Crisis validation → Dreamer agent: tests agent
- MT5 live adapter → Trading broker: sends orders
- MetaAPI live adapter → Trading broker: sends orders
- MT5 live adapter → Position and risk controls: applies risk controls
- MetaAPI live adapter → Position and risk controls: applies risk controls
- MT5 live adapter → Production monitoring: reports live state
- MetaAPI live adapter → Production monitoring: reports live state