Skip to content

Repository files navigation

VARES

Can the failure of an algorithmic trading strategy be predicted before its realized performance collapses?

A reproducible research programme that treats the strategy through time as the unit of observation, and answers to a design frozen before the data was collected.

Manuscript Go 1.26.5 Julia 1.12.6 Endpoint Empirical claims

▶ Read the manuscript · Research protocol · Novelty map · Risk register


What this is, in one paragraph

Trading strategies are normally judged by a static backtest score computed once, at the end of the process that also selected them. VARES asks a different question: given everything knowable at a decision point, what is the probability that this strategy crosses a pre-registered economic failure endpoint within the next 126 events? The failure endpoint, the feature whitelist, the model and the primary metric were all frozen — and the endpoint is hash-guarded, so the modelling stage refuses to run if it changes. data/ is empty and outputs/ is empty because the frozen pipeline has not been run on empirical data yet. That is the current state, not an omission. The design is in paper/MANUSCRIPT.md.


Status: Phase 8B / frozen fixed-horizon reliability model + prequential evaluation
Repository version: 0.13.0
Literature snapshot: 2026-08-19

VARES is a reproducible research project for studying whether the future deterioration of an algorithmic trading strategy can be predicted before realized performance collapses.

The project is deliberately not framed as another "predict tomorrow's price" system. The observation unit is the strategy through time. The planned research target is a dynamic reliability state / time-dependent failure risk conditioned on:

  • backtest validity and overfitting diagnostics,
  • parameter robustness,
  • market regime and regime-transition exposure,
  • volatility and tail-risk dynamics,
  • forecast calibration / uncertainty stress,
  • transaction-cost and execution fragility.

The research question is intentionally stronger than static OOS performance prediction:

Does a dynamic strategy-reliability model provide incremental predictive information about future strategy deterioration beyond Sharpe, DSR, PBO, MRP and static backtest-fingerprint models?

Repository roles

  • Go: deterministic market-data / simulation / backtest execution layer.
  • Julia: statistical research, regime/risk models, uncertainty calibration, reliability/survival modelling, inference, plots and paper tables.
  • Arrow/Parquet: language-neutral research boundary; P4 materializes the canonical Go trace into Arrow on the Julia side.

The repository now contains the research contract, point-in-time data controls, deterministic synthetic laboratories, auditable Go execution/accounting, a frozen 17-trial strategy universe, Julia/Float64 backtest fingerprints, causal walk-forward Markov-switching probabilities, exact BOCPD structural-instability features and causal strategy-by-regime durability snapshots, causal one-step-ahead volatility/VaR/ES forecasts, rolling coverage diagnostics, causal conformal VaR corrections, filtered-regime conditional calibration snapshots, a frozen P7 failure endpoint, and the P8A strategy-by-landmark causal predictor/target boundary.

First commands

cd ~/Documents/VARES
make doctor
make test-go
make test-julia
make test-p1
make test-p2
make test-p3
make test-p4
make test-p5a
make test-p5b
make test-p6a
make test-p6b
make test-p6
make test-p7
make test-p8a

make doctor verifies the pinned VARES research toolchain. This repository remains on Julia 1.12.6 and Go 1.26.5 for reproducibility even when newer upstream releases exist. Toolchain changes require an explicit project-version decision rather than an implicit upgrade.

Non-negotiable research rules

  1. No random train/test split for time-dependent claims.
  2. No full-sample regime decoding for historical features.
  3. No survivorship-biased constituent history in the primary empirical sample.
  4. No changing the primary failure endpoint after inspecting model results.
  5. All strategy trials/parameter variants are logged, including losing variants.
  6. Net results include stated cost/slippage assumptions and stress tests.
  7. Multiple-testing / data-snooping controls are first-class baselines.
  8. Static OOS fingerprint prediction is a baseline, not a novelty claim.
  9. Code, configuration, data hashes and output manifests must support reproduction.
  10. A result is publishable only if it survives cross-time and cross-strategy-family tests.

