How collomut/trading-lab-bot works
Trading Lab is a crypto-market research and paper/Testnet trading application, with live order placement explicitly disabled. Its principal workflow is a CLI or dashboard-started worker that fetches market candles, evaluates strategy signals, applies risk controls, and submits protected orders; state and trade history are persisted. Separate research scripts run historical strategy evaluations. The graph follows documented capabilities and shown references; some unsampled implementation details and dashboard routes are not expanded.
Main entry points: dashboard.py Web dashboard · bot_engine.py Trading cycle · main.py CLI entrypoint · exchange.py Exchange connector
Components 25
Trading runtime
- CLI entrypoint
main.py - Configuration
config.py - Trading cycle
bot_engine.py - Signal strategies
strategies.py - Shadow candidate
shadow_strategy.py - Exchange connector
exchange.py
Risk and state
- Risk manager
risk_manager.py - SQLite state
state_store.py - Postgres state
postgres_state_store.py - Startup wrapper
start.py - SQLite import
migrate_sqlite_to_postgres.py
Dashboard
- Web dashboard
dashboard.py - Overview view
templates/overview.html - History view
templates/history.html - Logs view
templates/logs.html - Positions view
templates/positions.html - Strategy view
templates/strategy.html
Strategy research
- Backtest engine
research/backtest_strategy.py - Frequency analysis
research/backtest_frequency.py - Macro Donchian study
research/backtest_macro_donchian.py
Other components
- Operator
- Binance Testnet
- Dashboard user
- Researcher
- Historical candles
Connections 28
- Operator → CLI entrypoint: runs
README.md - CLI entrypoint → Configuration: loads
main.py - CLI entrypoint → Trading cycle: starts
main.py - CLI entrypoint → Web dashboard: starts
main.py - Trading cycle → Exchange connector: fetches candles
bot_engine.py - Trading cycle → Signal strategies: evaluates signals
bot_engine.py - Trading cycle → Shadow candidate: evaluates candidate
bot_engine.py - Trading cycle → Risk manager: checks risk
bot_engine.py - Trading cycle → Exchange connector: submits orders
bot_engine.py - Exchange connector → Binance Testnet: requests market and orders
exchange.py - Risk manager → SQLite state: persists state
risk_manager.py - Risk manager → Postgres state: persists state
risk_manager.py - Startup wrapper → SQLite import: checks import
README.md - SQLite import → Postgres state: imports SQLite
migrate_sqlite_to_postgres.py - Startup wrapper → Web dashboard: starts dashboard worker
README.md - Dashboard user → Web dashboard: views and controls
dashboard.py - Web dashboard → Trading cycle: reads bot status
dashboard.py - Web dashboard → Exchange connector: requests balance
dashboard.py - Web dashboard → Overview view: renders
- Web dashboard → History view: renders
- Web dashboard → Logs view: renders
- Web dashboard → Positions view: renders
- Web dashboard → Strategy view: renders
- Researcher → Frequency analysis: runs study
research/backtest_frequency.py - Researcher → Macro Donchian study: runs study
research/backtest_macro_donchian.py - Frequency analysis → Backtest engine: uses replay
research/backtest_frequency.py - Macro Donchian study → Backtest engine: uses replay
research/backtest_macro_donchian.py - Backtest engine → Historical candles: replays candles