# EvoTraders Services Architecture This document describes the modular service architecture for EvoTraders. ## Architecture EvoTraders uses a **modular single-process architecture** with services as Python modules: ``` backend/ ├── app.py # FastAPI entry point (port 8000) ├── main.py # CLI trading system entry point ├── api/ # REST API routes │ ├── agents.py # Agent management │ ├── guard.py # Tool guard │ ├── runtime.py # Runtime management │ └── workspaces.py # Workspace management ├── agents/ # Multi-agent system │ ├── base/ # Base agent classes │ ├── team/ # Team coordination │ └── skills/ # Agent skills ├── core/ # Pipeline & scheduler ├── services/ # Core services │ ├── gateway.py # WebSocket gateway │ ├── market.py # Market data service │ └── storage.py # Storage service └── services/ # Modular services (optional) ├── trading/ # Trading module ├── news/ # News module └── agents/ # Agents module ``` ## Entry Points | Entry Point | Port | Purpose | |------------|------|---------| | `backend/app.py` | 8000 | FastAPI REST API | | `backend/main.py` | CLI | Trading system (live/backtest) | ## Running ```bash # Development mode (FastAPI only) ./start-dev.sh # Or manually python -m uvicorn backend.app:app --port 8000 --reload # Trading system (CLI) evotraders live --mock evotraders backtest --start 2025-11-01 --end 2025-12-01 ``` ## Service Modules | Module | Description | |--------|-------------| | `gateway.py` | WebSocket gateway for frontend communication | | `market.py` | Market data fetching (prices, news, financials) | | `storage.py` | Dashboard state and trade history persistence | ## Module Dependencies ``` app.py (FastAPI) ├── runtime_router │ └── backend/main.py (when task starts) │ └── Gateway │ ├── MarketService │ ├── StorageService │ └── TradingPipeline │ ├── Analysts (4x) │ ├── RiskManager │ └── PortfolioManager ```