Project documents

  • docs/RESEARCH_PROTOCOL.md — scientific contract and decision gates.
  • docs/NOVELTY_MAP.md — what prior literature already does and what VARES must add.
  • docs/PATCH_PLAN.md — step-by-step development plan.
  • docs/ARCHITECTURE.md — Go/Julia boundary and data flow.
  • docs/PATCH_WORKFLOW.md — how future changed-file patches will be delivered.
  • docs/RISK_REGISTER.md — threats that can invalidate the paper.
  • research/literature_matrix.csv — first structured literature matrix.
  • research/protocol.toml — machine-readable research protocol.
  • paper/references.bib — seed bibliography.

Important

This repository is for scientific research and reproducibility. It does not provide investment advice and must not be presented as evidence of live-trading profitability until genuine out-of-sample evaluation is complete.

Patch 1 data foundation

P1 introduces a hard point-in-time observation contract: event_time_us records when an event belongs, while available_at_us records when that exact value/revision first became usable. Historical features must satisfy available_at_us <= decision_cutoff_us. P1 also adds deterministic dataset hashing/provenance and a ground-truth synthetic regime/jump generator for later validation work.

Patch 2 deterministic execution foundation

P2 adds the first auditable Go execution kernel. Strategies receive only bars that have reached available_at_us; market orders submitted at event t cannot fill before event t+1; fills use the next eligible bar open plus an explicit slippage model; fees, cash, positions, realized fill-to-fill PnL, turnover, slippage cost and mark-to-market equity are recorded separately. Run summaries are SHA-256 sealed and must be byte-identical for the same scenario.

Acceptance:

make test-p2

P3 — Pre-registered strategy universe

Core Grid v1 freezes 17 literature-grounded single-asset alpha instances before P4 performance analysis. Run make test-p3 to validate the registry, golden signals and all P0–P2 regressions. Volatility targeting is intentionally a future risk overlay, while cross-sectional momentum and pairs trading are deferred until a point-in-time-safe multi-asset universe exists.

P4 — Auditable Backtest Fingerprints

Patch 4 adds the first statistical research layer over deterministic strategy returns. The 17 pre-registered core trials remain unchanged; 34 separately frozen, non-selectable parameter probes support local robustness diagnostics. Go produces an auditable event trace and cost-stress runs. Julia/Float64 is the reference implementation for Sharpe, PSR/DSR, drawdown topology, exact CSCV/PBO, rolling stability and fingerprint snapshots.

Run the P4 acceptance suite with:

make test-p4

P4 synthetic rankings are test fixtures only, never empirical evidence.

P5A causal market-state layer

Repository v0.6.0 adds an expanding-window three-state Gaussian Markov-switching reference engine. Both fitted parameters and filtered state probabilities obey the decision-time information set; probability vintages are immutable, and smoothed/Viterbi state paths are prohibited as live features.

P5B structural-instability and regime-durability layer

Repository v0.7.0 adds an exact CPU/Float64 BOCPD reference over market returns, with a frozen 252-observation scale calibration, Student-t posterior predictive distribution, short-run posterior mass, run-length moments/entropy and predictive-surprise features. The raw run-length-zero probability under constant hazard is deliberately diagnostic-only. P5B also joins the 17 frozen core strategies to P5A filtered regime probabilities and produces causal soft/hard regime-conditioned performance snapshots with explicit ESS gates and missing MRP when regime sample quality is insufficient.

Complete Patch 5 acceptance:

make test-p5

P6A causal volatility and tail-risk layer

Repository v0.8.0 adds a one-step-ahead risk-forecast contract. Historical Simulation (252) and EWMA Gaussian (lambda 0.94) are canonical strategy-level risk models; Gaussian and standardized Student-t GARCH(1,1) are market-only walk-forward benchmarks with 756-observation initial training and 21-observation refits. GARCH optimization uses a frozen 100× numerical input scale while all published forecasts remain in original return units. Strategy risk initialization excludes all pre-warm-up placeholder returns and requires 252 genuinely eligible strategy observations.

P6A records 95%/97.5%/99% VaR and ES plus QLIKE, quantile loss and FZ0 joint VaR/ES scores. Two controlled laboratories separately validate variance shifts and equal-variance heavy-tail shifts. Tail-shift acceptance deliberately does not use sample kurtosis because Student-t(4) has no finite fourth moment.

