code wiki / (root) / nx_fin_advstats.nx

nx_fin_advstats.nx

buildroot/runtime/nx_fin_advstats.nx

2630 B50 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic fin
docsdependenciesstructsconstsfunctions

about

nx_fin_advstats.nx -- advanced backtest statistics (the Lopez de Prado rigor that separates a real edge from the luckiest of many tries). Core = the DEFLATED SHARPE RATIO: the multiple-testing correction. When you test T strategies (our tournament does), the BEST Sharpe is inflated by selection; the deflated Sharpe subtracts the expected-max-under-null haircut (trial_std * sqrt(2*ln T)) before testing significance. Composes me_isqrt (nx_fin_metrics). i64 fixed-point (Sharpe in MILLI = SR*1000); sqrt(2 ln T) via a data table (avoids integer ln). This moves us from BEHIND to PARITY on advanced stats (PBO / CPCV are the next refinements). license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_fin_metrics.nx nx_fin_advstats.nx nx_fin_advstats_gate.nx

imports: nx_syscalls.nxnx_fin_metrics.nx

imported by: nx_fin_advstats_gate.nx

structs

none

consts

10const K_MAGIC_1177: i64 = 1177
11const K_MAGIC_1665: i64 = 1665
12const K_MAGIC_2036: i64 = 2036
13const K_MAGIC_2354: i64 = 2354
14const K_MAGIC_2634: i64 = 2634
15const K_MAGIC_3035: i64 = 3035
16const K_MAGIC_3723: i64 = 3723

functions

19func as_sharpe_tstat_milli(sr_milli: i64, n: i64) -> i64
26func as_max_z_milli(n_trials: i64) -> i64
38func as_deflated_sr_milli(best_sr_milli: i64, trial_std_milli: i64, n_trials: i64) -> i64
45func as_deflated_significant(best_sr_milli: i64, trial_std_milli: i64, n_trials: i64, n: i64, thresh_milli: i64) -> i64