Commit Graph
57 Commits
Author SHA1 Message Date
sam 51c321ccba Merge origin master (Mega-squash); keep the rewrite. 2026-09-24 03:19:46 -07:00
sam 67d016fe25 Forward test: record forecasts before their outcomes exist.
`snapshot` writes each tracked model's forecast quantiles at the seven
backtest horizons from the latest price to data/forecasts/<origin>.csv. It
refuses stale data (older than two days) and duplicate dates, so snapshots
can't be reconstructed after the fact; committing them dates them.
`forward` scores every recorded forecast whose target date has passed,
reusing the backtest's scoring (now factored out as evaluate.score).

Tracked: random_walk, drift_rw, cycle, powerlaw, plus powerlaw_ou,
powerlaw_ou_param and cycle_on_powerlaw, which development data couldn't
settle. `just weekly` runs update, snapshot and forward.

First snapshot: 2026-09-23 (BTC $84.4K). The first outcomes are due
2026-10-23.
2026-09-24 03:08:30 -07:00
sam 082bcfbbbc Round 2: reverting power law and cycle-on-powerlaw tests; one-time holdout run.
Add TrendReversionVol: deviations from the power-law trend follow a daily
AR(1), so uncertainty levels off, optionally plus trend-parameter
uncertainty with an autocorrelation-adjusted effective sample size.

Two experiments, run under the unchanged verdict rule:
- powerlaw-ou: +21% to +45% vs powerlaw at 2-4 years, but slightly negative
  point estimates at 1 month make it inconclusive.
- cycle-on-powerlaw: inconclusive (+18% at 2 years, negative elsewhere).

The holdout (outcomes after 2024-11-26) was scored once, for the four
candidates fixed beforehand. powerlaw is the best long-horizon forecast
(+45% and +58% vs the random walk at 2 and 3 years); nothing beats the
random walk inside a year; cycle fails badly. Results are in the README.
2026-09-24 03:06:21 -07:00
sam b0243adf61 Composable models and A/B tests of the 2024 ideas; add powerlaw.
Models are now a Composite of drift, volatility and (optional) shape
components, so an experiment can swap one part against a fixed control.

btcmodel/experiments.py holds seven experiments built from the ideas in the
old branches (catalogued in docs/2024-ideas.md), each with its hypothesis
and source, and a verdict rule fixed before anything ran. `just ab` runs
them on development data. Results:

- Shrinking the cycle drift, and a power-law trend (plain or reverting),
  beat their controls. The power law beats the random walk by 53-63% at
  3-4 years with unbiased outcomes, so it is promoted to MODELS.
- Every alternative volatility estimate (EWMA blends, other windows,
  reversion to a level or trend) is worse than the trailing 365-day window.
  Cycle-dependent volatility, heavy tails and stretched cycle phase show no
  reliable effect.
2026-09-24 03:01:46 -07:00
sam cfc27a38de Rewrite as a probabilistic model with walk-forward evaluation.
Replace the 2024 model (model.py, ~2000 lines) with the btcmodel package, the
baseline for future work:

- Forecasts are quantiles of log price at each horizon, scored with CRPS in a
  walk-forward backtest (origins every 30 days from 2014, horizons 1 month to
  4 years). Skill is relative to a zero-drift random walk, with circular
  block-bootstrap intervals and a count of independent windows.
- Development data stops at 2024-11-26, the last day the 2024 model saw.
  Later outcomes are a holdout, scored only by `backtest --holdout`.
- Models: random_walk, drift_rw, and cycle (the 2024 model's cycle-position
  drift, now kernel-smoothed and recency-weighted). On development data
  nothing beats the random walk with confidence; cycle loses at every horizon.
- Prices: the Investing.com archive moves to data/ (cut at 2024-11-26; its
  last row was intraday) and is extended with Coinbase daily closes by
  `update`.

Also: Nix flake dev shell (Python 3.13, pandas 3), ruff in place of black,
pytest suite, and a rewritten README. NOTES.md is removed as inaccurate, and
poetry is dropped.
2026-09-24 02:19:02 -07:00
sam ea8c2092a6 Mega-squash
Implement some basic backtesting.

Switch to simpler log-based projection.

Add improved vol calculation.

Implement trend smoothing.

Add Claude's notes on current model.

Run projections and backtests in parallel.

Add market maturity projection adjustments.

Improve volume handling in market maturity calculations.

New backtest suite proposed by Claude.

Fix create_plots() output.

Merge branch 'new-backtests' into market-maturity-backtests

Add era-aware market maturity adjustments.

Add updated notes from Claude.

Add justfile to simplify organizing results for comparison.

Run more projections from various start dates.

Tuning session; removed market maturity.

The market maturity score only complicated the model with no clear
benefit. Still working on getting the various backtests tuned.

Add Claude's notes from recent session.

More helpful additions to workflow.

New systematic backtest framework.

Add notes on new backtesting framework.

Use ruff linter.

Tweak the backtests.

* Start from 2011 instead of 2013.
* Validate over two years instead of one.

Improve uncertainty estimation.

Add Claude's notes from the last revision.

Add adaptive volatility window.

New, streamlined NOTES.

Fix projection plot bugs.

Update prices.csv.

Actually use long-term vol in adaptive calculation.

Use more conservative 1e-6 to prevent division by zero.

it's an error not to provide halving dates

