Crate spread_analytics
Expand description
Request-time analytics for the workspace API.
Three concerns share inputs (terminal-price distribution, leg payoffs, per-leg greeks already enriched on the snapshot’s chain rows):
candidatecomputes PoP / EV / stress-loss for a candidate spread.saved_spreadaggregates per-leg greeks + position metrics for a saved spread held by a user.healthevaluates the saved-spread health components (plan target, max loss, time stop, triggers, thesis staleness, liquidity).
The crate is pure: callers (typically services/query-api) resolve the
snapshot, fetch chain rows, and pass already-extracted inputs in.
Re-exports§
pub use candidate::CandidateAnalytics;pub use candidate::compute_candidate_analytics;pub use health::HealthComponent;pub use health::HealthComponentInputs;pub use health::HealthComponentKind;pub use health::HealthStatus;pub use health::HealthTone;pub use health::LiquidityInputs;pub use health::TriggerSummary;pub use health::aggregate_status;pub use health::alarmed_count;pub use health::compute_health_components;pub use saved_spread::LegGreeks;pub use saved_spread::PositionGreeks;pub use saved_spread::SavedSpreadAnalytics;pub use saved_spread::SavedSpreadInputs;pub use saved_spread::compute_saved_spread_analytics;pub use types::AnalyticsConfidence;pub use types::ContractRight;pub use types::LegRole;pub use types::ResolvedLeg;pub use types::SpreadFamily;
Modules§
- candidate
- Candidate spread analytics — PoP, expected value, stress loss (#300).
- distribution
- Lognormal terminal-price distribution + numerical integration.
- health
- Saved-spread health components — per-driver breakdown for the cockpit health rail (#302).
- saved_
spread - Saved-spread analytics — per-leg greeks + position metrics (#301).
- types
- Shared input types for the analytics modules.
Constants§
- STRESS_
SHOCK_ EM_ MULT - Stress-loss shock factor: payoff is sampled at
spot ± SHOCK × expected_move. Hardcoded for v0; config externalization is deferred.