Component Diagram β
This document details the internal structure of each main container using the C4 Component level.
Backend API Components β
- π Data Ingestion Module: Fetches and normalizes data from external sources (APIs, CSV).
- π Market Data
- Yahoo Finance API (via yfinance)
- Alpha Vantage β Free API for stock, forex, and crypto
- IEX Cloud β Real-time and historical data
- Polygon.io β High-quality market data (paid tiers)
- Finnhub β Real-time and fundamental data
- π News & Sentiment (Optional)
- NewsAPI β Financial news aggregation
- Sentiment APIs β For NLP-based sentiment scoring
- π Market Data
- ETL/Processing Module: Handles batch and streaming ETL using Python (Polars, PyArrow, etc.).
- Query Engine: DuckDB (lightweight, SQL on Parquet)
- Backtesting & Strategy Engine: Runs trading strategies (rule-based and event-driven), backtests, and generates signals.
- backtrader β Strategy backtesting
- bt β Portfolio backtesting
- zipline β Quantitative finance backtesting (used by Quantopian)
- Trade Execution Module: Interfaces with broker APIs to place/cancel orders.
- Authentication & Authorization: Verifies Auth0-issued JWTs (RS256) via JWKS, applies scopes/roles for protected endpoints; user profile/settings stored in app DB as needed.
- Reporting & Analytics: Generates reports, dashboards, and logs (numpy β Numerical operations, ta β Technical analysis indicators, scikit-learn β Machine learning (optional), statsmodels β Statistical modeling).
- matplotlib / seaborn β Static plots
- plotly β Interactive charts
Data Storage Components β
- NoSQL Database: Stores earnings event data, trade signals, logs, and unstructured information, Real-time access for dashboards or agents Flexible schema that may evolve.
- DBMongoDB (open-source, easy Docker setup)
- Parquet Storage: Stores historical and analytical data for fast querying. Storing historical price data, backtest results, performance metrics Efficient analytics and batch processing Integration with tools like DuckDB
- Database Abstraction Layer: Provides a unified interface for data access (NoSQL/Parquet).
π§ Would a Vectorized Database Help? β
Vectorized databases (like Pinecone, Weaviate, Qdrant, Milvus, or Chroma) are designed for storing and searching high-dimensional vectorsβtypically used for:
Semantic search (e.g., finding similar news, stocks, or patterns) Retrieval-augmented generation (RAG) for LLMs Clustering and anomaly detection in large datasets
Infrastructure Components β
- Docker Containers: Encapsulate backend, UI, and supporting services for portability.
- CI/CD Pipeline: Automates build, test, and deployment (GitHub Actions).
- Hosting Environment: Linux server (cloud or bare metal) for running containers and services.
- LLM API (OpenAI, Azure OpenAI, Cohere, etc.)
- Orchestration: Prefect (open-source workflow orchestration)
Documentation Components β
- VitePress Site: Vue 3 + Vite-based static site generator for comprehensive technical documentation.
- Architecture documentation (C4 models, diagrams)
- API reference
- Strategy documentation
- Developer guides
- Component documentation
- Markdown Source: Version-controlled documentation alongside code
- Automated Builds: Documentation built and deployed as part of CI/CD pipeline
AI Components β
Building Your Own AI Agent can:
- Automate data ingestion, screening, and reporting
- Generate trade ideas or alerts based on your strategy
- Summarize news, filings, or social sentiment
- Interact via chat or dashboard (using LLMs like GPT-4, Llama, etc.)
Web UI Components (Svelte) β
- Dashboard: Main interface for monitoring and control (Svelte).
- Strategy Editor: UI for creating and editing strategies (Svelte).
- Results Viewer: Displays backtest and live results (Svelte).
- Auth Client: Integrates with Auth0 Universal Login using Authorization Code with PKCE; stores tokens in memory and attaches bearer token to API calls; handles token refresh and logout.
Cross-Cutting Concerns β
- Configuration Management: Centralized config for all modules.
- Logging & Monitoring: Tracks system health, errors, and performance.
- Security: API key management, access control, and secure communication.
- Authentication: Auth0 (Free); SPA uses OIDC PKCE, API validates JWT; environment-specific settings via config (domain, audience, client id).
- Authorization: start with coarse-grained scopes; expand to role-based permissions as strategies and UI features grow.