How enarjord/passivbot works
Passivbot is a cryptocurrency perpetual-futures trading system. A user invokes the CLI with configuration; configuration is loaded and compiled, market data and account state are gathered from exchange adapters, and the shared Rust orchestrator computes entries, re-entries, trailing/grid closes, risk actions, and protective orders. Live execution submits and reconciles orders, while the same orchestration supports backtests and evolutionary optimization. OHLCV, fills, events, and monitoring provide durable analysis. Some live wiring is inferred from documented capabilities and directory structure because sampled excerpts are partial.
Main entry points: passivbot.py Live Runtime · orchestrator.rs Rust Order Orchestrator · ccxt_bot.py Exchange Adapters · optimize.py Evolutionary Optimizer
Components 24
Configuration & Strategies
- CLI Dispatch
src/passivbot_cli/main.py - Config Pipeline
src/config/load.py - Strategy Engine
passivbot-rust/src/strategies/mod.rs - Rust Order Orchestrator
passivbot-rust/src/orchestrator.rs - Forager Selection
passivbot-rust/src/coin_selection.rs
Live Trading
- Live Runtime
src/passivbot.py - Live Market Data
src/live/market_data.py - Order Executor
src/live/executor.py - State Reconciler
src/live/reconciler.py - Risk Controls
src/live/hsl_protection.py - Exchange Adapters
src/exchanges/ccxt_bot.py
Market Data
- OHLCV Acquisition
src/ohlcv_download.py - OHLCV Store
src/ohlcv_store.py - Fill Event Cache
src/fill_events_manager.py
Backtesting & Optimization
- Backtest Engine
src/backtest.py - Backtest Datasets
src/backtest_dataset.py - Evolutionary Optimizer
src/optimize.py - GPU Evaluation
src/optimization/backends/gpu_backend.py - Pareto Results
src/pareto_store.py
Events & Monitoring
- Live Event Bus
src/live/event_bus.py - Monitoring Interfaces
src/monitor_web.py - Event Query
src/tools/live_event_query.py
Other components
- Trader
- Exchange APIs
Connections 26
- Trader → CLI Dispatch: invokes
- CLI Dispatch → Config Pipeline: loads config
- CLI Dispatch → Live Runtime: starts live
- Config Pipeline → Rust Order Orchestrator: provides inputs
- Rust Order Orchestrator → Strategy Engine: computes strategy
- Rust Order Orchestrator → Forager Selection: selects markets
- Live Runtime → Live Market Data: requests data
- Live Market Data → Exchange Adapters: fetches streams
- Live Runtime → Rust Order Orchestrator: plans orders
- Live Runtime → Risk Controls: applies controls
- Live Runtime → Order Executor: dispatches orders
- Order Executor → Exchange Adapters: submits orders
- State Reconciler → Exchange Adapters: reads account state
- Live Runtime → State Reconciler: reconciles state
- Exchange Adapters → Fill Event Cache: returns fills
- Live Runtime → Live Event Bus: emits events
- Live Event Bus → Monitoring Interfaces: publishes status
- Event Query → Live Event Bus: queries events
- OHLCV Acquisition → Exchange Adapters: downloads candles
- OHLCV Acquisition → OHLCV Store: stores candles
- Backtest Datasets → OHLCV Store: reads candles
- Backtest Engine → Backtest Datasets: loads datasets
- Backtest Engine → Rust Order Orchestrator: plans orders
- Evolutionary Optimizer → Backtest Engine: evaluates candidates
- Evolutionary Optimizer → GPU Evaluation: accelerates evaluation
- Evolutionary Optimizer → Pareto Results: stores frontiers