DEV Community

Azan Hyder
Azan Hyder

Posted on

SDCA-Raqqr

The model: RAQQR — Regressed Asymmetric Quantile... (fit on log₁₀ price vs ln time since genesis).
7 quantile bands from Q1% to Q99%. The tails get different curvature — because BTC's upside and downside tails don't behave the same.
Bands are a pure function of the date. Deterministic, reproducible, no black box.

GitHub logo azank1 / sdca-raqqr

Bitcoin valuation and DCA backtest library. Implements the RAQQR asymmetric tail-curvature rainbow model to score market risk (0–100) and simulate accumulation/distribution strategies against historical price data.

sdca-raqqr

Bitcoin RAQQR Rainbow Valuation + Risk-Scored DCA Backtest Library

License Python Tests Model Live Dashboard

Bitcoin valuation and DCA backtest library. Implements the RAQQR asymmetric tail-curvature rainbow model to score market risk (0–100) and simulate accumulation/distribution strategies against historical price data.

The numbers this library produces match the reference HTML artifact's default configuration — proven by a cross-implementation parity test, not assumed.


Interactive Dashboard

Open dashboard

Live at → sdca-raqqr.streamlit.app


quickstart demo


What it does

  • Valuation bands — computes 7 RAQQR quantile price bands (Q1%→Q99%) for any date from 2009 onward; these are the statistical "rainbow" rails
  • Risk score — maps today's price against the bands to a 0–100 EQM risk number (low = historically cheap, high = historically expensive)
  • Composite signal — blends the EQM z-score with optional extra indicators (Sharpe, CBPL) into a single composite_risk value
  • DCA backtest — simulates a piecewise-linear allocation curve: buy X% of cash when risk is low, sell Y% of BTC when…

Today's reading: price is sitting below the Q1% band.
EQM risk score: 1.0 / 100 — the most extreme "historically cheap" print the model can produce.

gauge

The risk score maps price position between the bands onto 0–100 in log space:
🟢 <25 accumulate · 🟡 25–50 watch · 🟠 50–75 caution · 🔴 >75 distribute
One number, updated daily, live on the dashboard.

Then the fun part: an editable allocation curve.
"Buy X% of my cash when risk is 10. Sell Y% of my BTC when risk is 90."
Drag the curve, re-run the backtest, compare against lump-sum. Conservative / Default / Aggressive presets included.
bactest

the caveats
Coefficients are full-sample fits → backtests are in-sample, illustrative, NOT a track record • No fees/slippage modeled yet • The score saturates at the extremes. It's in the README. DYOR, always. Not financial advice.
the quant devs; parity-tested to floating point
The repo's least flashy and most important feature: the Python core is parity-tested against the original JavaScript implementation to rtol = 1e-12. A Node script dumps golden band values from the verbatim JS formula; pytest asserts the Python port matches to floating point. One coefficients file is the single source of truth for both implementations, so the web frontend and the Python library can never silently drift apart.
Ten tests cover the parity contract, the signal interpolation against an independent reference implementation, and the backtest's compounding math against closed-form results.
bash


Check Out the article on X ^

Top comments (0)