# tharun-maheswararao/quant-signal-pipeline architecture

> Architecture diagram of the GitHub repository tharun-maheswararao/quant-signal-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tharun-maheswararao/quant-signal-pipeline
- Repository: https://github.com/tharun-maheswararao/quant-signal-pipeline

## Overview

This is a research and validation pipeline, not a trading system. Researchers collect live or historical Coinbase market data, derive signals/features and forward labels, train and tune models, then assess them through cost-aware backtests, rolling walk-forward windows, and a final holdout. The map also preserves documented signal diagnostics and statistical checks. The main runtime relationships are supported by sampled source; broader validation capabilities and the orchestration sequence are documented in the README and runner. The graph does not imply that the two data sources feed the same storage path.

Main entry points: [`scripts/run_walk_forward_validation.py`](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/scripts/run_walk_forward_validation.py) (Validation Workflow), [`src/quant_pipeline/signals.py`](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/signals.py) (Live Signal Handling), [`src/quant_pipeline/labeling.py`](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/labeling.py) (Forward Labels), [`src/quant_pipeline/backtest.py`](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py) (Backtest Assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Market Data"]
  node_live_ingestion["Live Ingestion<br/>[ingestion.py]"]
  node_historical_fetch["Historical Fetch<br/>[historical.py]"]
  node_trade_store[("Trade Context JSONL<br/>[ingestion.py]")]
  node_candle_adaptation["Candle Adaptation<br/>[historical.py]"]
end

subgraph group_research["Signal Research"]
  node_live_signals["Live Signal Handling<br/>[signals.py]"]
  node_order_book["Order Book Signals<br/>[signals.py]"]
  node_labeling["Forward Labels<br/>[labeling.py]"]
  node_feature_engineering["Feature Assembly<br/>[models.py]"]
  node_candle_features["Candle Features<br/>[historical.py]"]
  node_dataset_assembly["Dataset Assembly<br/>[models.py]"]
end

subgraph group_evaluation["Model Evaluation"]
  node_model_training["Model Training &amp; Tuning<br/>[models.py]"]
  node_holdout_split["Final Holdout Split<br/>[models.py]"]
  node_backtest_data["Backtest Assembly<br/>[backtest.py]"]
  node_walk_forward["Walk-Forward Backtest<br/>[backtest.py]"]
  node_cost_pnl["Cost-Aware P&amp;L<br/>[backtest.py]"]
  node_risk_metrics["Risk Metrics<br/>[backtest.py]"]
  node_validation_runner["Validation Workflow"]
end

subgraph group_diagnostics["Statistical Diagnostics"]
  node_validation_checks["Stationarity &amp; Autocorrelation<br/>[validation.py]"]
end

node_researcher(("Researcher"))
node_live_ws(("Coinbase WebSocket"))
node_coinbase_api["Coinbase Candles API"]

node_researcher -->|"starts stream"| node_live_ingestion
node_live_ws -->|"streams messages"| node_live_ingestion
node_live_ingestion -->|"dispatches messages"| node_live_signals
node_live_signals -->|"reads order state"| node_order_book
node_live_signals -->|"writes context"| node_trade_store
node_researcher -->|"requests history"| node_historical_fetch
node_historical_fetch -->|"fetches candles"| node_coinbase_api
node_historical_fetch -->|"adapts candles"| node_candle_adaptation
node_candle_adaptation -->|"provides trades"| node_labeling
node_labeling -->|"labels examples"| node_dataset_assembly
node_labeling -->|"provides labels"| node_backtest_data
node_feature_engineering -->|"computes momentum"| node_live_signals
node_candle_features -->|"computes momentum"| node_live_signals
node_dataset_assembly -->|"assembles features"| node_feature_engineering
node_dataset_assembly -->|"supplies examples"| node_model_training
node_candle_features -->|"supplies features"| node_backtest_data
node_researcher -->|"runs validation"| node_validation_runner
node_validation_runner -->|"adapts history"| node_candle_adaptation
node_validation_runner -->|"creates labels"| node_labeling
node_validation_runner -->|"assembles data"| node_backtest_data
node_backtest_data -->|"builds features"| node_feature_engineering
node_validation_runner -->|"reserves holdout"| node_holdout_split
node_validation_runner -->|"runs windows"| node_walk_forward
node_walk_forward -->|"trains per window"| node_model_training
node_walk_forward -->|"simulates trades"| node_cost_pnl
node_validation_runner -->|"trains models"| node_model_training
node_validation_runner -->|"tests holdout"| node_cost_pnl
node_validation_runner -->|"computes metrics"| node_risk_metrics
node_researcher -->|"checks series"| node_validation_checks

click node_live_ingestion "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/ingestion.py"
click node_historical_fetch "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/historical.py"
click node_live_signals "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/signals.py"
click node_order_book "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/signals.py"
click node_trade_store "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/ingestion.py"
click node_candle_adaptation "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/historical.py"
click node_labeling "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/labeling.py"
click node_feature_engineering "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py"
click node_candle_features "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/historical.py"
click node_dataset_assembly "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py"
click node_model_training "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py"
click node_holdout_split "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py"
click node_backtest_data "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py"
click node_walk_forward "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py"
click node_cost_pnl "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py"
click node_risk_metrics "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py"
click node_validation_checks "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/validation.py"
click node_validation_runner "https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/scripts/run_walk_forward_validation.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_live_ingestion,node_historical_fetch,node_trade_store,node_candle_adaptation toneBlue
class node_live_signals,node_order_book,node_labeling,node_feature_engineering,node_candle_features,node_dataset_assembly toneAmber
class node_model_training,node_holdout_split,node_backtest_data,node_walk_forward,node_cost_pnl,node_risk_metrics,node_validation_runner,node_coinbase_api toneMint
class node_validation_checks toneRose
class node_researcher,node_live_ws toneIndigo
```

## Components

### Market Data

- [Live Ingestion](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/ingestion.py): `src/quant_pipeline/ingestion.py`
- [Historical Fetch](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/historical.py): `src/quant_pipeline/historical.py`
- [Trade Context JSONL](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/ingestion.py): `src/quant_pipeline/ingestion.py`
- [Candle Adaptation](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/historical.py): `src/quant_pipeline/historical.py`

### Signal Research

- [Live Signal Handling](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/signals.py): `src/quant_pipeline/signals.py`
- [Order Book Signals](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/signals.py): `src/quant_pipeline/signals.py`
- [Forward Labels](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/labeling.py): `src/quant_pipeline/labeling.py`
- [Feature Assembly](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py): `src/quant_pipeline/models.py`
- [Candle Features](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/historical.py): `src/quant_pipeline/historical.py`
- [Dataset Assembly](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py): `src/quant_pipeline/models.py`

### Model Evaluation

- [Model Training & Tuning](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py): `src/quant_pipeline/models.py`
- [Final Holdout Split](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/models.py): `src/quant_pipeline/models.py`
- [Backtest Assembly](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py): `src/quant_pipeline/backtest.py`
- [Walk-Forward Backtest](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py): `src/quant_pipeline/backtest.py`
- [Cost-Aware P&L](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py): `src/quant_pipeline/backtest.py`
- [Risk Metrics](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/backtest.py): `src/quant_pipeline/backtest.py`
- [Validation Workflow](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/scripts/run_walk_forward_validation.py): `scripts/run_walk_forward_validation.py`

### Statistical Diagnostics

- [Stationarity & Autocorrelation](https://github.com/tharun-maheswararao/quant-signal-pipeline/blob/main/src/quant_pipeline/validation.py): `src/quant_pipeline/validation.py`

### Other components

- **Researcher**
- **Coinbase WebSocket**
- **Coinbase Candles API**

## Connections

- Researcher → Live Ingestion: starts stream (evidence: `README.md`)
- Coinbase WebSocket → Live Ingestion: streams messages (evidence: `src/quant_pipeline/ingestion.py`)
- Live Ingestion → Live Signal Handling: dispatches messages (evidence: `src/quant_pipeline/ingestion.py`)
- Live Signal Handling → Order Book Signals: reads order state (evidence: `src/quant_pipeline/signals.py`)
- Live Signal Handling → Trade Context JSONL: writes context (evidence: `src/quant_pipeline/signals.py`)
- Researcher → Historical Fetch: requests history (evidence: `README.md`)
- Historical Fetch → Coinbase Candles API: fetches candles (evidence: `src/quant_pipeline/historical.py`)
- Historical Fetch → Candle Adaptation: adapts candles (evidence: `README.md`)
- Candle Adaptation → Forward Labels: provides trades (evidence: `scripts/run_walk_forward_validation.py`)
- Forward Labels → Dataset Assembly: labels examples (evidence: `scripts/run_walk_forward_validation.py`)
- Forward Labels → Backtest Assembly: provides labels (evidence: `src/quant_pipeline/backtest.py`)
- Feature Assembly → Live Signal Handling: computes momentum (evidence: `src/quant_pipeline/models.py`)
- Candle Features → Live Signal Handling: computes momentum (evidence: `src/quant_pipeline/historical.py`)
- Dataset Assembly → Feature Assembly: assembles features (evidence: `src/quant_pipeline/models.py`)
- Dataset Assembly → Model Training & Tuning: supplies examples (evidence: `scripts/run_walk_forward_validation.py`)
- Candle Features → Backtest Assembly: supplies features (evidence: `src/quant_pipeline/historical.py`)
- Researcher → Validation Workflow: runs validation (evidence: `README.md`)
- Validation Workflow → Candle Adaptation: adapts history (evidence: `scripts/run_walk_forward_validation.py`)
- Validation Workflow → Forward Labels: creates labels (evidence: `scripts/run_walk_forward_validation.py`)
- Validation Workflow → Backtest Assembly: assembles data (evidence: `scripts/run_walk_forward_validation.py`)
- Backtest Assembly → Feature Assembly: builds features (evidence: `src/quant_pipeline/backtest.py`)
- Validation Workflow → Final Holdout Split: reserves holdout (evidence: `scripts/run_walk_forward_validation.py`)
- Validation Workflow → Walk-Forward Backtest: runs windows (evidence: `scripts/run_walk_forward_validation.py`)
- Walk-Forward Backtest → Model Training & Tuning: trains per window (evidence: `src/quant_pipeline/backtest.py`)
- Walk-Forward Backtest → Cost-Aware P&L: simulates trades (evidence: `src/quant_pipeline/backtest.py`)
- Validation Workflow → Model Training & Tuning: trains models (evidence: `scripts/run_walk_forward_validation.py`)
- Validation Workflow → Cost-Aware P&L: tests holdout (evidence: `scripts/run_walk_forward_validation.py`)
- Validation Workflow → Risk Metrics: computes metrics (evidence: `scripts/run_walk_forward_validation.py`)
- Researcher → Stationarity & Autocorrelation: checks series (evidence: `README.md`)
