forward function

double forward(
  1. double pythSpot,
  2. double bsSpot,
  3. double bsForward
)

The forward the contract prices against: Pyth spot re-anchored by the Block-Scholes basis (spot · forward/bsSpot), falling back to the Block-Scholes forward when Pyth is absent. Pass pythSpot <= 0 to force the fallback. NOTE: on-chain this branch is also gated by the admin flag use_pyth_spot_for_forward (default on) and a Pyth freshness window — when the flag is off or the Pyth spot is stale, the chain uses bsForward. If you track that config/freshness, apply it before calling (or use read.pricer, which gets the resolved forward from the chain).

Implementation

double forward(double pythSpot, double bsSpot, double bsForward) {
  if (pythSpot > 0 && bsSpot > 0) return pythSpot * (bsForward / bsSpot);
  return bsForward;
}