# beta-blockers/beta_correcting_etfs_backtests architecture

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

- Interactive diagram: https://gitdiagram.com/beta-blockers/beta_correcting_etfs_backtests
- Repository: https://github.com/beta-blockers/beta_correcting_etfs_backtests

## Overview

This repository is a reproducible financial-research backtesting project, not a general portfolio service. Its principal workflow takes frozen financial, price, FX, listing, and policy-evidence inputs through dated eligibility and scoring, portfolio selection and trading, then produces ledgers and comparative results. Separate runners extend historical coverage, test policy screens and recovery rules, and audit sensitivity. The graph follows documented commands and visible module references; some detailed runner-to-runner behavior and unsampled implementations are not verified.

Main entry points: [`backtest.py`](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/backtest.py) (Portfolio Engine), [`run_long_history.py`](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_long_history.py) (Long-History Study), [`run_recovery_experiments.py`](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_recovery_experiments.py) (Rule Experiments), [`run_actual_dates.py`](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_actual_dates.py) (Actual-Date Runs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Research Inputs"]
  node_frozen_data[("Frozen Data")]
  node_prepare["Data Preparation<br/>[prepare_data.py]"]
  node_issuer_sources["Issuer Sources"]
  node_wind_recovery["Wind Report Recovery<br/>[recover.py]"]
  node_wind_rows["Wind Row Builder<br/>[build_rows.py]"]
end

subgraph group_engine["Backtest Engine"]
  node_backtest["Portfolio Engine<br/>[backtest.py]"]
  node_recovery_rules["Recovery Rules<br/>[recovery_rules.py]"]
end

subgraph group_studies["Research Studies"]
  node_actual_runner["Actual-Date Runs"]
  node_eu_interim["EU Interim Study<br/>[run_eu_interim.py]"]
  node_eu_restore["EU Restoration"]
  node_us_restore["US Restoration"]
  node_corrections["Coverage Corrections"]
  node_long_history["Long-History Study"]
  node_policy["Public-Support Screen<br/>[run_pillar2.py]"]
  node_experiments["Rule Experiments"]
end

subgraph group_review["Audits and Results"]
  node_results[("Study Results")]
  node_long_audit["History Evidence Audit"]
  node_robustness["Robustness Analysis"]
  node_diagnostics["Recovery Diagnostics"]
  node_pillar_analysis["Policy Analysis<br/>[analyze_pillar2.py]"]
  node_integrity["Snapshot Integrity"]
  node_actual_dates["Actual-Date Audit<br/>[validate_actual.py]"]
  node_correction_audit["Long-History Audit"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs study"| node_actual_runner
node_researcher -->|"runs study"| node_long_history
node_frozen_data -->|"reads inputs"| node_prepare
node_prepare -->|"supplies data"| node_backtest
node_wind_rows -->|"uses archive"| node_wind_recovery
node_actual_runner -->|"runs portfolios"| node_backtest
node_eu_interim -->|"runs portfolios"| node_backtest
node_eu_restore -->|"runs portfolios"| node_backtest
node_us_restore -->|"runs portfolios"| node_backtest
node_corrections -->|"runs portfolios"| node_backtest
node_long_history -->|"runs portfolios"| node_backtest
node_policy -->|"runs portfolios"| node_backtest
node_experiments -->|"runs portfolios"| node_backtest
node_experiments -->|"configures rules"| node_recovery_rules
node_recovery_rules -->|"uses ranking"| node_backtest
node_actual_runner -->|"writes results"| node_results
node_long_history -->|"writes results"| node_results
node_long_audit -->|"audits ledgers"| node_results
node_robustness -->|"reruns portfolios"| node_backtest
node_experiments -->|"uses diagnostics"| node_diagnostics
node_pillar_analysis -->|"uses engine"| node_backtest
node_actual_dates -->|"validates runs"| node_backtest
node_integrity -.->|"checks snapshots"| node_frozen_data
node_corrections -->|"checks snapshots"| node_integrity
node_long_history -->|"audits timing"| node_correction_audit
node_issuer_sources -.->|"prepares evidence"| node_frozen_data

click node_frozen_data "https://github.com/beta-blockers/beta_correcting_etfs_backtests/tree/main/data"
click node_prepare "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/prepare_data.py"
click node_issuer_sources "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/parse_issuer_sources.py"
click node_wind_recovery "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/data/eu_restoration/sources/wind/recover.py"
click node_wind_rows "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/data/eu_restoration/sources/wind/build_rows.py"
click node_backtest "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/backtest.py"
click node_actual_runner "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_actual_dates.py"
click node_eu_interim "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_eu_interim.py"
click node_eu_restore "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_eu_restoration.py"
click node_us_restore "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_us_restoration.py"
click node_corrections "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_research_corrections.py"
click node_long_history "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_long_history.py"
click node_policy "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_pillar2.py"
click node_recovery_rules "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/recovery_rules.py"
click node_experiments "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_recovery_experiments.py"
click node_results "https://github.com/beta-blockers/beta_correcting_etfs_backtests/tree/main/results_pillar2"
click node_long_audit "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/audit_long_history_evidence.py"
click node_robustness "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/analyze_recovery_robustness.py"
click node_diagnostics "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/recovery_diagnostics.py"
click node_pillar_analysis "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/analyze_pillar2.py"
click node_integrity "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/snapshot_integrity.py"
click node_actual_dates "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/validate_actual.py"
click node_correction_audit "https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/audit_long_history_evidence.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_frozen_data,node_prepare,node_issuer_sources,node_wind_recovery,node_wind_rows toneBlue
class node_backtest,node_recovery_rules toneAmber
class node_actual_runner,node_eu_interim,node_eu_restore,node_us_restore,node_corrections,node_long_history,node_policy,node_experiments toneMint
class node_results,node_long_audit,node_robustness,node_diagnostics,node_pillar_analysis,node_integrity,node_actual_dates,node_correction_audit toneRose
class node_researcher toneIndigo
```

## Components

### Research Inputs

- [Frozen Data](https://github.com/beta-blockers/beta_correcting_etfs_backtests/tree/main/data): `data`
- [Data Preparation](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/prepare_data.py): `prepare_data.py`
- [Issuer Sources](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/parse_issuer_sources.py): `parse_issuer_sources.py`
- [Wind Report Recovery](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/data/eu_restoration/sources/wind/recover.py): `data/eu_restoration/sources/wind/recover.py`
- [Wind Row Builder](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/data/eu_restoration/sources/wind/build_rows.py): `data/eu_restoration/sources/wind/build_rows.py`

### Backtest Engine

- [Portfolio Engine](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/backtest.py): `backtest.py`
- [Recovery Rules](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/recovery_rules.py): `recovery_rules.py`

### Research Studies

- [Actual-Date Runs](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_actual_dates.py): `run_actual_dates.py`
- [EU Interim Study](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_eu_interim.py): `run_eu_interim.py`
- [EU Restoration](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_eu_restoration.py): `run_eu_restoration.py`
- [US Restoration](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_us_restoration.py): `run_us_restoration.py`
- [Coverage Corrections](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_research_corrections.py): `run_research_corrections.py`
- [Long-History Study](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_long_history.py): `run_long_history.py`
- [Public-Support Screen](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_pillar2.py): `run_pillar2.py`
- [Rule Experiments](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/run_recovery_experiments.py): `run_recovery_experiments.py`

### Audits and Results

- [Study Results](https://github.com/beta-blockers/beta_correcting_etfs_backtests/tree/main/results_pillar2): `results_pillar2`
- [History Evidence Audit](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/audit_long_history_evidence.py): `audit_long_history_evidence.py`
- [Robustness Analysis](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/analyze_recovery_robustness.py): `analyze_recovery_robustness.py`
- [Recovery Diagnostics](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/recovery_diagnostics.py): `recovery_diagnostics.py`
- [Policy Analysis](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/analyze_pillar2.py): `analyze_pillar2.py`
- [Snapshot Integrity](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/snapshot_integrity.py): `snapshot_integrity.py`
- [Actual-Date Audit](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/validate_actual.py): `validate_actual.py`
- [Long-History Audit](https://github.com/beta-blockers/beta_correcting_etfs_backtests/blob/main/audit_long_history_evidence.py): `audit_long_history_evidence.py`

### Other components

- **Researcher**

## Connections

- Researcher → Actual-Date Runs: runs study
- Researcher → Long-History Study: runs study
- Frozen Data → Data Preparation: reads inputs (evidence: `prepare_data.py`)
- Data Preparation → Portfolio Engine: supplies data (evidence: `backtest.py`)
- Wind Row Builder → Wind Report Recovery: uses archive (evidence: `data/eu_restoration/sources/wind/build_rows.py`)
- Actual-Date Runs → Portfolio Engine: runs portfolios (evidence: `run_actual_dates.py`)
- EU Interim Study → Portfolio Engine: runs portfolios (evidence: `run_eu_interim.py`)
- EU Restoration → Portfolio Engine: runs portfolios (evidence: `run_eu_restoration.py`)
- US Restoration → Portfolio Engine: runs portfolios (evidence: `run_us_restoration.py`)
- Coverage Corrections → Portfolio Engine: runs portfolios (evidence: `run_research_corrections.py`)
- Long-History Study → Portfolio Engine: runs portfolios (evidence: `run_long_history.py`)
- Public-Support Screen → Portfolio Engine: runs portfolios (evidence: `run_pillar2.py`)
- Rule Experiments → Portfolio Engine: runs portfolios (evidence: `run_recovery_experiments.py`)
- Rule Experiments → Recovery Rules: configures rules (evidence: `run_recovery_experiments.py`)
- Recovery Rules → Portfolio Engine: uses ranking (evidence: `recovery_rules.py`)
- Actual-Date Runs → Study Results: writes results
- Long-History Study → Study Results: writes results
- History Evidence Audit → Study Results: audits ledgers (evidence: `audit_long_history_evidence.py`)
- Robustness Analysis → Portfolio Engine: reruns portfolios (evidence: `analyze_recovery_robustness.py`)
- Rule Experiments → Recovery Diagnostics: uses diagnostics (evidence: `run_recovery_experiments.py`)
- Policy Analysis → Portfolio Engine: uses engine (evidence: `analyze_pillar2.py`)
- Actual-Date Audit → Portfolio Engine: validates runs (evidence: `validate_actual.py`)
- Snapshot Integrity → Frozen Data: checks snapshots
- Coverage Corrections → Snapshot Integrity: checks snapshots (evidence: `run_research_corrections.py`)
- Long-History Study → Long-History Audit: audits timing (evidence: `run_long_history.py`)
- Issuer Sources → Frozen Data: prepares evidence
