MarketDataAccount). SOS-SDK also includes a bit-exact Black-Scholes mirror and collateral estimators for UI previews.
Pyth Spot Feed and Freshness
Trading builders takepriceUpdateAccount, which must be the shard-0 Pyth price feed account for the underlying asset’s feed ID.
Resolve the feed ID from MarketDataAccount, derive the shard-0 feed address, and check freshness before submitting a trade:
Historical Volatility
Baseline Historical Volatility is stored directly onMarketDataAccount.historicalVolatilityPpm in parts per million (1_000_000 equals 100%). An offchain volatility worker computes 90-day realized volatility and writes it onchain through update_market_data. Pricing instructions do not read an external volatility oracle account.
Read the stored baseline volatility and risk-free rate from MarketDataAccount for display pricing or opening margin estimates:
All trading and series-initialization builders populate the unused legacy
volatility_quote_account instruction ABI slot internally.Black-Scholes Display Pricing
priceOption is a fixed-point Black-Scholes mirror of the onchain model. Its premiumNanoUsd and thetaNanoUsd match the program bit for bit, and it also returns client-side Greeks (deltaNano, gammaNano, vegaNanoUsd, rhoNanoUsd).
priceOption prices one unit of the underlying. One listed contract covers UNDERLYING_UNITS_PER_CONTRACT (100) units. Use the high-level buy and close builders for executable premiums that include pool size adjustments and slippage caps.Estimating Writer Collateral
UsecalculateRequiredCollateral to estimate Writer collateral in Collateral Mint base units before minting a Short:
Estimating Opening Margin
Every minted Short leg must clear the program’s conservative post-fill opening margin check (OpeningMarginNotMet, 6171). Use computeMinimumOpeningOwnCollateralBaseUnits to compute the exact minimum own collateral in Collateral Mint base units that satisfies both the opening margin check and the OMLP vault leverage floor:
