# mcompetitions/m6-methods architecture

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

- Interactive diagram: https://gitdiagram.com/mcompetitions/m6-methods
- Repository: https://github.com/mcompetitions/m6-methods

## Overview

This repository supports the M6 forecasting competition: it provides price-data acquisition, example IR/RPS evaluation, and scripts and data for reproducing the IJF paper’s analyses. The main user-facing workflow is to obtain asset prices, combine historical prices with a submission, and calculate evaluation scores. The paper workflow includes price cleaning and volatility/risk estimation as well as benchmark, hypothesis, forecasting, and submission analyses. Several paper scripts and the R implementations are documented but not sampled, so their internal calls and data wiring are not inferred.

Main entry points: [`RPS and IR calculation.py`](https://github.com/mcompetitions/m6-methods/blob/main/RPS%20and%20IR%20calculation.py) (IR and RPS calculation), [`IJF paper/s6_load m6 data clean.py`](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_load%20m6%20data%20clean.py) (Price cleaning and volatility), [`IJF paper/s6_factor model2.py`](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_factor%20model2.py) (Factor risk model), [`IJF paper`](https://github.com/mcompetitions/m6-methods/tree/main/IJF%20paper) (Risk model estimates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Price data"]
  node_download_py["Yahoo download &#40;Python&#41;"]
  node_download_r["Yahoo download &#40;R&#41;"]
  node_price_data["M6 asset prices<br/>[assets_m6.csv]"]
end

subgraph group_evaluation["Competition evaluation"]
  node_submission_template["Submission template<br/>[template.csv]"]
  node_score_calc["IR and RPS calculation"]
  node_score_example["Score example"]
end

subgraph group_paperdata["Paper data and models"]
  node_paper_submissions["Competition submissions<br/>[submissions.csv]"]
  node_paper_prices["Paper price data<br/>[assets_m6.csv]"]
  node_clean_model["Price cleaning and volatility"]
  node_factor_model["Factor risk model"]
  node_risk_outputs["Risk model estimates"]
end

subgraph group_paperanalysis["Paper analyses"]
  node_submission_analysis["Submission and risk analysis"]
  node_benchmark["Benchmark analyses"]
  node_hypotheses["Hypothesis analyses"]
  node_forecast_investing["Forecasting and investing"]
  node_submission_stats["Submission statistics<br/>[submission stats.R]"]
end

node_researcher(("Researcher"))
node_yahoo(("Yahoo Finance"))

node_researcher -->|"runs download"| node_download_py
node_researcher -->|"runs download"| node_download_r
node_yahoo -->|"provides prices"| node_download_py
node_yahoo -->|"provides prices"| node_download_r
node_researcher -->|"runs evaluation"| node_score_calc
node_price_data -->|"historical prices"| node_score_calc
node_submission_template -->|"submission weights"| node_score_calc
node_score_calc -.->|"illustrates scores"| node_score_example
node_researcher -->|"runs paper workflow"| node_clean_model
node_paper_prices -->|"price history"| node_clean_model
node_clean_model -->|"cleaned price data"| node_factor_model
node_factor_model -->|"writes risk estimates"| node_risk_outputs
node_risk_outputs -->|"risk inputs"| node_submission_analysis
node_researcher -->|"runs analysis"| node_submission_analysis
node_researcher -->|"runs analysis"| node_benchmark
node_researcher -->|"runs analyses"| node_hypotheses
node_researcher -->|"runs analysis"| node_forecast_investing
node_researcher -->|"runs analysis"| node_submission_stats

click node_download_py "https://github.com/mcompetitions/m6-methods/blob/main/Download%20historical%20data%20using%20Yahoo%20API.py"
click node_download_r "https://github.com/mcompetitions/m6-methods/blob/main/Download%20historical%20data%20using%20Yahoo%20API.R"
click node_price_data "https://github.com/mcompetitions/m6-methods/blob/main/assets_m6.csv"
click node_submission_template "https://github.com/mcompetitions/m6-methods/blob/main/template.csv"
click node_score_calc "https://github.com/mcompetitions/m6-methods/blob/main/RPS%20and%20IR%20calculation.py"
click node_score_example "https://github.com/mcompetitions/m6-methods/blob/main/Evaluation%20-%20example.xlsx"
click node_paper_submissions "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/submissions.csv"
click node_paper_prices "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/assets_m6.csv"
click node_clean_model "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_load%20m6%20data%20clean.py"
click node_factor_model "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_factor%20model2.py"
click node_risk_outputs "https://github.com/mcompetitions/m6-methods/tree/main/IJF%20paper"
click node_submission_analysis "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_Submission%20Analysis.py"
click node_benchmark "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/Better%20than%20the%20benchmark.R"
click node_hypotheses "https://github.com/mcompetitions/m6-methods/tree/main/IJF%20paper"
click node_forecast_investing "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/forecast-investing%20connection.R"
click node_submission_stats "https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/submission%20stats.R"

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_download_py,node_download_r,node_price_data toneBlue
class node_submission_template,node_score_calc,node_score_example toneAmber
class node_paper_submissions,node_paper_prices,node_clean_model,node_factor_model,node_risk_outputs toneMint
class node_submission_analysis,node_benchmark,node_hypotheses,node_forecast_investing,node_submission_stats toneRose
class node_researcher,node_yahoo toneIndigo
```

## Components

### Price data

- [Yahoo download (Python)](https://github.com/mcompetitions/m6-methods/blob/main/Download%20historical%20data%20using%20Yahoo%20API.py): `Download historical data using Yahoo API.py`
- [Yahoo download (R)](https://github.com/mcompetitions/m6-methods/blob/main/Download%20historical%20data%20using%20Yahoo%20API.R): `Download historical data using Yahoo API.R`
- [M6 asset prices](https://github.com/mcompetitions/m6-methods/blob/main/assets_m6.csv): `assets_m6.csv`

### Competition evaluation

- [Submission template](https://github.com/mcompetitions/m6-methods/blob/main/template.csv): `template.csv`
- [IR and RPS calculation](https://github.com/mcompetitions/m6-methods/blob/main/RPS%20and%20IR%20calculation.py): `RPS and IR calculation.py`
- [Score example](https://github.com/mcompetitions/m6-methods/blob/main/Evaluation%20-%20example.xlsx): `Evaluation - example.xlsx`

### Paper data and models

- [Competition submissions](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/submissions.csv): `IJF paper/submissions.csv`
- [Paper price data](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/assets_m6.csv): `IJF paper/assets_m6.csv`
- [Price cleaning and volatility](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_load%20m6%20data%20clean.py): `IJF paper/s6_load m6 data clean.py`
- [Factor risk model](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_factor%20model2.py): `IJF paper/s6_factor model2.py`
- [Risk model estimates](https://github.com/mcompetitions/m6-methods/tree/main/IJF%20paper): `IJF paper`

### Paper analyses

- [Submission and risk analysis](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/s6_Submission%20Analysis.py): `IJF paper/s6_Submission Analysis.py`
- [Benchmark analyses](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/Better%20than%20the%20benchmark.R): `IJF paper/Better than the benchmark.R`
- [Hypothesis analyses](https://github.com/mcompetitions/m6-methods/tree/main/IJF%20paper): `IJF paper`
- [Forecasting and investing](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/forecast-investing%20connection.R): `IJF paper/forecast-investing connection.R`
- [Submission statistics](https://github.com/mcompetitions/m6-methods/blob/main/IJF%20paper/submission%20stats.R): `IJF paper/submission stats.R`

### Other components

- **Researcher**
- **Yahoo Finance**

## Connections

- Researcher → Yahoo download (Python): runs download
- Researcher → Yahoo download (R): runs download
- Yahoo Finance → Yahoo download (Python): provides prices
- Yahoo Finance → Yahoo download (R): provides prices
- Researcher → IR and RPS calculation: runs evaluation
- M6 asset prices → IR and RPS calculation: historical prices
- Submission template → IR and RPS calculation: submission weights
- IR and RPS calculation → Score example: illustrates scores
- Researcher → Price cleaning and volatility: runs paper workflow
- Paper price data → Price cleaning and volatility: price history
- Price cleaning and volatility → Factor risk model: cleaned price data
- Factor risk model → Risk model estimates: writes risk estimates
- Risk model estimates → Submission and risk analysis: risk inputs
- Researcher → Submission and risk analysis: runs analysis
- Researcher → Benchmark analyses: runs analysis
- Researcher → Hypothesis analyses: runs analyses
- Researcher → Forecasting and investing: runs analysis
- Researcher → Submission statistics: runs analysis
