joshriang
← Back to portfolio

Quant research & trading·Python·Published

Prediction Market Mispricing

This screens binary prediction markets by comparing the market-implied probability against a Bayesian Beta-Binomial baseline, and it is careful about labelling which of those two numbers is actually estimated. A Yes token paying 1 dollar on resolution is worth exactly its risk-neutral probability, so the implied probability is just the price clipped to [0, 1], and multi-outcome books are de-vigged by normalizing p_i / sum(p) with overround = sum(p) - 1 reported as the book's cut. The baseline is a Beta(alpha, beta) posterior updated with observed wins and trials, with posterior mean (alpha + w) / (alpha + beta + n) and a closed-form posterior std, and the screener flags |edge| > tau as BUY_YES when the market underprices or BUY_NO when it overprices, sorted by absolute edge. There are two data paths and both are labelled: live prices from the Polymarket Gamma API with a synthetic fallback offline, and a fully offline synthetic demo with known injected mispricing. On the synthetic run with 12 markets at tau = 0.05 it flagged 6, recovering the injected biases, with the largest being market 2 at market 0.1896 against model 0.4286 for an edge of +0.2390, and the unbiased markets landing FAIR with edges under the threshold. The README is explicit that live screening compares prices against a base-rate prior rather than a fitted model, so it detects deviation from base rates and not true mispricing, and that the flagged edge is gross of fees, spread, liquidity and resolution risk.

Date
2026
Main stack
Python
Code
github ↗
01
02
  • A Yes token's price is already a probability, so the only honest way to call something mispriced is to have an independent probability estimate; without one you are measuring deviation from a prior, not mispricing, and the code should say so in its output.
  • De-vigging by normalizing prices and reporting overround separately keeps the book's cut visible instead of silently folding it into the edge estimate.
  • The posterior standard deviation is the natural confidence gauge for sizing a flagged edge, because an edge of 0.05 with a posterior std of 0.08 is noise and the same edge with a std of 0.02 is a trade.
03

Scale 0–100: how much this project relied on each skill.