How amitc3353/quantai works
QuantAI is an autonomous, cron-driven options-trading system with deterministic safety controls, broker execution, and operator alerts. The main workflow is scheduled agent evaluation, risk gating, broker order handling, and journal-based monitoring and learning. The README also describes Beta, Gamma, Sentinel, and a 13-state lifecycle; these are represented using the listed source tree, though their implementation details were not sampled. Legacy capabilities are grouped separately. Edges reflect README statements or shown references; unsampled subsystems are not given speculative internal call chains.
Main entry points: orchestrator Legacy trading agents · scripts Deterministic gates · broker.py Broker adapter · journal_io.py Append-only journal
Components 31
Trading agents
- Entry pipeline
v2/shared-data/scripts/run_pipeline.py - Alpha agent
v2/shared-data/scripts/run_pipeline.py - Beta agent
v2/shared-data/scripts/beta_agent.py - Regime and strategies
v2/shared-data/scripts/beta - Gamma agent
v2/shared-data/scripts/gamma_agent.py - Gamma scanner
v2/shared-data/scripts/gamma - Sentinel agent
v2/shared-data/scripts/sentinel_agent.py
Safety and execution
- Deterministic gates
v2/shared-data/scripts - Agent risk engines
v2/shared-data/scripts/beta/risk_engine.py - Broker adapter
v2/shared-data/scripts/broker.py
Trade state
- Append-only journal
v2/shared-data/scripts/lifecycle/journal_io.py - Order lifecycle FSM
v2/shared-data/scripts/lifecycle/trade_lifecycle.py - Position monitor
v2/shared-data/scripts/position_monitor.py
Operations and learning
- Market intelligence
v2/shared-data/scripts/market_intelligence.py - LLM call layer
v2/shared-data/scripts/_llm_call.py - Discord alerts
v2/shared-data/scripts/_discord.py - Learning and review
v2/shared-data/scripts
Legacy system
- Legacy trading agents
legacy/orchestrator - Legacy scheduler
legacy/orchestrator/scheduler.py - Legacy trade context
legacy/services/context_builder.py - Legacy market data
legacy/services/market_data.py - Legacy flow analysis
legacy/services/flow_detector.py - Legacy trading memory
legacy/discord-bot/memory.py - Legacy Alpaca client
legacy/discord-bot/alpaca_client.py - Legacy research services
legacy/services - Legacy Discord bot
legacy/discord-bot - Legacy guard service
legacy/guard-engine/guards.py
Other components
- Operator
- IBKR broker
- Alpaca broker
- LLM ingress
Connections 32
- Operator → Discord alerts: approves and receives
- Entry pipeline → Alpha agent: runs entries
v2/shared-data/scripts/run_pipeline.py - Alpha agent → Deterministic gates: submits candidates
v2/shared-data/scripts/run_pipeline.py - Beta agent → Deterministic gates: submits candidates
- Gamma agent → Deterministic gates: submits candidates
- Beta agent → Regime and strategies: classifies and selects
- Gamma agent → Gamma scanner: scans candidates
- Deterministic gates → Agent risk engines: checks risk
- Deterministic gates → Broker adapter: clears orders
- Broker adapter → IBKR broker: routes orders
- Broker adapter → Alpaca broker: fallback routes
- Broker adapter → Append-only journal: records trades
- Append-only journal → Position monitor: reconciles positions
- Append-only journal → Learning and review: feeds learning
v2/shared-data/scripts/lifecycle/trade_lifecycle.py - Order lifecycle FSM → Append-only journal: reads and writes
v2/shared-data/scripts/lifecycle/trade_lifecycle.py - Order lifecycle FSM → IBKR broker: checks broker state
- Sentinel agent → Position monitor: reads health
- Entry pipeline → Market intelligence: reads conditions
v2/shared-data/scripts/run_pipeline.py - Alpha agent → LLM call layer: requests judgment
- LLM call layer → LLM ingress: routes metered calls
- LLM call layer → Discord alerts: reports usage
v2/shared-data/scripts/_llm_call.py - Sentinel agent → LLM call layer: requests triage
- Learning and review → Discord alerts: sends summaries
v2/shared-data/scripts/run_pipeline.py - Legacy scheduler → Legacy trading agents: schedules agents
legacy/orchestrator/scheduler.py - Legacy scheduler → Legacy trade context: requests context
legacy/orchestrator/scheduler.py - Legacy scheduler → Legacy research services: uses research services
legacy/orchestrator/scheduler.py - Legacy trading agents → Legacy market data: reads market data
legacy/orchestrator/agent1_iron_condor.py - Legacy trading agents → Legacy flow analysis: reads options flow
legacy/orchestrator/agent1_iron_condor.py - Legacy trading agents → Legacy trading memory: retrieves lessons
legacy/orchestrator/agent2_covered_call.py - Legacy trading agents → Legacy Alpaca client: executes trades
- Legacy trading agents → Legacy guard service: checks proposals
- Legacy Discord bot → Legacy trading memory: uses trade memory
legacy/discord-bot/cogs/trading.py