# czemius/vxn-realized-volatility architecture

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

- Interactive diagram: https://gitdiagram.com/czemius/vxn-realized-volatility
- Repository: https://github.com/czemius/vxn-realized-volatility

## Overview

This is a quantitative research pipeline evaluating whether VXN anticipates subsequent Nasdaq-100 futures realized volatility, including horizon comparisons, regression, volatility regimes, and volatility risk premium analysis. The documented workflow attaches daily VXN observations to minute-level NQ data, aggregates CME sessions and realized variance, analyzes forward volatility, and generates figures. The analysis and plotting scripts independently calculate forward targets from daily data. Relationships between pipeline stages are documented in the README; external data sources are documented there, while local file paths are configured in the scripts.

Main entry points: [`src/mesasure_hypothesis.py`](https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py) (Forward RV analysis), [`src/attach.py`](https://github.com/czemius/vxn-realized-volatility/blob/main/src/attach.py) (Attach VXN), [`src/aggregate_daily.py`](https://github.com/czemius/vxn-realized-volatility/blob/main/src/aggregate_daily.py) (Daily aggregation), [`visualization/plot.py`](https://github.com/czemius/vxn-realized-volatility/blob/main/visualization/plot.py) (Visualization generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data ingestion"]
  node_attach["Attach VXN<br/>[attach.py]"]
  node_aggregate["Daily aggregation<br/>[aggregate_daily.py]"]
end

subgraph group_research["Volatility research"]
  node_forward["Forward RV analysis"]
  node_regression["Regression analysis"]
  node_regimes["VXN regimes"]
  node_vrp["Risk premium analysis"]
end

subgraph group_presentation["Research outputs"]
  node_plots["Visualization generation<br/>[plot.py]"]
  node_figures["Research figures"]
end

node_researcher(("Researcher"))
node_fred["FRED VXN"]
node_huggingface["NQ dataset"]

node_fred -->|"provides VXN data"| node_attach
node_huggingface -->|"provides NQ data"| node_attach
node_researcher -->|"runs pipeline"| node_attach
node_attach -->|"writes attached data"| node_aggregate
node_aggregate -->|"writes daily data"| node_forward
node_aggregate -->|"writes daily data"| node_plots
node_forward -->|"estimates relationship"| node_regression
node_forward -->|"groups VXN levels"| node_regimes
node_forward -->|"compares VXN and RV"| node_vrp
node_researcher -->|"runs visualization"| node_plots
node_plots -->|"saves figures"| node_figures

click node_attach "https://github.com/czemius/vxn-realized-volatility/blob/main/src/attach.py"
click node_aggregate "https://github.com/czemius/vxn-realized-volatility/blob/main/src/aggregate_daily.py"
click node_forward "https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py"
click node_regression "https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py"
click node_regimes "https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py"
click node_vrp "https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py"
click node_plots "https://github.com/czemius/vxn-realized-volatility/blob/main/visualization/plot.py"
click node_figures "https://github.com/czemius/vxn-realized-volatility/tree/main/visualization/output"

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_attach,node_aggregate toneBlue
class node_forward,node_regression,node_regimes,node_vrp toneAmber
class node_plots,node_figures toneMint
class node_researcher,node_fred,node_huggingface toneIndigo
```

## Components

### Data ingestion

- [Attach VXN](https://github.com/czemius/vxn-realized-volatility/blob/main/src/attach.py): `src/attach.py`
- [Daily aggregation](https://github.com/czemius/vxn-realized-volatility/blob/main/src/aggregate_daily.py): `src/aggregate_daily.py`

### Volatility research

- [Forward RV analysis](https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py): `src/mesasure_hypothesis.py`
- [Regression analysis](https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py): `src/mesasure_hypothesis.py`
- [VXN regimes](https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py): `src/mesasure_hypothesis.py`
- [Risk premium analysis](https://github.com/czemius/vxn-realized-volatility/blob/main/src/mesasure_hypothesis.py): `src/mesasure_hypothesis.py`

### Research outputs

- [Visualization generation](https://github.com/czemius/vxn-realized-volatility/blob/main/visualization/plot.py): `visualization/plot.py`
- [Research figures](https://github.com/czemius/vxn-realized-volatility/tree/main/visualization/output): `visualization/output`

### Other components

- **Researcher**
- **FRED VXN**
- **NQ dataset**

## Connections

- FRED VXN → Attach VXN: provides VXN data (evidence: `README.md`)
- NQ dataset → Attach VXN: provides NQ data (evidence: `README.md`)
- Researcher → Attach VXN: runs pipeline (evidence: `README.md`)
- Attach VXN → Daily aggregation: writes attached data (evidence: `README.md`)
- Daily aggregation → Forward RV analysis: writes daily data (evidence: `README.md`)
- Daily aggregation → Visualization generation: writes daily data (evidence: `README.md`)
- Forward RV analysis → Regression analysis: estimates relationship (evidence: `src/mesasure_hypothesis.py`)
- Forward RV analysis → VXN regimes: groups VXN levels (evidence: `src/mesasure_hypothesis.py`)
- Forward RV analysis → Risk premium analysis: compares VXN and RV (evidence: `src/mesasure_hypothesis.py`)
- Researcher → Visualization generation: runs visualization (evidence: `README.md`)
- Visualization generation → Research figures: saves figures (evidence: `visualization/plot.py`)
