The AI Trading & Research Copilot is built as a modern web application with a clear separation between frontend, backend, and data layers.
- Framework: FastAPI (Python)
- Database: PostgreSQL (relational data) + ChromaDB (vector embeddings)
- Data Sources: yfinance, SEC EDGAR API, News APIs
- AI/ML: OpenAI API, LangChain, Sentence Transformers
- Framework: Next.js 14 (React)
- Charting: TradingView Lightweight Charts
- Styling: Tailwind CSS
- Language: TypeScript
- Scheduled ETL jobs for market data
- News and filings ingestion pipelines
- Data validation and cleaning
- PostgreSQL: OHLCV data, symbols, watchlists, user data
- ChromaDB: Vector embeddings for RAG
- Object Storage: Raw filings and documents (future)
- RESTful API endpoints
- Authentication (future)
- Rate limiting and caching
- Technical indicators computation
- Risk scoring models
- Backtest engine
- Sentiment analysis
- RAG pipeline for document retrieval
- LLM agent with tool calling
- Embedding generation
- Context construction
- React components
- Chart visualization
- Chat interface
- Dashboard and portfolio views
External API (yfinance) → DataFetcher Service → PostgreSQL → API Endpoint → Frontend
Documents → Chunking → Embedding → Vector DB → Retrieval → LLM → Response
User Message → API → RAG Retrieval → Context Construction → LLM → Response + Citations
- id, symbol, name, sector, industry, market_cap
- id, symbol_id, timestamp, open, high, low, close, volume
- id, user_id, symbol_id, created_at
GET /api/v1/symbols- List symbolsGET /api/v1/symbols/{symbol}- Get symbol detailsPOST /api/v1/symbols/{symbol}/sync- Sync symbol dataGET /api/v1/prices/{symbol}- Get price barsPOST /api/v1/prices/{symbol}/sync- Sync price dataGET /api/v1/indicators/{symbol}- Get technical indicators
POST /api/v1/chat- AI copilot chatGET /api/v1/news/{symbol}- Get news articlesGET /api/v1/filings/{symbol}- Get SEC filings
GET /api/v1/watchlist- Get user watchlistPOST /api/v1/watchlist- Add to watchlistGET /api/v1/risk/{symbol}- Get risk metricsGET /api/v1/risk/portfolio- Get portfolio risk
POST /api/v1/backtest- Run backtestGET /api/v1/strategies- List strategy templates
- API authentication (JWT tokens)
- Rate limiting
- Input validation
- SQL injection prevention (SQLAlchemy ORM)
- CORS configuration
- Database indexing on frequently queried columns
- Caching layer for price data (Redis - future)
- Async processing for data ingestion
- Horizontal scaling of API servers
- CDN for static assets
- Request/response logging
- Error tracking
- Performance metrics
- Data freshness monitoring
- AI model performance evaluation