# batistedecat/etf-model-1 architecture

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

- Interactive diagram: https://gitdiagram.com/batistedecat/etf-model-1
- Repository: https://github.com/batistedecat/etf-model-1
- Video tour (about a minute): https://gitdiagram.com/batistedecat/etf-model-1/video

## Overview

ETF engine is an R workflow that turns configured fund assumptions and Yahoo Finance prices into historical analysis, return forecasts, simulated outcomes, risk measures, rule checks, and PDF reports. Users supply ETF and club inputs in config/club.yml; run_all.R runs the pipeline across configured ETFs and also produces a side-by-side CSV. The graph follows relationships documented in the README; source excerpts were unavailable, so implementation details beyond that documentation are not inferred.

Main entry points: [`R/pipeline.R`](https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R) (ETF pipeline), [`R/risico.R`](https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R) (Student-t fit), [`R/data.R`](https://github.com/batistedecat/etf-model-1/blob/main/R/data.R) (Load ETF prices), [`config/club.yml`](https://github.com/batistedecat/etf-model-1/blob/main/config/club.yml) (ETF configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs"]
  node_research_inputs["Fund research"]
  node_etf_config["ETF configuration<br/>[club.yml]"]
  node_yahoo[("Yahoo Finance")]
end

subgraph group_workflow["Orchestration"]
  node_load_config["Read configuration<br/>[pipeline.R]"]
  node_batch_runner["Batch runner<br/>[run_all.R]"]
  node_etf_runner["ETF pipeline<br/>[pipeline.R]"]
  node_club_limits["Club limit checks<br/>[pipeline.R]"]
end

subgraph group_analysis["Investment Analysis"]
  node_price_loader["Load ETF prices<br/>[data.R]"]
  node_history["Historical performance<br/>[historiek.R]"]
  node_return_forecast["Return forecast<br/>[rendement.R]"]
  node_simulation["Monte Carlo paths<br/>[montecarlo.R]"]
end

subgraph group_risk["Risk Analysis"]
  node_return_prep["Prepare returns<br/>[risico.R]"]
  node_student_t_fit["Student-t fit<br/>[risico.R]"]
  node_daily_risk["Daily risk measures<br/>[risico.R]"]
  node_risk_backtest["Risk backtest<br/>[risico.R]"]
  node_horizon_risk["Horizon risk<br/>[risico.R]"]
end

subgraph group_outputs["Reporting"]
  node_report_template["Report template<br/>[rapport.Rmd]"]
  node_pdf_reports["ETF PDF reports"]
  node_comparison_csv["ETF comparison CSV"]
end

node_club_user(("Club user"))

node_club_user -->|"researches funds"| node_research_inputs
node_research_inputs -->|"sets assumptions"| node_etf_config
node_club_user -->|"configures ETFs"| node_etf_config
node_etf_config -->|"read by"| node_load_config
node_load_config -->|"configures run"| node_etf_runner
node_batch_runner -->|"runs configured ETFs"| node_etf_config
node_batch_runner -->|"runs each ETF"| node_etf_runner
node_etf_runner -->|"loads prices"| node_price_loader
node_yahoo -->|"provides prices"| node_price_loader
node_price_loader -->|"supplies prices"| node_history
node_etf_runner -->|"forecasts returns"| node_return_forecast
node_return_forecast -->|"supplies scenarios"| node_simulation
node_history -->|"supplies volatility"| node_simulation
node_price_loader -->|"supplies returns"| node_return_prep
node_return_prep -->|"prepares fit data"| node_student_t_fit
node_student_t_fit -->|"fits risk model"| node_daily_risk
node_student_t_fit -->|"fits backtest model"| node_risk_backtest
node_student_t_fit -->|"fits horizon model"| node_horizon_risk
node_etf_runner -->|"checks club limits"| node_club_limits
node_etf_runner -->|"prepares report"| node_report_template
node_report_template -->|"renders PDFs"| node_pdf_reports
node_batch_runner -->|"writes comparison"| node_comparison_csv

click node_etf_config "https://github.com/batistedecat/etf-model-1/blob/main/config/club.yml"
click node_load_config "https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R"
click node_batch_runner "https://github.com/batistedecat/etf-model-1/blob/main/run_all.R"
click node_etf_runner "https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R"
click node_price_loader "https://github.com/batistedecat/etf-model-1/blob/main/R/data.R"
click node_history "https://github.com/batistedecat/etf-model-1/blob/main/R/historiek.R"
click node_return_forecast "https://github.com/batistedecat/etf-model-1/blob/main/R/rendement.R"
click node_simulation "https://github.com/batistedecat/etf-model-1/blob/main/R/montecarlo.R"
click node_return_prep "https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R"
click node_student_t_fit "https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R"
click node_daily_risk "https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R"
click node_risk_backtest "https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R"
click node_horizon_risk "https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R"
click node_club_limits "https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R"
click node_report_template "https://github.com/batistedecat/etf-model-1/blob/main/rapport.Rmd"

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_research_inputs,node_etf_config,node_yahoo,node_club_user toneBlue
class node_load_config,node_batch_runner,node_etf_runner,node_club_limits toneAmber
class node_price_loader,node_history,node_return_forecast,node_simulation toneMint
class node_return_prep,node_student_t_fit,node_daily_risk,node_risk_backtest,node_horizon_risk toneRose
class node_report_template,node_pdf_reports,node_comparison_csv toneIndigo
```

## Components

### Inputs

- **Fund research**
- [ETF configuration](https://github.com/batistedecat/etf-model-1/blob/main/config/club.yml): `config/club.yml`
- **Yahoo Finance**

### Orchestration

- [Read configuration](https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R): `R/pipeline.R`
- [Batch runner](https://github.com/batistedecat/etf-model-1/blob/main/run_all.R): `run_all.R`
- [ETF pipeline](https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R): `R/pipeline.R`
- [Club limit checks](https://github.com/batistedecat/etf-model-1/blob/main/R/pipeline.R): `R/pipeline.R`

### Investment Analysis

- [Load ETF prices](https://github.com/batistedecat/etf-model-1/blob/main/R/data.R): `R/data.R`
- [Historical performance](https://github.com/batistedecat/etf-model-1/blob/main/R/historiek.R): `R/historiek.R`
- [Return forecast](https://github.com/batistedecat/etf-model-1/blob/main/R/rendement.R): `R/rendement.R`
- [Monte Carlo paths](https://github.com/batistedecat/etf-model-1/blob/main/R/montecarlo.R): `R/montecarlo.R`

### Risk Analysis

- [Prepare returns](https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R): `R/risico.R`
- [Student-t fit](https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R): `R/risico.R`
- [Daily risk measures](https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R): `R/risico.R`
- [Risk backtest](https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R): `R/risico.R`
- [Horizon risk](https://github.com/batistedecat/etf-model-1/blob/main/R/risico.R): `R/risico.R`

### Reporting

- [Report template](https://github.com/batistedecat/etf-model-1/blob/main/rapport.Rmd): `rapport.Rmd`
- **ETF PDF reports**
- **ETF comparison CSV**

### Other components

- **Club user**

## Connections

- Club user → Fund research: researches funds (evidence: `README.md`)
- Fund research → ETF configuration: sets assumptions (evidence: `README.md`)
- Club user → ETF configuration: configures ETFs (evidence: `README.md`)
- ETF configuration → Read configuration: read by (evidence: `README.md`)
- Read configuration → ETF pipeline: configures run (evidence: `README.md`)
- Batch runner → ETF configuration: runs configured ETFs (evidence: `README.md`)
- Batch runner → ETF pipeline: runs each ETF (evidence: `README.md`)
- ETF pipeline → Load ETF prices: loads prices (evidence: `README.md`)
- Yahoo Finance → Load ETF prices: provides prices (evidence: `README.md`)
- Load ETF prices → Historical performance: supplies prices (evidence: `README.md`)
- ETF pipeline → Return forecast: forecasts returns (evidence: `README.md`)
- Return forecast → Monte Carlo paths: supplies scenarios (evidence: `README.md`)
- Historical performance → Monte Carlo paths: supplies volatility (evidence: `README.md`)
- Load ETF prices → Prepare returns: supplies returns (evidence: `README.md`)
- Prepare returns → Student-t fit: prepares fit data (evidence: `README.md`)
- Student-t fit → Daily risk measures: fits risk model (evidence: `README.md`)
- Student-t fit → Risk backtest: fits backtest model (evidence: `README.md`)
- Student-t fit → Horizon risk: fits horizon model (evidence: `README.md`)
- ETF pipeline → Club limit checks: checks club limits (evidence: `README.md`)
- ETF pipeline → Report template: prepares report (evidence: `README.md`)
- Report template → ETF PDF reports: renders PDFs (evidence: `README.md`)
- Batch runner → ETF comparison CSV: writes comparison (evidence: `README.md`)
