"""Stablecoin peg-reversion weights. Pure, no I/O.

SHORT-rich only: short every stablecoin trading above peg beyond a threshold (mint/redeem arb pulls it
back). Long-cheap is NEVER taken — buying a depegging stable is the death-spiral trap (UST -> 0)."""
from __future__ import annotations


def short_rich_weights(dev: dict[str, float], thresh: float) -> dict[str, float]:
    """dev = {sym: close-1.0} as-of a day. Equal-weight SHORT (-1/k each) on names with dev > thresh
    (rich), gross 1. Returns {} if no name is rich. Cheap names (dev < 0) are never taken."""
    rich = [s for s, d in dev.items() if d > thresh]
    if not rich:
        return {}
    w = -1.0 / len(rich)
    return {s: w for s in rich}
