SPB Git

spb/wp41_uqo

Public
9.0 KB · 141 lines markdown
1<!-- Author: Simon-Pierre Boucher — simon-pierre.boucher@uqo.ca -->2# ⏱️ CHRONOS-X34**UQO Working Paper No. 41** — *Universal Intraday Representation Learning for Probabilistic Financial Forecasting*56[![Paper](https://img.shields.io/badge/paper-PDF-b31b1b?logo=latex&logoColor=white)](paper/main.pdf)7[![Python](https://img.shields.io/badge/python-3.12%2B%20·%20uv%20·%20PyTorch%20MPS-3776AB?logo=python&logoColor=white)](pyproject.toml)8[![Data](https://img.shields.io/badge/data-FinData%20OS%20·%20300%20instruments%20·%20234%20M%201--min%20bars-4051b5)](docs/DATA_CARD.md)9[![Reproducible](https://img.shields.io/badge/reproducible-tests%20·%20synthetic%20example%20·%20phase%20reports-2e7d32)](docs/REPRODUCIBILITY.md)10[![Institution](https://img.shields.io/badge/UQO-D%C3%A9pt.%20des%20sciences%20administratives-16365c)](https://uqo.ca)11[![Author](https://img.shields.io/badge/author-Simon--Pierre%20Boucher-16365c)](mailto:simon-pierre.boucher@uqo.ca)1213> **TL;DR** — Can a compact multi-resolution patch Transformer (MRPT) that reads the last 390 one-minute bars plus14> five days of 5-minute and twenty days of 30-minute past-only aggregates produce better-calibrated distributions15> of the next 5/15/30/60-minute returns than equal-budget one-minute-only models and well-specified volatility16> baselines? Tested on 300 U.S. stocks and ETFs (2018–2025, 234 M one-minute bars from FinData OS), with17> matched information sets, proper scoring rules, day-cluster inference, 60 held-out instruments and an untouched18> 2025 test. **See `docs/PHASE_5..7_REPORT.md` and the paper for the measured answer; no claim is made beyond them.**1920---2122## 📌 Status2324| Item | Value |25|---|---|26| Version | 1.0 (November 2026) — built autonomously on 2026-11-02 under the owner's brief (`CLAUDE.md`) |27| SSRN | not yet submitted |28| Journal | — (research software + working paper) |29| Code & data | reproducible from `scripts/` against FinData OS (private FirstRate Data license); synthetic example runs without a license |3031## 🎯 What this paper does3233Five pre-registered, falsifiable hypotheses (`paper/sections/hypotheses.tex`): H1 multi-resolution context vs34one-minute-only at equal parameters; H2 transfer to unseen instruments; H3 history-only regime conditioning and35calibration under stress; H4 coherent joint paths (low-rank Gaussian copula over the 60 future minutes) vs36independent marginals; H5 (exploratory) economic content after assumed costs. Targets are return distributions37(per-minute Student-t marginals, cumulative returns, realised variance, tail events), never price levels.3839## 🏆 Headline results (scaled CRPS of the cumulative return; 2024 development test, 986 468 origins; 2025 untouched, 1 008 425)4041| Object | 2024 (H=5 / H=60) | 2025 (H=5 / H=60) |42|---|---|---|43| Random walk (trailing scale) | 0.4699 / 0.4347 | 0.4759 / 0.4409 |44| HAR-RV (minute scale, Student-t) | 0.4615 / **0.4166** | 0.4674 / **0.4232** |45| MRPT-S multi-resolution (3.5 M params) | **0.4531** / 0.4187 | **0.4594** / 0.4256 |46| MRPT-S one-minute only | 0.4533 / 0.4192 | 0.4594 / 0.4257 |47| MRPT-B (20.7 M params) | 0.4532 / 0.4189 | 0.4595 / 0.4257 |48| H1 multi-res vs 1m-only | −0.04 % / −0.10 % (t −5) | +0.01 % / +0.01 % (Holm p ≥ 0.36) → **rejected in substance** |49| H2 zero-shot on 60 unseen instruments vs random walk | −4.1 % / −4.3 % (pooled −4.05 % / −4.27 %) → **no transfer penalty** | same in 2025 |50| H3 regime conditioning | +0.02 … +0.03 % CRPS, identical stress-day coverage → **rejected** | |51| H4 copula paths vs independent | energy −0.003 %, variogram −0.002 % (CIs ∋ 0) → **rejected** | |52| H5 economic content | corr(median, realised) ≤ 0.025; net 0.0 bp [−1.7, +1.8] at 1 bp cost → **rejected** | |53| Time-only inputs (no returns/volumes) | +0.2 … +0.3 % vs full model: ≈ 90 % of the skill is trailing volatility + clock | |5455## 🗂 Repository layout5657```58wp41_uqo/59├── CLAUDE.md · README.md · pyproject.toml · Makefile60├── configs/        pilot · feasibility · main · ablations · baselines · final · synthetic_smoke (.yaml)61├── src/chronos_x/62│   ├── data/       client · exports · universe · calendar · quality · adjustments · features · windows · synthetic63│   ├── models/     patches · encoder · fusion · regime · student_t · joint_path · model64│   ├── train/      trainer · losses · sampling · checkpoint · tracking65│   ├── eval/       scores · calibration · statistics · subgroups · economic · figures66│   ├── baselines/  naive · har · garch · trees · neural · features67│   ├── inference/  predict · serialization · cli68│   └── pipeline.py · experiment.py · config.py69├── scripts/        audit_api · build_universe · audit_coverage · download_pilot · run_experiment · train_pilot · train_main70│                   · benchmark · evaluate · make_figures · build_references · make_synthetic · node_run.sh71├── tests/          unit · integration (live API, synthetic pipeline) · leakage · synthetic · numerical72├── data/manifests  universe_main.json (hash inside) · universe_main_v1_precoverage.json · candidates · universe_synthetic.json73├── results/        metrics/<exp>/ (summaries, leaderboards, comparisons, train logs) · logs/ (provenance JSONL)74├── paper/          main.tex · sections/ · tables/ (generated) · figures/ (generated) · references.bib (Crossref-verified) · main.pdf75└── docs/           DATA_CARD · MODEL_CARD · REPRODUCIBILITY · LICENSE · OPERATIONS · PHASE_0..9_REPORT76```7778## 🚀 Quick start7980```bash81make install && make test                                   # venv + 26 offline tests82.venv/bin/python scripts/make_synthetic.py                  # license-free fixtures in the FinData schema83.venv/bin/python scripts/run_experiment.py --config configs/synthetic_smoke.yaml   # bars -> grids -> baselines -> MRPT -> scores (~3 min)84.venv/bin/python scripts/evaluate.py --exps synthetic_smoke && .venv/bin/python scripts/make_figures.py --exps synthetic_smoke85cd paper && make                                            # latexmk -> main.pdf86```87Full study: `docs/REPRODUCIBILITY.md`. Compute node and operations: `docs/OPERATIONS.md`.8889## 🗃 Data9091FinData OS (`https://findata.spboucher.ai/api/v1`), FirstRate Data one-minute bars, private license (no raw data in92this repository). Universe: 300 instruments selected point-in-time at 2017-12-29 (ADV ≥ 5 M USD, ≥ 80 % regular-hours93minute coverage, stratified by asset class × dollar volume × volatility, SIC / ETF category balanced), 60 held out.94Sample 2018-01-02 → 2025-12-31: 233 958 776 rows, 220 142 835 in regular hours. Details and conventions (bar-open95stamps, 391/211-slot sessions, masks, split policy): `docs/DATA_CARD.md`, `docs/PHASE_0_REPORT.md`, `docs/PHASE_1_REPORT.md`.9697## 🔬 Methodology98991. Audit the live API and conventions on real rows (`scripts/audit_api.py`, live tests).1002. Build the PIT universe, audit coverage, freeze the manifest (`build_universe.py`, `audit_coverage.py`).1013. Export bars per instrument, build dense grids and past-only aggregates (`download_pilot.py`, `data/features.py`).1024. Index origins and build causal windows and masked targets (`data/windows.py`; leakage tests).1035. Fit baselines on the same origins (`baselines/`, `experiment.fit_and_predict_baselines`).1046. Train MRPT variants with the Student-t NLL, early stopping and checkpoints (`train/trainer.py`).1057. Predict, sample, score, bootstrap and test (`inference/predict.py`, `eval/`, `pipeline.py`).1068. Ablations, zero-shot instruments, untouched 2025 (`configs/ablations.yaml`, `--heldout`, `configs/final.yaml`).1079. Tables, macros and figures from saved results only (`evaluate.py`, `make_figures.py`); LaTeX build.108109## 🖼 Figures & tables inventory110111Generated into `paper/figures/` and `paper/tables/` by the scripts above (see `docs/PHASE_8_REPORT.md`).112113## ⚠️ Limitations114115Survivor-heavy liquid universe (coverage gate; delisted archives partial), bars without quotes, regular hours only,116single-node compute without mixed precision, foundation-model baselines not run. Full list: `paper/sections/limitations.tex`.117118## 📝 Citation119120```bibtex121@techreport{boucher2026chronosx,122  author      = {Boucher, Simon-Pierre},123  title       = {CHRONOS-X: Universal Intraday Representation Learning for Probabilistic Financial Forecasting},124  institution = {Universit\'e du Qu\'ebec en Outaouais, D\'epartement des sciences administratives},125  type        = {Working Paper},126  number      = {41},127  year        = {2026},128  month       = {November}129}130```131132## 👤 Author & contact133134**Simon-Pierre Boucher** — Département des sciences administratives, Université du Québec en Outaouais (UQO), Gatineau, QC.135📧 [simon-pierre.boucher@uqo.ca](mailto:simon-pierre.boucher@uqo.ca)136137## 🗒 Notes138139- Directory named `wp41_uqo` as requested by the brief (the standard would be a descriptive slug).140- Intraday data: FirstRate Data (private license), accessed through FinData OS; attribution required, redistribution prohibited.141
Files · main
Menu

Theme