The keeper loop

Hedgehog is built around an automated keeper that refreshes live market data, accrues strategy PnL, checks position health, and rebalances when the hedge drifts outside target bounds.

Market sync

The server pulls SOL price from Pyth, mSOL exchange data from Marinade, funding and borrow rates from Drift, and mSOL lending yield from Kamino where available.

Health checks

Every position gets scored against hedge drift, buffer percentage, expected APY, and volatility. If health drops far enough, the strategy recommends unwind instead of chasing yield.

Rebalance actions

When drift exceeds the configured band, the keeper retargets the SOL-PERP short and accounts for keeper fees. In the prototype, Drift order execution is modeled while live funding rates are used.