# jlhc888/quanthedgefund architecture

> Architecture diagram of the GitHub repository jlhc888/quanthedgefund, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jlhc888/quanthedgefund
- Repository: https://github.com/jlhc888/quanthedgefund

## Overview

This repository is a quant trading platform: market data is collected and stored, strategies are researched and backtested, results are governed, and approved strategies can be used for trading and monitoring. The main product workflow is supported by README-level architecture statements and selected source references; some subsystem internals, especially real-time scheduling and orchestration, were not sampled, so their implementation-level connections are omitted.

Main entry points: [`qsresearch/backtest/run_backtest.py`](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/backtest/run_backtest.py) (Backtest Runner), [`qsconnect/client.py`](https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/client.py) (Data Client), [`omega/trading_app.py`](https://github.com/jlhc888/quanthedgefund/blob/master/omega/trading_app.py) (Trading Application), [`qsresearch/governance/manager.py`](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/governance/manager.py) (Strategy Governance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Market Data"]
  node_qs_client["Data Client<br/>[client.py]"]
  node_fmp_client["FMP Client<br/>[fmp_client.py]"]
  node_cache[("Parquet Cache<br/>[cache_manager.py]")]
  node_duckdb[("DuckDB Store<br/>[duckdb_manager.py]")]
  node_bundler["Zipline Bundler<br/>[zipline_bundler.py]"]
end

subgraph group_research["Research &amp; Governance"]
  node_factor_engine["Factor Engine<br/>[factor_engine.py]"]
  node_backtest["Backtest Runner<br/>[run_backtest.py]"]
  node_sweeps["Parameter Sweeps<br/>[parameter_sweep.py]"]
  node_metrics["Performance Metrics"]
  node_strategy_config["Factor Strategy Config<br/>[config.py]"]
  node_strategy_generator["AI Strategy Generator"]
  node_research_flow["AI Research Flow<br/>[research_flow.py]"]
  node_governance["Strategy Governance<br/>[manager.py]"]
end

subgraph group_execution["Live Execution"]
  node_trading["Trading Application<br/>[trading_app.py]"]
  node_risk["Risk Controls<br/>[risk_engine.py]"]
  node_candles["Candle Engine<br/>[candle_engine.py]"]
end

subgraph group_operations["Operations &amp; Monitoring"]
  node_dashboard["Operations Dashboard<br/>[app.py]"]
  node_prefect["Prefect Flows<br/>[prefect_flows.py]"]
  node_realtime["Inference Scheduler<br/>[scheduler.py]"]
end

node_fmp(("FMP API"))
node_broker(("Interactive Brokers"))

node_fmp -->|"serves data"| node_fmp_client
node_qs_client -->|"fetches from"| node_fmp_client
node_qs_client -->|"reads and writes"| node_cache
node_qs_client -->|"stores data"| node_duckdb
node_qs_client -->|"registers bundles"| node_bundler
node_duckdb -->|"supplies data"| node_bundler
node_bundler -->|"feeds history"| node_backtest
node_backtest -->|"calculates factors"| node_factor_engine
node_factor_engine -.->|"uses factors"| node_strategy_config
node_backtest -->|"calculates metrics"| node_metrics
node_sweeps -->|"runs batches"| node_backtest
node_research_flow -->|"generates strategy"| node_strategy_generator
node_strategy_generator -->|"gets data"| node_qs_client
node_backtest -.->|"records approval"| node_governance
node_governance -.->|"writes audit trail"| node_duckdb
node_governance -->|"provides strategy stage"| node_trading
node_trading -->|"checks orders"| node_risk
node_trading -->|"processes market ticks"| node_candles
node_trading -->|"executes orders"| node_broker
node_dashboard -->|"opens backtests"| node_backtest
node_dashboard -->|"views governance"| node_governance
node_dashboard -->|"shows risk limits"| node_risk
node_prefect -->|"orchestrates runs"| node_backtest
node_realtime -.->|"dispatches inference"| node_trading

click node_qs_client "https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/client.py"
click node_fmp_client "https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/api/fmp_client.py"
click node_cache "https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/cache/cache_manager.py"
click node_duckdb "https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/database/duckdb_manager.py"
click node_bundler "https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/bundle/zipline_bundler.py"
click node_factor_engine "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/features/factor_engine.py"
click node_backtest "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/backtest/run_backtest.py"
click node_sweeps "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/backtest/parameter_sweep.py"
click node_metrics "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/portfolio_analysis/performance_metrics.py"
click node_strategy_config "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/strategies/factor/config.py"
click node_strategy_generator "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/llm/strategy_generator.py"
click node_research_flow "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/llm/research_flow.py"
click node_governance "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/governance/manager.py"
click node_trading "https://github.com/jlhc888/quanthedgefund/blob/master/omega/trading_app.py"
click node_risk "https://github.com/jlhc888/quanthedgefund/blob/master/omega/risk_engine.py"
click node_candles "https://github.com/jlhc888/quanthedgefund/blob/master/omega/data/candle_engine.py"
click node_dashboard "https://github.com/jlhc888/quanthedgefund/blob/master/dashboard/app.py"
click node_prefect "https://github.com/jlhc888/quanthedgefund/blob/master/automation/prefect_flows.py"
click node_realtime "https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/realtime/scheduler.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_qs_client,node_fmp_client,node_cache,node_duckdb,node_bundler toneBlue
class node_factor_engine,node_backtest,node_sweeps,node_metrics,node_strategy_config,node_strategy_generator,node_research_flow,node_governance toneAmber
class node_trading,node_risk,node_candles,node_fmp toneMint
class node_dashboard,node_prefect,node_realtime toneRose
class node_broker toneIndigo
```

## Components

### Market Data

- [Data Client](https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/client.py): `qsconnect/client.py`
- [FMP Client](https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/api/fmp_client.py): `qsconnect/api/fmp_client.py`
- [Parquet Cache](https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/cache/cache_manager.py): `qsconnect/cache/cache_manager.py`
- [DuckDB Store](https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/database/duckdb_manager.py): `qsconnect/database/duckdb_manager.py`
- [Zipline Bundler](https://github.com/jlhc888/quanthedgefund/blob/master/qsconnect/bundle/zipline_bundler.py): `qsconnect/bundle/zipline_bundler.py`

### Research & Governance

- [Factor Engine](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/features/factor_engine.py): `qsresearch/features/factor_engine.py`
- [Backtest Runner](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/backtest/run_backtest.py): `qsresearch/backtest/run_backtest.py`
- [Parameter Sweeps](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/backtest/parameter_sweep.py): `qsresearch/backtest/parameter_sweep.py`
- [Performance Metrics](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/portfolio_analysis/performance_metrics.py): `qsresearch/portfolio_analysis/performance_metrics.py`
- [Factor Strategy Config](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/strategies/factor/config.py): `qsresearch/strategies/factor/config.py`
- [AI Strategy Generator](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/llm/strategy_generator.py): `qsresearch/llm/strategy_generator.py`
- [AI Research Flow](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/llm/research_flow.py): `qsresearch/llm/research_flow.py`
- [Strategy Governance](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/governance/manager.py): `qsresearch/governance/manager.py`

### Live Execution

- [Trading Application](https://github.com/jlhc888/quanthedgefund/blob/master/omega/trading_app.py): `omega/trading_app.py`
- [Risk Controls](https://github.com/jlhc888/quanthedgefund/blob/master/omega/risk_engine.py): `omega/risk_engine.py`
- [Candle Engine](https://github.com/jlhc888/quanthedgefund/blob/master/omega/data/candle_engine.py): `omega/data/candle_engine.py`

### Operations & Monitoring

- [Operations Dashboard](https://github.com/jlhc888/quanthedgefund/blob/master/dashboard/app.py): `dashboard/app.py`
- [Prefect Flows](https://github.com/jlhc888/quanthedgefund/blob/master/automation/prefect_flows.py): `automation/prefect_flows.py`
- [Inference Scheduler](https://github.com/jlhc888/quanthedgefund/blob/master/qsresearch/realtime/scheduler.py): `qsresearch/realtime/scheduler.py`

### Other components

- **FMP API**
- **Interactive Brokers**

## Connections

- FMP API → FMP Client: serves data (evidence: `README.md`)
- Data Client → FMP Client: fetches from (evidence: `qsconnect/client.py`)
- Data Client → Parquet Cache: reads and writes (evidence: `qsconnect/client.py`)
- Data Client → DuckDB Store: stores data (evidence: `qsconnect/client.py`)
- Data Client → Zipline Bundler: registers bundles (evidence: `qsconnect/client.py`)
- DuckDB Store → Zipline Bundler: supplies data (evidence: `qsconnect/bundle/zipline_bundler.py`)
- Zipline Bundler → Backtest Runner: feeds history (evidence: `README.md`)
- Backtest Runner → Factor Engine: calculates factors (evidence: `qsresearch/backtest/run_backtest.py`)
- Factor Engine → Factor Strategy Config: uses factors
- Backtest Runner → Performance Metrics: calculates metrics (evidence: `qsresearch/backtest/run_backtest.py`)
- Parameter Sweeps → Backtest Runner: runs batches (evidence: `automation/prefect_flows.py`)
- AI Research Flow → AI Strategy Generator: generates strategy (evidence: `qsresearch/llm/research_flow.py`)
- AI Strategy Generator → Data Client: gets data (evidence: `qsresearch/llm/strategy_generator.py`)
- Backtest Runner → Strategy Governance: records approval
- Strategy Governance → DuckDB Store: writes audit trail
- Strategy Governance → Trading Application: provides strategy stage (evidence: `omega/trading_app.py`)
- Trading Application → Risk Controls: checks orders (evidence: `omega/trading_app.py`)
- Trading Application → Candle Engine: processes market ticks (evidence: `run_trading_node.py`)
- Trading Application → Interactive Brokers: executes orders (evidence: `README.md`)
- Operations Dashboard → Backtest Runner: opens backtests (evidence: `README.md`)
- Operations Dashboard → Strategy Governance: views governance (evidence: `dashboard/app.py`)
- Operations Dashboard → Risk Controls: shows risk limits (evidence: `dashboard/app.py`)
- Prefect Flows → Backtest Runner: orchestrates runs (evidence: `automation/prefect_flows.py`)
- Inference Scheduler → Trading Application: dispatches inference
