feat: add 9 Risk / Performance indicators (B18) (#218)
Adds nine risk/performance metrics to the existing **Risk / Performance** family, all consuming a per-period return series (`f64` in, `f64` out). Indicator count **498 → 507**. ## Indicators Single-param (`new(period)`, macro bindings): - **SterlingRatio** — mean return over average drawdown of the equity curve. - **BurkeRatio** — return over root-sum-squared drawdowns. - **MartinRatio** — Ulcer Performance Index; return over RMS percentage drawdown. - **TailRatio** — 95th percentile over the absolute 5th percentile return. - **KRatio** — Kestner; equity-curve OLS slope over the standard error of that slope. - **CommonSenseRatio** — tail ratio times gain-to-pain. - **GainToPainRatio** — sum of returns over the sum of absolute losses. Multi-param (hand-written Python/Node bindings, variadic WASM macro): - **UpsidePotentialRatio** — `new(period, mar)`; upside mean over downside deviation (Sortino philosophy). - **M2Measure** — `new(period, risk_free, benchmark_stddev)`; Modigliani M², Sharpe rescaled into benchmark return units. ## Touchpoints Core modules + unit tests, `mod.rs`/`lib.rs` wiring, Python/Node/WASM bindings (`index.d.ts`/`index.js` regenerated), fuzz drive lines, Python `SCALAR` registry + Node factories, CHANGELOG, and the indicator counters. ## Verification - `cargo test -p wickra-core --lib` — 4149 passed - `cargo test -p wickra-core --doc` — 457 passed - `cargo clippy --workspace --all-targets --all-features -- -D warnings` — clean - `npm test` (node) — 577 passed - `pytest` (python) — 947 passed
This commit is contained in:
@@ -45,6 +45,15 @@ def ohlcv() -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
|
||||
# --- Scalar (f64 -> f64) indicators ---------------------------------------
|
||||
|
||||
SCALAR = [
|
||||
(ta.M2Measure, (20, 0.0, 0.02)),
|
||||
(ta.UpsidePotentialRatio, (20, 0.0)),
|
||||
(ta.GainToPainRatio, (12,)),
|
||||
(ta.CommonSenseRatio, (20,)),
|
||||
(ta.KRatio, (30,)),
|
||||
(ta.TailRatio, (20,)),
|
||||
(ta.MartinRatio, (14,)),
|
||||
(ta.BurkeRatio, (12,)),
|
||||
(ta.SterlingRatio, (12,)),
|
||||
(ta.AUTOCORRPGRAM, (10, 48)),
|
||||
(ta.EVENBETTERSINE, (40, 10)),
|
||||
(ta.BANDPASS, (20, 0.3)),
|
||||
|
||||
Reference in New Issue
Block a user