How kalpa-iiits/autotrade-backend works
AutoTrade is a multi-user trading platform: users sign in, configure and log in to broker accounts, then monitor markets, place orders, run strategies, and review trades. Account runtimes isolate broker connections, order/tick streams, and ledgers per account. The README documents the product capabilities; source excerpts and the SOURCE INDEX support the internal links shown. Some route-to-runtime details are unsampled and are therefore not asserted.
Main entry points: db.py Application database · registry.py Account registry · router.py Account management · store.py Account store
Components 24
Identity and Accounts
- Sign-in and tokens
app/auth/api.py - Account management
app/accounts/router.py - Account store
app/accounts/store.py - Credential vault
app/accounts/vault.py - Broker auto-login
app/accounts/autologin.py
Account Runtime
- Account registry
app/accounts/registry.py - Broker service
app/core/broker_service.py - Broker factory
app/brokers/__init__.py - Broker adapters
app/brokers
Trading and Markets
- Orders and positions
app/orders/router.py - Market data
app/tickers/router.py - Order schemas
app/orders/schemas.py - Trade history
app/trades/router.py - Trade ledger
app/trades/ledger.py
Strategies
- Strategy management
app/strategies/router.py - Strategy runner
app/strategies/runner.py - Backtesting
app/strategies/backtest.py
Persistence
- Application database
app/core/db.py - Broker account records
app/accounts/models.py - User and API token records
app/auth/models.py - Order records
app/orders/models.py - Strategy records
app/strategies/models.py - Trade records
app/trades/models.py
Other components
- User
Connections 27
- User → Sign-in and tokens: signs in
- User → Account management: manages accounts
- User → Orders and positions: trades
- User → Market data: views prices
- User → Trade history: reviews trades
- User → Strategy management: runs strategies
- Account management → Account store: manages records
app/accounts/router.py - Account store → Credential vault: encrypts secrets
app/accounts/store.py - Account management → Broker auto-login: requests login
app/accounts/router.py - Account registry → Broker service: creates runtime service
app/accounts/registry.py - Broker service → Broker factory: builds broker
app/core/broker_service.py - Broker factory → Broker adapters: selects adapter
app/brokers/__init__.py - Orders and positions → Account registry: gets account runtime
app/orders/router.py - Orders and positions → Order schemas: uses order schemas
app/orders/router.py - Market data → Account registry: gets account runtime
app/tickers/router.py - Trade history → Trade ledger: reads ledger
app/trades/router.py - Account registry → Trade ledger: attaches per-account ledger
app/accounts/registry.py - Strategy management → Strategy runner: manages instances
app/strategies/router.py - Strategy runner → Broker service: uses account service
app/strategies/runner.py - Strategy management → Backtesting: runs backtests
app/strategies/router.py - Account store → Application database: persists accounts
app/accounts/store.py - Broker account records → Application database: defines table
app/accounts/models.py - User and API token records → Application database: defines tables
app/auth/models.py - Order records → Application database: defines table
app/orders/models.py - Strategy records → Application database: defines table
app/strategies/models.py - Trade records → Application database: defines table
app/trades/models.py - Trade ledger → Application database: records trades
app/trades/ledger.py