Skip to content

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
  • 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.

Documentation generated with VitePress