Skip to main content

Module polymarket_oracle

Module polymarket_oracle 

Source
Expand description

Polymarket-derived Volatility Oracle for pre-IPO assets (e.g., SPCX).

Polls Polymarketโ€™s Gamma API for digital-option-style probability markets (e.g., โ€œSpaceX IPO closing market cap above $2T?โ€), converts market cap thresholds to per-share strike prices, and inverts Black-Scholes digital call pricing to extract an implied volatility smile.

Structsยง

GammaEvent ๐Ÿ”’
GammaMarket ๐Ÿ”’
PolymarketSurfaceState ๐Ÿ”’
PolymarketVolOracle
PolymarketVolOracleConfig

Constantsยง

GAMMA_API_BASE ๐Ÿ”’

Functionsยง

bs_digital_call_price ๐Ÿ”’
Price of a digital (binary) call: pays $1 if S_T > K.
estimate_spot_from_cdf ๐Ÿ”’
Estimate spot price from the CDF by finding where P(above) โ‰ˆ 0.50.
norm_cdf ๐Ÿ”’
parse_market_cap_from_question ๐Ÿ”’
Parse a market cap dollar amount from a Polymarket question. E.g., โ€œSpaceX IPO closing market cap above $2T?โ€ โ†’ 2_000_000_000_000.0
parse_yes_probability ๐Ÿ”’
Parse the โ€œYesโ€ probability from a Polymarket outcomePrices JSON string. The field is double-encoded: "[\"0.705\",\"0.295\"]".
solve_digital_iv ๐Ÿ”’
Solve for the Black-Scholes implied volatility of a digital call option given its market probability. Returns None if the inversion fails.