Skip to content

fix: Polymarket spread ref = ticker mid_price - #1729

Merged
Flotapponnier merged 2 commits into
devfrom
fix/polymarket-mid-price
Aug 3, 2026
Merged

fix: Polymarket spread ref = ticker mid_price#1729
Flotapponnier merged 2 commits into
devfrom
fix/polymarket-mid-price

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Polymarket's orderbook has outlier orders at the top of book that inflate (bestBid+bestAsk)/2. This caused non-monotonic cost tiers: $10k costing more than $1M (53 bps vs 7 bps for ETH).

Root cause: a stale/wide best ask shifts the computed mid far from fair value. A $1k order that barely moves from bestAsk gets an inflated spread, while larger orders fall into the dense cheap liquidity at mid-market.

Fix: use mid_price from the /tickers endpoint (already fetched for funding rate) as the spread reference. The exchange-published mid is computed from their matching engine and is immune to outlier book orders. Tickers fetch is moved to step 2 so the mid is available before the book walk.

@Flotapponnier
Flotapponnier merged commit 51fc07e into dev Aug 3, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant