Skip to main content

sharpebench_core/
lib.rs

1//! # sb-core — the SharpeBench scoring kernel
2//!
3//! A pure, deterministic library that turns a set of agent **trajectories**
4//! (per-seed × per-window return series + decision traces) into a **luck-robust,
5//! risk-adjusted** score and leaderboard ranking.
6//!
7//! Design invariants — these are what make a SharpeBench score reproducible forever:
8//! - **Pure.** No I/O, no system clock, no ambient randomness. Any randomness
9//!   (the significance bootstrap) takes an explicit seed argument.
10//! - **Deterministic.** Plain `f64` math, fixed reduction order, no parallel
11//!   float sums. The same input yields byte-identical output on any platform.
12//! - **No `unsafe`.**
13//!
14//! The headline idea: an agent does **not** rank on raw return. It ranks only if
15//! its edge survives (a) deflation for the number of agents tested
16//! ([`deflated_sharpe`]), (b) reliability across every seed×window
17//! ([`pass_k`]), and (c) decision-process discipline ([`process`]). Raw return is
18//! reported but never the rank key — see [`composite`].
19#![forbid(unsafe_code)]
20
21// The pure statistics core lives in `sharpebench-stats`; re-export the modules so
22// every existing path (`crate::stats::…`, `sharpebench_core::deflated_sharpe::…`,
23// `…::significance::*`, `…::selection::*`) keeps resolving byte-for-byte.
24pub use sharpebench_stats::{deflated_sharpe, selection, significance, stats, stylized_facts};
25
26// The dataset-realism validator (Cont's stylized facts) — certifies that a frozen
27// or synthetic dataset actually behaves like a market before any score is trusted.
28// The measurement fn stays reachable as `stylized_facts::stylized_facts`.
29pub use sharpebench_stats::{
30    validate_dataset, validate_dataset_with, RealismFailure, RealismThresholds, RealismVerdict,
31    StylizedFactsReport,
32};
33
34pub mod allocation;
35pub mod attribution;
36pub mod briefing;
37pub mod calibration;
38pub mod comparison_sets;
39pub mod composite;
40pub mod correlation;
41pub mod decay;
42pub mod disqualification;
43pub mod econrationality;
44pub mod greeks;
45pub mod oos;
46pub mod pass_k;
47pub mod percentile;
48pub mod process;
49pub mod rediscovery;
50pub mod roles;
51pub mod rolling;
52pub mod selfaudit;
53
54pub use allocation::{
55    check_weights, score_allocation, turnover, AllocationPolicy, AllocationReport, AllocationStep,
56    AllocationTrajectory, WeightValidity, WeightViolation,
57};
58pub use briefing::{
59    audit_briefing, Briefing, BriefingAudit, BriefingPolicy, BriefingSection, BriefingViolation,
60};
61pub use comparison_sets::{
62    comparison_set, qualifies, restrict_field, restrict_to_shared, ComparisonSet, TaggedRun,
63    TaggedSubmission,
64};
65pub use composite::{rank, score_agent, AgentSubmission, CompositeScore, Run, ScoreConfig};
66pub use correlation::{crowdedness, Crowdedness};
67pub use disqualification::{classify_disqualification, rollup, DisqualThresholds, FailReason};
68pub use econrationality::{assess_rationality, DominanceChoice, EconRationalityReport};
69pub use greeks::{
70    bs_greeks, bs_price, classify_greeks_risk, portfolio_greeks, Greeks, GreeksPolicy, GreeksRisk,
71    Leg,
72};
73pub use oos::{oos_decay, OosDecayReport};
74pub use percentile::percentile_of;
75pub use process::{ProcessEvent, ProcessScore, Trace};
76pub use rediscovery::{
77    classify_rediscovery, cosine_similarity, RediscoveryVerdict, DEFAULT_REDISCOVERY_THRESHOLD,
78};
79pub use rolling::{rolling_sharpe, RollingSharpe};
80pub use selection::{selection_robustness, SelectionRobustness};
81pub use selfaudit::{run_self_audit, SelfAuditReport};