warn when val period shorter than projection period

Update prices.csv

Manage output files in less-janky fashion.

Use market fundamentals intsead of empirical era adjustments.

Improve CI coverage.

Use S2F metrics for trend analysis.

update prices

Merge branch 'next' into mkt-fndm

Update prices.

Merge branch 'next' into mkt-fndm

Add CDPR plot.

Merge branch 'next' into mkt-fndm

Update prices.

Slight optimization to cdpr plot gen.

Update prices.

Merge branch 'next' into mkt-fndm

Add price to CDPR plot.

Update prices.

Add .private to .gitignore.

Update prices.
2024-12-19 23:58:42 -08:00
sam eefff47070 Merge branch 'next' into mkt-fndm 2024-11-26 19:46:13 -08:00
sam f89fd3bb4e Update prices. 2024-11-26 19:46:08 -08:00
sam 8d2d351bbb Merge branch 'next' into mkt-fndm 2024-11-26 00:49:58 -08:00
sam 525d3ba634 Add CDPR plot. 2024-11-26 00:49:54 -08:00
sam 49872447ab Merge branch 'next' into mkt-fndm 2024-11-25 22:44:46 -08:00
sam 2a13b4ef46 Update prices. 2024-11-25 22:44:36 -08:00
sam 66d7e4329e Merge branch 'next' into mkt-fndm 2024-11-20 23:30:11 -08:00
sam 3869ced1ff update prices 2024-11-20 23:30:02 -08:00
sam 7223144b13 Use S2F metrics for trend analysis. 2024-11-19 08:45:40 -08:00
sam f77cc955db Improve CI coverage. 2024-11-19 08:12:42 -08:00
sam 96fdf5a88e Use market fundamentals intsead of empirical era adjustments. 2024-11-19 07:59:13 -08:00
sam d2ac5749dc Manage output files in less-janky fashion. 2024-11-17 17:14:44 -08:00
sam 7211ed1723 Update prices.csv 2024-11-17 16:01:28 -08:00
sam 84464151be warn when val period shorter than projection period 2024-11-17 15:59:33 -08:00
sam ca69495071 it's an error not to provide halving dates 2024-11-17 15:53:14 -08:00
sam 41c62e1af2 Use more conservative 1e-6 to prevent division by zero. 2024-11-17 15:52:35 -08:00
sam 3158d7479d Actually use long-term vol in adaptive calculation. 2024-11-16 21:56:39 -08:00
sam 50f3f76830 Update prices.csv. 2024-11-16 21:47:55 -08:00
sam 56f669ac0f Fix projection plot bugs. 2024-11-16 21:46:31 -08:00
sam 06f5620cb3 New, streamlined NOTES. 2024-11-16 21:37:24 -08:00
sam 5679d99ece Add adaptive volatility window. 2024-11-16 21:33:38 -08:00
sam 3d6397da21 Add Claude's notes from the last revision. 2024-11-16 21:08:31 -08:00
sam f023f7e999 Improve uncertainty estimation. 2024-11-16 20:23:59 -08:00
sam 453df222d6 Tweak the backtests.
* Start from 2011 instead of 2013.
* Validate over two years instead of one.
2024-11-16 20:00:58 -08:00
sam 47b2ce1476 Use ruff linter. 2024-11-16 14:07:24 -08:00
sam db45b14882 Add notes on new backtesting framework. 2024-11-16 03:38:24 -08:00
sam bbd7d493b7 New systematic backtest framework. 2024-11-16 03:20:21 -08:00
sam f5bed410ae More helpful additions to workflow. 2024-11-15 22:48:17 -08:00
sam 1e8c6ba75e Add Claude's notes from recent session. 2024-11-15 22:48:03 -08:00
sam e484331196 Tuning session; removed market maturity.
The market maturity score only complicated the model with no clear
benefit. Still working on getting the various backtests tuned.
2024-11-15 18:07:33 -08:00
sam b9cf04aed7 Run more projections from various start dates. 2024-11-15 16:48:33 -08:00
sam 2b7abecdcb Add justfile to simplify organizing results for comparison. 2024-11-15 16:36:52 -08:00
sam 502b47842e Add updated notes from Claude. 2024-11-15 15:16:31 -08:00
sam 368878a482 Add era-aware market maturity adjustments. 2024-11-15 15:12:36 -08:00
sam 294c665106 Merge branch 'new-backtests' into market-maturity-backtests 2024-11-15 14:08:22 -08:00
sam 4975e1647d Fix create_plots() output. 2024-11-15 14:08:16 -08:00
sam 8f94c60034 New backtest suite proposed by Claude. 2024-11-15 13:57:36 -08:00
sam b024a38040 Improve volume handling in market maturity calculations. 2024-11-15 13:48:14 -08:00
sam b018296a51 Add market maturity projection adjustments. 2024-11-15 13:37:14 -08:00
sam 5b80eac207 Run projections and backtests in parallel. 2024-11-15 10:22:12 -08:00
sam 16ce8823f3 Add Claude's notes on current model. 2024-11-15 02:09:11 -08:00
sam f9b8af828a Implement trend smoothing. 2024-11-15 01:59:19 -08:00
sam 36eda3eb3e Add improved vol calculation. 2024-11-15 01:22:16 -08:00
sam 588c4a8fa4 Switch to simpler log-based projection. 2024-11-14 22:29:34 -08:00