Use case · Monitor
Track an open spread's health and Greeks
compute_saved_spread_analytics returns live position Greeks for a saved spread; compute_health_components grades it against its plan and rolls the worst case into one status. This is the post-fill half of the engine — the same monitoring that drives the position views in Spread Foundry and MeridianScope.
When to use it
- You have an open, saved spread and need its current net and per-leg Greeks, theta decay, and progress toward target — not a fresh candidate score.
- You want a typed health readout that flags when a position needs attention (time stop, max loss, stale thesis, thinning liquidity).
- You need a single aggregate status and an alarm count to drive a dashboard or an alert.
Example
use ferro_spread::{
compute_saved_spread_analytics, compute_health_components,
aggregate_status, alarmed_count, HealthStatus,
};
// Position analytics for a saved spread
let pos = compute_saved_spread_analytics(&inputs)?;
println!("net delta {} theta/day {}", pos.position.delta, pos.theta_decay_per_day);
println!("target progress {}", pos.target_progress);
println!("short-strike dist {}%", pos.short_strike_distance_spot_pct);
for leg in &pos.per_leg {
// leg.delta / .gamma / .theta / .vega
}
// Health scoring against the position's plan
let health = compute_health_components(&hc_inputs);
let status = aggregate_status(&health); // Ok | Watch | Alarm
if status == HealthStatus::Alarm {
// surface the alarmed components (alarmed_count(&health)) to the UI
}
# Ok::<(), Box<dyn std::error::Error>>(())Position analytics
| SavedSpreadAnalytics | Description |
|---|---|
| position | Net PositionGreeks for the spread — delta, gamma, theta, vega. |
| per_leg | Vec<LegGreeks> — the same sensitivities broken out per leg. |
| theta_decay_per_day | Expected time decay of the position value per calendar day. |
| short_strike_distance_spot_pct | How far the short strike sits from spot, in percent. |
| target_progress | Progress toward the planned profit target, in [0, 1]. |
Health components
compute_health_components returns a Vec<HealthComponent>, one per HealthComponentKind; aggregate_status reduces them to the worst status and alarmed_count counts the ones firing:
| HealthComponentKind | Description |
|---|---|
| PlanTarget | Progress toward the plan’s profit target. |
| MaxLoss | Distance to the plan’s max-loss line. |
| TimeStop | DTE against the plan’s time stop. |
| TriggerFired | Whether any defined exit trigger has fired. |
| ThesisStale | How stale the original thesis has become. |
| LiquidityDegraded | Whether the position is still liquid enough to manage. |
Notes
- Fail-loud, like the rest of the engine: a missing mark or IV yields an
Unavailableconfidence rather than a fabricated Greek. See the conventions. HealthStatuscarries a.worse()combinator (Alarm>Watch>Ok), soaggregate_statusalways reflects the most urgent component.- Monitoring consumes a saved spread — the output of the construct/rank path once a candidate has been taken.
Lifecycle
Construct → Rank → Explain gets you into a position; compute_saved_spread_analytics + compute_health_components are what watch it afterward.