Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Frozen evidence is hashed as bytes; checkouts must not rewrite line endings.
docs/experiments/real-sp500/** -text
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- name: Docs integrity (mkdocs nav resolves)
run: python scripts/check_docs.py

- name: Independently verify the saved real-market comparison
run: python scripts/verify_comparison.py docs/experiments/real-sp500

- name: Unit & regression tests (fast)
run: pytest -m "not slow"

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ data/processed/*
.pytest_tmp/
# MkDocs build output
site/
outputs/
research/real_runs/
research/comparison/
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# AlphaForge

[Real-market comparison](docs/research-comparison.md): frozen data, shared
walk-forward coverage, equal-weight and momentum baselines, three model seeds,
one explicit size-feature ablation, and 22 base/doubled-cost cases. Source
history and availability limitations keep this experiment exploratory.

**Python toolkit for factor research, portfolio construction, and backtesting**

[![CI](https://github.com/dev-belly/alphaforge/actions/workflows/ci.yml/badge.svg)](https://github.com/dev-belly/alphaforge/actions/workflows/ci.yml)
Expand Down
6 changes: 3 additions & 3 deletions configs/real_sp500.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data:
provider: local
universe: SP500
start_date: "2000-01-01"
end_date: "2019-12-31"
end_date: "2019-11-14"
cache_dir: data/processed
raw_dir: data/raw
storage_backend: parquet
Expand Down Expand Up @@ -88,7 +88,7 @@ risk:

backtest:
start_date: "2005-01-01"
end_date: "2019-12-31"
end_date: "2019-11-14"
rebalance: monthly
initial_capital: 10_000_000
execution_lag_days: 1
Expand All @@ -103,7 +103,7 @@ cost:
min_commission: 0.0

reporting:
output_dir: research/reports
output_dir: research/real_runs/report
figure_dpi: 130
figure_format: png

Expand Down
Binary file added docs/experiments/real-sp500/daily_returns.csv.gz
Binary file not shown.
55 changes: 55 additions & 0 deletions docs/experiments/real-sp500/folds.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
method,seed,fold,rank_ic_mean,rank_ic_std,n_days,icir
ridge,11,0,0.04412592633746016,0.0966486106764495,252,0.4565603791779325
ridge,11,1,0.018713655037396176,0.08398618101527376,252,0.22281826380452877
ridge,11,2,-0.02324649092185162,0.0944463490283868,252,-0.24613435205276862
ridge,11,3,0.02219967924672747,0.08837599819123425,251,0.2511957963822964
ridge,11,4,-0.005444657308135957,0.12453645599247631,251,-0.04371938533777522
ridge,11,5,0.009387714645803524,0.10163328992091236,200,0.09236850104044383
ridge,29,0,0.04412592633746016,0.0966486106764495,252,0.4565603791779325
ridge,29,1,0.018713655037396176,0.08398618101527376,252,0.22281826380452877
ridge,29,2,-0.02324649092185162,0.0944463490283868,252,-0.24613435205276862
ridge,29,3,0.02219967924672747,0.08837599819123425,251,0.2511957963822964
ridge,29,4,-0.005444657308135957,0.12453645599247631,251,-0.04371938533777522
ridge,29,5,0.009387714645803524,0.10163328992091236,200,0.09236850104044383
ridge,42,0,0.04412592633746016,0.0966486106764495,252,0.4565603791779325
ridge,42,1,0.018713655037396176,0.08398618101527376,252,0.22281826380452877
ridge,42,2,-0.02324649092185162,0.0944463490283868,252,-0.24613435205276862
ridge,42,3,0.02219967924672747,0.08837599819123425,251,0.2511957963822964
ridge,42,4,-0.005444657308135957,0.12453645599247631,251,-0.04371938533777522
ridge,42,5,0.009387714645803524,0.10163328992091236,200,0.09236850104044383
lightgbm,11,0,0.022477486143247915,0.08734886863632098,252,0.25733002034443564
lightgbm,11,1,0.002234562428456477,0.05797573874961744,252,0.038543060884605324
lightgbm,11,2,-0.0011553035855261433,0.10126092459062845,252,-0.011409174765061003
lightgbm,11,3,0.03166639744953009,0.06502624933653303,251,0.48697868587876997
lightgbm,11,4,0.031668053472560784,0.08124079588245281,251,0.3898048157773004
lightgbm,11,5,0.03433905815716499,0.055633472983191,200,0.6172373629728299
lightgbm,29,0,0.025787883052372746,0.08480912689437926,252,0.3040696679319527
lightgbm,29,1,-0.0030296977978654153,0.057293289941090675,252,-0.05288049963583118
lightgbm,29,2,0.00907244205085725,0.09838261707558023,252,0.09221590480651223
lightgbm,29,3,0.032402329646731974,0.06749892297971691,251,0.48004217276872274
lightgbm,29,4,0.017454562276111394,0.08673166092103583,251,0.20124787293077168
lightgbm,29,5,0.039869933952373565,0.06175223753608078,200,0.6456435514434314
lightgbm,42,0,0.020528439407260922,0.09214009289193455,252,0.22279594867933838
lightgbm,42,1,-0.0035977333884247465,0.0583879427725417,252,-0.06161774533554323
lightgbm,42,2,0.005875082979020472,0.1014245680706104,252,0.05792563962343245
lightgbm,42,3,0.03195550150870484,0.06497403962210874,251,0.4918195281463049
lightgbm,42,4,0.017572815275974017,0.08240420495439846,251,0.21325143887619097
lightgbm,42,5,0.04023812238863307,0.05787186037686153,200,0.6952968528504602
ridge_without_size_feature,11,0,0.04359069019775172,0.09661460929879445,252,0.4511811465587083
ridge_without_size_feature,11,1,0.016504867360824224,0.08288305728509346,252,0.19913439370428038
ridge_without_size_feature,11,2,-0.02476588151153135,0.09478300955559105,252,-0.2612903053791086
ridge_without_size_feature,11,3,0.02027092225650099,0.09210790690979509,251,0.22007798175625798
ridge_without_size_feature,11,4,-0.007838736870762348,0.12484721777420321,251,-0.0627866364226023
ridge_without_size_feature,11,5,0.0029383498668230815,0.10368188633286714,200,0.02834005023201073
ridge_without_size_feature,29,0,0.04359069019775172,0.09661460929879445,252,0.4511811465587083
ridge_without_size_feature,29,1,0.016504867360824224,0.08288305728509346,252,0.19913439370428038
ridge_without_size_feature,29,2,-0.02476588151153135,0.09478300955559105,252,-0.2612903053791086
ridge_without_size_feature,29,3,0.02027092225650099,0.09210790690979509,251,0.22007798175625798
ridge_without_size_feature,29,4,-0.007838736870762348,0.12484721777420321,251,-0.0627866364226023
ridge_without_size_feature,29,5,0.0029383498668230815,0.10368188633286714,200,0.02834005023201073
ridge_without_size_feature,42,0,0.04359069019775172,0.09661460929879445,252,0.4511811465587083
ridge_without_size_feature,42,1,0.016504867360824224,0.08288305728509346,252,0.19913439370428038
ridge_without_size_feature,42,2,-0.02476588151153135,0.09478300955559105,252,-0.2612903053791086
ridge_without_size_feature,42,3,0.02027092225650099,0.09210790690979509,251,0.22007798175625798
ridge_without_size_feature,42,4,-0.007838736870762348,0.12484721777420321,251,-0.0627866364226023
ridge_without_size_feature,42,5,0.0029383498668230815,0.10368188633286714,200,0.02834005023201073
10 changes: 10 additions & 0 deletions docs/experiments/real-sp500/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html><html lang="en"><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"><title>AlphaForge · Frozen comparison</title>
<style>:root{font-family:system-ui;color-scheme:dark;background:#111319;color:#eee}main{max-width:1100px;margin:auto;padding:2rem}h1{font-size:3rem}a{color:#d7fa73}table{border-collapse:collapse;width:100%}td,th{padding:.6rem;text-align:left;border-bottom:1px solid #444;white-space:nowrap}.scroll{overflow:auto}aside{padding:1rem;border-left:3px solid #ffb994}</style>
<main><p>EXPLORATORY_REAL_MARKET</p><h1>One dataset.<br>Declared comparisons.</h1>
<p>840,736 samples · 24 usable features · 551,698 shared forecasts.
Models, the fixed momentum baseline and equal-weight baseline share dates, outcomes, execution lag and cost rules.</p>
<aside>Seed variation is not market sampling uncertainty or proof of tradable alpha.<br>Cost inputs are fixed scenarios, not measured execution costs.<br>The equal-weight baseline differs in diversification; its holdings rule is explicit.<br>Source hashes establish identity, not complete historical data quality.<br>Historical membership is incomplete; survivorship/selection bias remains.<br>Financial availability is an assumed lag, not actual publication history.<br>Size uses a dollar-volume proxy, not measured market capitalization.</aside>
<h2>All methods and cost scenarios</h2><div class="scroll"><table><tr><th>Method</th><th>Costs</th><th>Runs</th><th>Net CAGR</th><th>Net Sharpe mean ± seed std</th><th>Max drawdown</th></tr><tr><td>equal_weight</td><td>1×</td><td>1</td><td>12.75%</td><td>1.141 ± 0.000</td><td>-18.70%</td></tr><tr><td>equal_weight</td><td>2×</td><td>1</td><td>12.70%</td><td>1.137 ± 0.000</td><td>-18.71%</td></tr><tr><td>lightgbm</td><td>1×</td><td>3</td><td>18.23%</td><td>1.337 ± 0.022</td><td>-21.46%</td></tr><tr><td>lightgbm</td><td>2×</td><td>3</td><td>17.51%</td><td>1.290 ± 0.023</td><td>-21.64%</td></tr><tr><td>ridge</td><td>1×</td><td>3</td><td>12.85%</td><td>1.005 ± 0.000</td><td>-22.06%</td></tr><tr><td>ridge</td><td>2×</td><td>3</td><td>12.20%</td><td>0.960 ± 0.000</td><td>-22.20%</td></tr><tr><td>ridge_without_size_feature</td><td>1×</td><td>3</td><td>12.24%</td><td>0.955 ± 0.000</td><td>-21.68%</td></tr><tr><td>ridge_without_size_feature</td><td>2×</td><td>3</td><td>11.58%</td><td>0.909 ± 0.000</td><td>-21.84%</td></tr><tr><td>single_momentum</td><td>1×</td><td>1</td><td>11.38%</td><td>0.871 ± 0.000</td><td>-23.40%</td></tr><tr><td>single_momentum</td><td>2×</td><td>1</td><td>10.95%</td><td>0.842 ± 0.000</td><td>-23.47%</td></tr></table></div>
<p><a href="summary.json">Source identity, exact protocol and all runs</a> · <a href="metrics.csv">Metrics CSV</a> · <a href="folds.csv">Fold results</a> · <a href="daily_returns.csv.gz">Daily returns (gzip CSV)</a> · <a href="manifest.json">Hashes</a></p>
<p>This is a protocol comparison. Its real-market variant remains exploratory until the declared source limitations are resolved. No test result selects a model or seed for deployment.</p></main></html>
10 changes: 10 additions & 0 deletions docs/experiments/real-sp500/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dataset_sha256": "8906ace6a84d22bdc78a05fedcd75498d964dd56555da00492892f5eb7a9a7cd",
"files_sha256": {
"daily_returns.csv.gz": "87eb8aeee44cd396844433d06cc0b3d937041c9710d55e1418acebc2d6b09ede",
"folds.csv": "8ae472f7117df46258db54cfff3a5bb349df99e04fdeceb1e3ce37a7c8ac88df",
"index.html": "aa9003c9a31717baafba4838c7955ed62ec63ca76e424a518af4cb6e8b44ac2e",
"metrics.csv": "41b0d117631aa0613d0d054b817a959c3792079ec775ea3c73a409265d89d106",
"summary.json": "8f51affb4f487f9cb25995e89de91d831b5e2e4933ea69495478d4883066a2fb"
}
}
Loading
Loading