Agent
Risk monitoring
The Helmsman computes a forward-looking risk score (0–100) for every position every block. The score blends current health factor with projected stress under realistic price moves.
python
def risk_score(position):
# current cushion
hf = position.health_factor()
# forward stress: 1-day 2-sigma move on weighted collateral
sigma = blended_vol(position.collateral_basket)
stress_hf = (position.collateral_value * (1 - 2*sigma) *
position.liq_threshold) / position.debt
# event adjustment: pulled-in days to nearest catalyst
days_to_event = nearest_event(position.collateral_basket)
event_mult = 1 - 0.6 * exp(-days_to_event / 3)
return clamp_0_100(blend(hf, stress_hf, event_mult))