# ericwang-finmktdatalab/options_data_analysis architecture

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

- Interactive diagram: https://gitdiagram.com/ericwang-finmktdatalab/options_data_analysis
- Repository: https://github.com/ericwang-finmktdatalab/options_data_analysis

## Overview

This is an options-data analysis pipeline for quant research and education. Its main workflow selects the top five S&P 500 stocks, retrieves near-term option chains and spot prices, enriches contracts with Black–Scholes Greeks and open-interest z-scores, then produces IV plots and CSV datasets, including an unusual-OI subset. The graph distinguishes the pipeline orchestrator from acquisition, analytics, and output components. Relationships are based on the README and excerpted source; unsampled implementation details are not inferred.

Main entry points: [`run_pipeline.py`](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/run_pipeline.py) (Pipeline runner), [`src/data_fetcher.py`](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/data_fetcher.py) (Stock universe selection), [`src/greeks.py`](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/greeks.py) (Black–Scholes Greeks), [`src/visualizer.py`](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/visualizer.py) (IV surface plotting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Pipeline workflow"]
  node_pipeline["Pipeline runner<br/>[run_pipeline.py]"]
  node_oi_filter["Unusual OI filter<br/>[run_pipeline.py]"]
  node_logging["Event logging<br/>[utils.py]"]
end

subgraph group_acquisition["Market data acquisition"]
  node_universe["Stock universe selection<br/>[data_fetcher.py]"]
  node_marketdata["Spot and option data<br/>[data_fetcher.py]"]
  node_slickcharts["Slickcharts"]
  node_yahoo["Yahoo Finance"]
end

subgraph group_analytics["Options analytics"]
  node_greeks["Black–Scholes Greeks<br/>[greeks.py]"]
  node_oi["OI statistics<br/>[signals.py]"]
end

subgraph group_outputs["Analysis outputs"]
  node_plotter["IV surface plotting<br/>[visualizer.py]"]
  node_chain_csv["Enriched chain CSV"]
  node_unusual_csv["Unusual OI CSV"]
  node_iv_plot["IV surface images"]
end

node_user(("Researcher"))

node_user -->|"runs"| node_pipeline
node_pipeline -->|"requests tickers"| node_universe
node_universe -->|"fetches constituents"| node_slickcharts
node_pipeline -->|"requests prices and chains"| node_marketdata
node_marketdata -->|"fetches market data"| node_yahoo
node_pipeline -->|"enriches contracts"| node_greeks
node_pipeline -->|"enriches OI statistics"| node_oi
node_pipeline -->|"selects z-score above 2"| node_oi_filter
node_pipeline -->|"requests IV plot"| node_plotter
node_pipeline -->|"writes enriched data"| node_chain_csv
node_pipeline -->|"writes filtered data"| node_unusual_csv
node_plotter -->|"saves image"| node_iv_plot
node_pipeline -->|"logs progress"| node_logging
node_greeks -->|"logs diagnostics"| node_logging

click node_pipeline "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/run_pipeline.py"
click node_universe "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/data_fetcher.py"
click node_marketdata "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/data_fetcher.py"
click node_greeks "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/greeks.py"
click node_oi "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/signals.py"
click node_oi_filter "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/run_pipeline.py"
click node_plotter "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/visualizer.py"
click node_chain_csv "https://github.com/ericwang-finmktdatalab/options_data_analysis/tree/main/data"
click node_unusual_csv "https://github.com/ericwang-finmktdatalab/options_data_analysis/tree/main/data"
click node_iv_plot "https://github.com/ericwang-finmktdatalab/options_data_analysis/tree/main/data"
click node_logging "https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/utils.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_pipeline,node_oi_filter,node_logging toneBlue
class node_universe,node_marketdata,node_slickcharts,node_yahoo toneAmber
class node_greeks,node_oi toneMint
class node_plotter,node_chain_csv,node_unusual_csv,node_iv_plot toneRose
class node_user toneIndigo
```

## Components

### Pipeline workflow

- [Pipeline runner](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/run_pipeline.py): `run_pipeline.py`
- [Unusual OI filter](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/run_pipeline.py): `run_pipeline.py`
- [Event logging](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/utils.py): `src/utils.py`

### Market data acquisition

- [Stock universe selection](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/data_fetcher.py): `src/data_fetcher.py`
- [Spot and option data](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/data_fetcher.py): `src/data_fetcher.py`
- **Slickcharts**
- **Yahoo Finance**

### Options analytics

- [Black–Scholes Greeks](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/greeks.py): `src/greeks.py`
- [OI statistics](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/signals.py): `src/signals.py`

### Analysis outputs

- [IV surface plotting](https://github.com/ericwang-finmktdatalab/options_data_analysis/blob/main/src/visualizer.py): `src/visualizer.py`
- [Enriched chain CSV](https://github.com/ericwang-finmktdatalab/options_data_analysis/tree/main/data): `data`
- [Unusual OI CSV](https://github.com/ericwang-finmktdatalab/options_data_analysis/tree/main/data): `data`
- [IV surface images](https://github.com/ericwang-finmktdatalab/options_data_analysis/tree/main/data): `data`

### Other components

- **Researcher**

## Connections

- Researcher → Pipeline runner: runs (evidence: `README.MD`)
- Pipeline runner → Stock universe selection: requests tickers (evidence: `run_pipeline.py`)
- Stock universe selection → Slickcharts: fetches constituents (evidence: `src/data_fetcher.py`)
- Pipeline runner → Spot and option data: requests prices and chains (evidence: `run_pipeline.py`)
- Spot and option data → Yahoo Finance: fetches market data (evidence: `src/data_fetcher.py`)
- Pipeline runner → Black–Scholes Greeks: enriches contracts (evidence: `run_pipeline.py`)
- Pipeline runner → OI statistics: enriches OI statistics (evidence: `run_pipeline.py`)
- Pipeline runner → Unusual OI filter: selects z-score above 2 (evidence: `run_pipeline.py`)
- Pipeline runner → IV surface plotting: requests IV plot (evidence: `run_pipeline.py`)
- Pipeline runner → Enriched chain CSV: writes enriched data (evidence: `run_pipeline.py`)
- Pipeline runner → Unusual OI CSV: writes filtered data (evidence: `run_pipeline.py`)
- IV surface plotting → IV surface images: saves image (evidence: `src/visualizer.py`)
- Pipeline runner → Event logging: logs progress (evidence: `run_pipeline.py`)
- Black–Scholes Greeks → Event logging: logs diagnostics (evidence: `src/greeks.py`)
