Expand description
Research universe and shared helpers for the backtesters.
Structs§
- Market
- Market context from SPY, joined by date.
- Rng
- Small, fast, seedable PRNG (SplitMix64) with Gaussian draws.
- Sample
- One (symbol, bar) observation.
- Scorecard
- Directional scorecard for a set of (signed call strength, realized return).
- Series
- A loaded symbol: name plus dated bars.
Enums§
- Split
- Which slice of history a sample belongs to.
Constants§
- BARRIER_
ATR - Triple-barrier settings: which of ±
BARRIER_ATR·ATR is touched first withinBARRIER_BARSbars. This is the cleanest form of the question “which way does the squeeze break?”. - BARRIER_
BARS - HORIZONS
- Forecast horizons in trading days: one week, two weeks, one month.
- MAGNITUDE_
BASELINE - How many leading
MAGNITUDE_NAMESform the volatility-only baseline. - MAGNITUDE_
NAMES - Names of the expected-movement inputs, in
magnitude_inputsorder. - MARKET_
FEATURES - UNIVERSE
- A deliberately mixed research universe: index and sector ETFs, mega caps, cyclicals, defensives, laggards and a few high-volatility names. It is not the investable portfolio; it exists so the indicator is judged on many kinds of price behaviour, including stocks that went nowhere.
Functions§
- add_
noise - Add Gaussian measurement noise to a price history.
- auc
- Area under the ROC curve: the chance a random “up” row scores higher than a random “down” row. 0.5 = no skill, regardless of base rate.
- barrier_
label - First-touch label. Uses the real future highs and lows.
- build_
samples - Build samples for one symbol.
signal_barsis what the indicator sees (maybe noisy);truthis the real history used for outcomes. - load_
universe - magnitude_
inputs - Direction-free inputs for the expected-movement model.
- pearson
- scorecard
- Grade calls.
strength[i] > 0is an up call,< 0a down call,0no call. Only rows with|strength| >= thresholdare graded. - spearman
- Spearman rank correlation.
- train_
end - valid_
end