Run:

make test-p6a

Calibration/coverage stress and conformal correction are implemented in P6B; P6A measures risk level, while P6B measures risk-model reliability.

P6B calibration-stress and conformal-risk layer

Repository v0.9.0 adds causal VaR hit streams, 63/126/252 rolling coverage and severity features, Kupiec/Christoffersen diagnostics, 252-observation one-sided rolling conformal corrections, and P5A-filtered regime-conditional calibration with ESS>=30 gates. The primary dynamic U stream is EWMA Gaussian 95%; other P6A models and confidence levels remain diagnostics/comparators. No composite calibration-stress score is created.

A new equal-variance adverse-tail synthetic laboratory validates the key separation between risk level and risk-model reliability. The older standardized-t4 fixture remains a 99% tail sensitivity diagnostic because standardized t4 does not imply a larger Gaussian-comparison quantile at 95%.

Complete Patch 6 acceptance:

make test-p6

P7A synthetic failure-endpoint laboratory

Repository v0.10.0 adds a hidden-truth-separated synthetic strategy lifecycle laboratory used only to evaluate candidate failure definitions before preregistration. Nine lifecycle mechanisms are crossed with three healthy Sharpe levels, three noise archetypes, deterministic design/locked blocks and 21-day evaluation landmarks. No reliability predictor is fit, P4-P6 features are forbidden inputs, and the locked block cannot promote a runner-up. P7A recommendations remain explicitly not frozen until P7B.

P7B endpoint preregistration and label freeze

Repository v0.11.0 freezes the P7A locked-confirmed strategy state and strict-forward economic failure endpoint before any reliability prediction is fit. The raw endpoint config is SHA-256 guarded; P8 must refuse to run if it changes. P7B also materializes reversible state-transition labels and 63/126/252 forward labels with explicit activity, censoring, availability, purge and embargo semantics. Complete Patch 7 acceptance is make test-p7.

P8.0 / P8A — Reliability preregistration and causal landmark features

Repository v0.12.0 freezes the P8 modelling protocol before predictive coefficients are fit. The primary future estimand is the already-frozen 126-event failure probability among Healthy/Fragile landmarks; current state and landmark age are mandatory controls, ridge logistic is the later P8B reference architecture, and Brier score is the primary metric.

P8A does not fit the reliability model. It reconstructs F/P/E from causal P4 prefixes, joins only causal R/V/U vintages, carries feature availability timestamps, and writes predictors separately from frozen P7 targets. trial_id, family and definition hash remain audit/group metadata rather than model inputs. Outcome maturity (label_available_at <= fit_cutoff) is frozen for P8B.

Run the cumulative acceptance suite with:

make test-p8a

P8A synthetic outputs are method/software validation only; empirical strategy-failure claims remain none.

P8B — Fixed-horizon reliability model

Repository v0.13.0 adds the first predictive reliability layer without changing the frozen P7 endpoint or the P8.0 feature whitelist. A child preregistration (configs/reliability_model.p8b.toml) freezes the training-only preprocessing contract, 126-event Healthy/Fragile risk set, lambda grid, chronological tuning landmarks, outer prequential evaluation landmarks, exact baseline definitions and LOFO diagnostic before the first P8B fit.

The primary reference architecture is deterministic Float64 ridge logistic regression. Numeric imputation and scaling are fitted on training rows only; every numeric predictor receives a missingness indicator; family, trial_id, mechanism group and definition hash remain audit metadata only. Training rows must have observed, mature labels at the model-fit cutoff. Random K-fold validation remains forbidden.

P8B reports Brier score as the primary metric with log loss, Brier skill, ROC AUC and calibration diagnostics as secondary outputs. No numerical performance threshold determines acceptance: negative predictive findings are allowed. The P8B synthetic experiment is method validation only and is not empirical finance evidence. make test-p8b is the authoritative cumulative gate.

About

Can an algorithmic trading strategy's failure be predicted before performance collapses? A registered-report research programme: frozen endpoint, causal features, Go execution + Julia inference.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages