Backtest
Backtest
SPD Calculation
Defines sats-per-dollar (SPD), percentile normalization, and interpretation ranges.
Sats-per-Dollar (SPD) measures how many satoshis are obtained per dollar invested. It is the core metric for comparing allocation strategies.
SPD Formula
inv_price = 1e8 / price
uniform_spd = inv_price.mean()
dynamic_spd = (weights * inv_price).sum()SPD Percentile
Percentile normalizes a strategy's SPD within the window range:
percentile = (spd - min_spd) / (max_spd - min_spd) * 100
| Percentile | Interpretation |
|---|---|
| 0% | Worst timing in-window |
| 50% | Uniform DCA baseline |
| 100% | Best timing in-window |
Worked Example
For a two-day window with prices [50000, 40000]:
- Inverse prices:
[2000, 2500]sats per dollar - Uniform weights:
[0.5, 0.5] - Dynamic weights:
[0.3, 0.7]
Uniform SPD: (0.5 * 2000) + (0.5 * 2500) = 2250
Dynamic SPD: (0.3 * 2000) + (0.7 * 2500) = 2350
If window min/max SPD are 2000 and 2600, then dynamic percentile is:
(2350 - 2000) / (2600 - 2000) * 100 = 58.33%
See Glossary for canonical term definitions.