# boreddyravikanthreddy35-lang/trading-ai-bot architecture

> Architecture diagram of the GitHub repository boreddyravikanthreddy35-lang/trading-ai-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/boreddyravikanthreddy35-lang/trading-ai-bot
- Repository: https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot

## Overview

SignalForge is an AI crypto-trading platform spanning market analysis, automated and paper trading, portfolio management, and wallet operations. The principal workflow enters through the FastAPI server, reaches a domain API, and delegates to trading or analysis services; wallet balances and financial events are handled by wallet and ledger services. The server configures database backends, and authentication supports protected user workflows. The README contains no product documentation, and many listed modules were not sampled, so only relationships shown in excerpts or the source index are drawn; frontend-to-backend links are omitted where not evidenced.

Main entry points: [`backend/server.py`](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/server.py) (FastAPI server), [`backend/api/ai.py`](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/ai.py) (AI signals API), [`backend/api/market.py`](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/market.py) (Market API), [`backend/api/backtest.py`](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/backtest.py) (Backtest API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and identity"]
  node_server["FastAPI server<br/>[server.py]"]
  node_authroutes["Authentication routes<br/>[auth_routes.py]"]
  node_auth["JWT authentication<br/>[auth.py]"]
end

subgraph group_trading["Trading and analysis"]
  node_marketapi["Market API<br/>[market.py]"]
  node_marketdata["Market data<br/>[market_data.py]"]
  node_indicators["Technical indicators<br/>[indicators.py]"]
  node_aiapi["AI signals API<br/>[ai.py]"]
  node_aisignals["AI signal service<br/>[ai_signals.py]"]
  node_backtestapi["Backtest API<br/>[backtest.py]"]
  node_backtest["Backtest engine<br/>[backtest.py]"]
  node_paperapi["Paper trading API<br/>[paper.py]"]
  node_autoapi["Auto-trader API<br/>[auto_trader.py]"]
  node_auto["AI auto-trader<br/>[auto_ai_trader.py]"]
  node_continuous["Continuous trader"]
end

subgraph group_portfolio["Portfolio and finance"]
  node_portfolioapi["Portfolio manager API"]
  node_autonomous["Autonomous portfolio"]
  node_walletapi["Wallet API<br/>[wallet.py]"]
  node_wallet["Wallet service<br/>[wallet_service.py]"]
  node_ledger["Double-entry ledger<br/>[ledger_service.py]"]
  node_risk["Pre-trade risk<br/>[risk_engine.py]"]
  node_positions["Position tracking"]
end

subgraph group_persistence["Persistence"]
  node_database[("Configured database<br/>[supabase_db.py]")]
  node_firebase[("Firebase adapter<br/>[firebase_db.py]")]
end

node_user(("User"))

node_user -.->|"requests API"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_marketapi
node_server -->|"mounts routes"| node_aiapi
node_server -->|"mounts routes"| node_backtestapi
node_server -->|"mounts routes"| node_paperapi
node_server -->|"mounts routes"| node_autoapi
node_server -->|"mounts routes"| node_portfolioapi
node_server -->|"mounts routes"| node_walletapi
node_authroutes -->|"uses"| node_auth
node_marketapi -->|"fetches market data"| node_marketdata
node_marketapi -->|"uses indicators"| node_indicators
node_aiapi -->|"fetches market data"| node_marketdata
node_aiapi -->|"requests signals"| node_aisignals
node_aiapi -->|"uses indicators"| node_indicators
node_backtestapi -->|"fetches market data"| node_marketdata
node_backtestapi -->|"runs backtest"| node_backtest
node_autoapi -->|"invokes trader"| node_auto
node_portfolioapi -->|"runs cycle"| node_autonomous
node_walletapi -->|"reads balances"| node_wallet
node_walletapi -->|"reads history"| node_ledger
node_wallet -->|"posts deposits"| node_ledger
node_risk -->|"checks balance"| node_wallet
node_server -->|"configures backend"| node_database
node_server -->|"selects optionally"| node_firebase

click node_server "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/server.py"
click node_authroutes "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/auth_routes.py"
click node_auth "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/auth.py"
click node_marketapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/market.py"
click node_marketdata "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/market_data.py"
click node_indicators "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/indicators.py"
click node_aiapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/ai.py"
click node_aisignals "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/ai_signals.py"
click node_backtestapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/backtest.py"
click node_backtest "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/backtest.py"
click node_paperapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/paper.py"
click node_autoapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/auto_trader.py"
click node_auto "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/auto_ai_trader.py"
click node_continuous "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/continuous_trader.py"
click node_portfolioapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/portfolio_manager.py"
click node_autonomous "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/autonomous_portfolio.py"
click node_walletapi "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/wallet.py"
click node_wallet "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/wallet_service.py"
click node_ledger "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/ledger_service.py"
click node_risk "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/risk_engine.py"
click node_positions "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/position_service.py"
click node_database "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/supabase_db.py"
click node_firebase "https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/firebase_db.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_authroutes,node_auth,node_user toneBlue
class node_marketapi,node_marketdata,node_indicators,node_aiapi,node_aisignals,node_backtestapi,node_backtest,node_paperapi,node_autoapi,node_auto,node_continuous toneAmber
class node_portfolioapi,node_autonomous,node_walletapi,node_wallet,node_ledger,node_risk,node_positions toneMint
class node_database,node_firebase toneRose
```

## Components

### API and identity

- [FastAPI server](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/server.py): `backend/server.py`
- [Authentication routes](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/auth_routes.py): `backend/api/auth_routes.py`
- [JWT authentication](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/auth.py): `backend/services/auth.py`

### Trading and analysis

- [Market API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/market.py): `backend/api/market.py`
- [Market data](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/market_data.py): `backend/services/market_data.py`
- [Technical indicators](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/indicators.py): `backend/services/indicators.py`
- [AI signals API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/ai.py): `backend/api/ai.py`
- [AI signal service](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/ai_signals.py): `backend/services/ai_signals.py`
- [Backtest API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/backtest.py): `backend/api/backtest.py`
- [Backtest engine](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/backtest.py): `backend/services/backtest.py`
- [Paper trading API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/paper.py): `backend/api/paper.py`
- [Auto-trader API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/auto_trader.py): `backend/api/auto_trader.py`
- [AI auto-trader](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/auto_ai_trader.py): `backend/services/auto_ai_trader.py`
- [Continuous trader](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/continuous_trader.py): `backend/services/continuous_trader.py`

### Portfolio and finance

- [Portfolio manager API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/portfolio_manager.py): `backend/api/portfolio_manager.py`
- [Autonomous portfolio](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/autonomous_portfolio.py): `backend/services/autonomous_portfolio.py`
- [Wallet API](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/api/wallet.py): `backend/api/wallet.py`
- [Wallet service](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/wallet_service.py): `backend/services/wallet_service.py`
- [Double-entry ledger](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/ledger_service.py): `backend/services/ledger_service.py`
- [Pre-trade risk](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/risk_engine.py): `backend/services/risk_engine.py`
- [Position tracking](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/position_service.py): `backend/services/position_service.py`

### Persistence

- [Configured database](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/supabase_db.py): `backend/services/supabase_db.py`
- [Firebase adapter](https://github.com/boreddyravikanthreddy35-lang/trading-ai-bot/blob/main/backend/services/firebase_db.py): `backend/services/firebase_db.py`

### Other components

- **User**

## Connections

- User → FastAPI server: requests API
- FastAPI server → Authentication routes: mounts routes (evidence: `backend/server.py`)
- FastAPI server → Market API: mounts routes (evidence: `backend/server.py`)
- FastAPI server → AI signals API: mounts routes (evidence: `backend/server.py`)
- FastAPI server → Backtest API: mounts routes (evidence: `backend/server.py`)
- FastAPI server → Paper trading API: mounts routes (evidence: `backend/server.py`)
- FastAPI server → Auto-trader API: mounts routes (evidence: `backend/server.py`)
- FastAPI server → Portfolio manager API: mounts routes (evidence: `backend/server.py`)
- FastAPI server → Wallet API: mounts routes (evidence: `backend/server.py`)
- Authentication routes → JWT authentication: uses (evidence: `backend/api/auth_routes.py`)
- Market API → Market data: fetches market data (evidence: `backend/api/market.py`)
- Market API → Technical indicators: uses indicators (evidence: `backend/api/market.py`)
- AI signals API → Market data: fetches market data (evidence: `backend/api/ai.py`)
- AI signals API → AI signal service: requests signals (evidence: `backend/api/ai.py`)
- AI signals API → Technical indicators: uses indicators (evidence: `backend/api/ai.py`)
- Backtest API → Market data: fetches market data (evidence: `backend/api/backtest.py`)
- Backtest API → Backtest engine: runs backtest (evidence: `backend/api/backtest.py`)
- Auto-trader API → AI auto-trader: invokes trader (evidence: `backend/api/auto_trader.py`)
- Portfolio manager API → Autonomous portfolio: runs cycle (evidence: `backend/api/portfolio_manager.py`)
- Wallet API → Wallet service: reads balances (evidence: `backend/api/wallet.py`)
- Wallet API → Double-entry ledger: reads history (evidence: `backend/api/wallet.py`)
- Wallet service → Double-entry ledger: posts deposits (evidence: `backend/services/wallet_service.py`)
- Pre-trade risk → Wallet service: checks balance (evidence: `backend/services/risk_engine.py`)
- FastAPI server → Configured database: configures backend (evidence: `backend/server.py`)
- FastAPI server → Firebase adapter: selects optionally (evidence: `backend/server.py`)
