Learn how a Polymarket TWAP market maker combines fair value, order-book state, inventory, and TWAP data for adaptive quoting.
A market maker does not need to predict every short-term price movement. Its harder problem is deciding where to quote, how much liquidity to expose, and when a quote has become stale.
That problem becomes more interesting in Polymarket crypto markets because the tradable contract is a binary outcome while the underlying reference asset can move continuously.
A useful architecture is therefore not simply:
market price → bid/ask
Instead, a TWAP-aware system can treat the market's current order book, inventory, and an external reference such as Chainlink's TWAP as separate information streams.
Polymarket currently documents 30-second and 60-second Chainlink-computed TWAP feeds through its real-time data infrastructure.
Contacts
Nagi writes about Polymarket bots, algorithmic trading, quantitative strategies, Python automation, Web3, and prediction-market infrastructure.
Github: https://github.com/NagiPoly/poly-maker
Telegram: https://t.me/nagi_777x
The key question is:
Can TWAP improve a market maker's fair-value estimate without turning the quoting engine into a directional trading strategy?
That distinction matters.
A market maker can use TWAP as a reference for quote stability and adverse-selection control, rather than as a signal saying “buy now.”
What We Are Analyzing
Consider a short-duration BTC prediction market.
The system observes:
- Best bid and ask
- Order-book depth
- Recent trades
- Current inventory
- Time remaining
- Chainlink 30-second or 60-second TWAP
- Current underlying BTC reference price
Polymarket uses a Central Limit Order Book, with prices emerging from user supply and demand. The displayed market price can represent the midpoint when the spread is sufficiently narrow.
The market maker's objective is to estimate a reference fair value and then place passive quotes around it.
The important change is that fair value becomes a function rather than a single observed price.
A TWAP-Aware Fair-Value Model
A simple conceptual model is:
F_t = P_t + \alpha(TWAP_t-P_t)
where:
- (P_t) = current market-derived reference price
- (TWAP_t) = external TWAP reference
- (F_t) = adjusted fair value
- (\alpha) = TWAP influence parameter
If (\alpha=0), the system ignores TWAP.
If (\alpha) increases, the quote engine becomes more sensitive to divergence between the current reference and the TWAP.
But this should not automatically be interpreted as an arbitrage opportunity.
A difference between spot-like price and TWAP can simply represent genuine information arriving in the market.
The useful interpretation is instead:
“How much uncertainty should I attach to my current fair-value estimate?”
For example, a rapidly moving underlying can justify wider quotes even when the Polymarket order book itself has not changed much.
The Core Insight: TWAP Should Control Quote Aggressiveness
A naive market maker might use:
Bid = F-s
Ask = F+s
where (s) is the half-spread.
A TWAP-aware system can make (s) dynamic:
s_t = s_0 + \beta |\Delta_{TWAP}| + \gamma I_t
where:
- (s_0) = baseline half-spread
- (\Delta_{TWAP}) = normalized deviation from TWAP
- (I_t) = inventory pressure
- (\beta) = sensitivity to underlying movement
- (\gamma) = inventory-risk coefficient
This creates an important separation:
Fair value determines quote location.
Uncertainty determines quote width.
Inventory determines quote skew.
That is a much cleaner market-making architecture than treating every external signal as a directional trade.
Inventory Changes the Equation
Suppose the market maker has accumulated too many YES tokens.
Its risk is no longer symmetric.
A simple inventory adjustment is:
F_{quote}=F_t-\lambda Q_t
where:
- (Q_t) = signed inventory
- (\lambda) = inventory-skew coefficient
Positive YES inventory shifts the quoting center downward, making the system more willing to sell and less eager to accumulate additional YES exposure.
Polymarket's current market-making documentation explicitly recommends incorporating inventory into pricing and sizing decisions and skewing quotes to reduce imbalances.
This produces three independent controls:
┌──────────────┐
Order Book ────► │ │
TWAP ──────────► │ Fair Value │
Underlying ────► │ Engine │
└──────┬───────┘
│
┌──────▼───────┐
Inventory ─────► │ Quote Adjust │
└──────┬───────┘
│
┌──────▼───────┐
│ Bid / Ask │
│ + Size │
└───────────────┘
This architecture keeps signal generation separate from execution policy.
A Practical Example
Suppose a hypothetical BTC market has:
- Market midpoint: $0.56
- 30-second TWAP-implied reference: $0.55
- Existing YES inventory: moderately positive
- Increasing underlying volatility
Instead of interpreting the $0.01 TWAP difference as a guaranteed trading edge, the quote engine could:
- Keep fair value near the market reference.
- Apply a small inventory-induced downward skew.
- Increase the spread because short-term uncertainty has increased.
- Reduce order size.
- Cancel stale quotes when the reference moves materially.
This is a risk-control interpretation of TWAP, not a prediction model.
Python: A Minimal Quote Engine
The following is an illustrative synthetic implementation, not a tested Polymarket strategy:
from dataclasses import dataclass
@dataclass
class Quote:
bid: float
ask: float
def make_quote(mid, twap, inventory,
base_spread=0.02,
twap_weight=0.20,
inventory_skew=0.01):
fair = mid + twap_weight * (twap - mid)
fair -= inventory_skew * inventory
spread = base_spread + abs(twap - mid)
return Quote(
bid=max(0.01, fair - spread / 2),
ask=min(0.99, fair + spread / 2),
)
The values here are purely illustrative.
A production implementation would need market-specific tick sizes, minimum order sizes, live order-state reconciliation, fill handling, and explicit risk limits. Polymarket documents GTC and GTD as the primary passive market-making order types and recommends post-only orders when liquidity must be added rather than immediately removed.
What Can Go Wrong?
The most dangerous failure is treating TWAP as truth.
TWAP is a smoothed reference. Smoothing intentionally removes some short-term information.
A fast market move can therefore create a large difference between the current underlying and TWAP without implying that the market maker's current quote is wrong.
Other failure modes include:
- stale TWAP observations
- disconnected real-time feeds
- incorrect timestamp alignment
- excessive TWAP weighting
- inventory accumulation
- stale resting orders
- adverse selection
- insufficient order-book depth
- quote cancellation races
- incorrect market-specific assumptions
Polymarket's documentation notes that its Chainlink TWAP stream has 30-second and 60-second windows and that subscriptions begin with the next update rather than providing historical replay after disconnection. Freshness therefore needs to be treated as explicit state in the system.
Production Architecture
A robust implementation should separate:
Market-data layer
→ order book
→ trades
→ TWAP
→ timestamps
State layer
→ inventory
→ open orders
→ fills
→ balances
Quote engine
→ fair value
→ spread
→ inventory skew
→ size
Execution layer
→ post-only/GTC/GTD orders
→ cancellation
→ replacement
→ reconciliation
Polymarket's documented order lifecycle is hybrid: orders are created and matched off-chain while matched trades settle on-chain. Orders also cannot simply be edited in place; changing a quote requires canceling the existing order and submitting a replacement.
That makes quote-state reconciliation a core component rather than an implementation detail.
Testing the Hypothesis
The research question should be tested as:
Hypothesis: TWAP-aware quoting reduces adverse selection or inventory volatility relative to a midpoint-only quoting model.
Experiment: Replay historical order-book and reference-price data using identical inventory limits.
Observed results: Measure realized spread, fill rate, inventory variance, quote lifetime, and markout after fills.
Interpretation: Determine whether TWAP actually improves execution quality or merely reduces participation.
Synthetic data can validate the mechanics, but historical replay is required to investigate real market behavior.
A particularly useful experiment is to sweep (\alpha), the TWAP weighting parameter, and measure how quote width and post-fill markout change.
Advanced Extensions
An experienced research system could extend this framework with:
- Adaptive TWAP weighting based on volatility.
- Regime detection separating stable and shock conditions.
- Depth-aware spreads that respond to available liquidity.
- Short-horizon markout models for adverse-selection estimation.
- Cross-market references combining multiple related Polymarket contracts.
The important design principle is to avoid letting one feature control the entire execution policy.
Key Takeaways
- A TWAP should be treated as a reference, not automatically as a trading signal.
- Fair value, spread, inventory, and size should be separate components.
- TWAP divergence can be used to adjust uncertainty and quote aggressiveness.
- Inventory should shift the quoting center independently of TWAP.
- Feed freshness and timestamp alignment are critical.
- The correct validation target is execution quality, not simply prediction accuracy.
FAQ
What is a Polymarket TWAP market maker?
It is a market-making system that incorporates a time-weighted reference price into fair-value, spread, or quote-risk calculations.
Should TWAP determine the bid and ask directly?
Not necessarily. A safer research architecture uses TWAP as one input to fair value or uncertainty while retaining order-book and inventory information.
Can TWAP predict the next Polymarket price?
That is a hypothesis requiring testing. A TWAP is a smoothed reference and should not automatically be treated as predictive alpha.
Why does inventory matter?
Every fill changes the market maker's exposure and available capital. Inventory therefore affects both quote prices and quote sizes.
How should a TWAP strategy be validated?
Use historical replay, out-of-sample testing, parameter sensitivity, markout analysis, inventory stress tests, and feed-disconnection scenarios.
Disclaimer
This article is for educational and research purposes only. Trading prediction markets involves market, liquidity, execution, model, and capital risk. No strategy discussed here guarantees profit.
Conclusion
The interesting part of a TWAP-aware Polymarket market maker is not the TWAP calculation itself. It is deciding what role the reference should play inside the quote engine.
Top comments (0)