How xenon110/katanaquant works
KatanaQuant is an automated stock-and-ETF trading system whose principal workflow turns market bars into a proposed trade, subjects it to a deterministic safety gate, and routes approved orders to a broker before reconciling and recording execution. It also provides historical backtesting, a dashboard/API, scheduling, and optional notifications. The README documents the major pipeline stages; source-index references and excerpts support the central orchestration and execution links. Some integrations and web routes were not fully sampled, so uncertain connections are omitted or marked unverified.
Main entry points: app.py Dashboard API · main.py CLI Entry Point · broker_client.py Broker Interface · pipeline.py Trade Orchestrator
Components 24
Market Inputs
- Market Data
src/data/market_data.py - Live Bar Stream
src/data/alpaca_stream.py - Technical Indicators
src/data/indicators.py
Trade Analysis
- Quantitative Rules
src/strategy/rules.py - AI Advisor
src/strategy/ai_advisor.py - Specialist Agents
src/agents - Agent Framework
src/agents/base.py - Trade Orchestrator
src/orchestrator/pipeline.py
Safety and Execution
- Deterministic Risk Gate
src/risk/gate.py - T+1 / PDT Reconciliation
src/reconciliation/service.py - Broker Interface
src/execution/broker_client.py - Alpaca Broker
src/execution/alpaca_broker.py - Dry-Run Broker
src/execution/dry_run_broker.py - Autonomous Trading
src/execution/autonomous_trader.py
Records and Operations
- SQLite Audit Store
src/storage/database.py - Supabase Storage
src/storage/supabase_client.py - Backtesting Engine
src/backtesting/engine.py - Market Scheduler
src/scheduling/market_scheduler.py
User Interfaces
- Dashboard API
src/web/app.py - CLI Entry Point
src/main.py - Telegram Alerts
src/notifications/telegram.py
Other components
- Trader / Operator
- Broker Service
- LLM Provider
Connections 31
- Trader / Operator → CLI Entry Point: runs commands
README.md - Trader / Operator → Dashboard API: uses dashboard
src/web/app.py - CLI Entry Point → Market Data: fetches bars
src/main.py - Market Data → Live Bar Stream: streams bars
- Market Data → Quantitative Rules: supplies bars
README.md - Quantitative Rules → Technical Indicators: uses indicators
src/strategy/rules.py - Quantitative Rules → Trade Orchestrator: provides signal
src/orchestrator/pipeline.py - Trade Orchestrator → Specialist Agents: invokes agents
src/orchestrator/pipeline.py - Specialist Agents → Agent Framework: uses framework
src/agents/base.py - Agent Framework → LLM Provider: requests analysis
src/agents/base.py - Trade Orchestrator → Deterministic Risk Gate: routes proposal
src/orchestrator/pipeline.py - CLI Entry Point → Trade Orchestrator: runs pipeline
src/main.py - Deterministic Risk Gate → Broker Interface: authorizes order
README.md - Broker Interface → Alpaca Broker: implements interface
src/execution/alpaca_broker.py - Broker Interface → Dry-Run Broker: implements interface
src/execution/dry_run_broker.py - Alpaca Broker → Broker Service: submits orders
- Dry-Run Broker → Broker Service: simulates orders
- CLI Entry Point → Broker Interface: routes approved orders
src/main.py - Dashboard API → Deterministic Risk Gate: validates orders
src/web/app.py - Dashboard API → Broker Interface: submits orders
src/web/app.py - Autonomous Trading → Broker Interface: controls trading
- Broker Interface → T+1 / PDT Reconciliation: provides fills
- T+1 / PDT Reconciliation → Deterministic Risk Gate: supplies account state
- CLI Entry Point → T+1 / PDT Reconciliation: reconciles account
src/main.py - CLI Entry Point → SQLite Audit Store: records orders
src/main.py - Dashboard API → SQLite Audit Store: uses audit store
src/web/app.py - Dashboard API → Supabase Storage: uses cloud storage
src/web/app.py - CLI Entry Point → Backtesting Engine: runs backtest
src/main.py - Dashboard API → Backtesting Engine: runs backtest
src/web/app.py - Market Scheduler → Dashboard API: supports scheduling
src/web/app.py - Dashboard API → Telegram Alerts: sends alerts
src/web/app.py