← all strategiesAvellaneda-Stoikov Market Making with Order Flow Imbalance (OFI) Signal
Market Makingscore 7found Jun 19, 2026github.com/hot3246624/pm_as_ofi
Run a market making strategy on Polymarket using the Avellaneda-Stoikov (A-S) inventory model, enhanced with an Order Flow Imbalance signal to adjust quotes directionally.
How It Works
The Avellaneda-Stoikov model is a classical market making framework that computes optimal bid/ask quotes as a function of current inventory, residual time, and volatility, targeting a reservation price that accounts for inventory risk. The OFI (Order Flow Imbalance) signal measures the imbalance between buy and sell order flow in the orderbook to predict short-term price direction, allowing the MM to skew quotes and reduce adverse selection.
Entry/Exit Conditions
The bot continuously posts two-sided quotes (bid and ask) around the A-S reservation price. When OFI is positive (more buy pressure), the bot shifts quotes upward to avoid accumulating short inventory into rising prices, and vice versa. Quotes are refreshed continuously as market conditions change. Inventory limits define maximum position size before the bot stops quoting on one side.
Verified Results
The repo has 9 stars and 1 fork, indicating some real-world interest and review. The combination of A-S and OFI is a well-documented academic approach applied to crypto and prediction markets. No specific backtested PnL is mentioned in the description.
Implementation Notes
The bot requires real-time access to Polymarket's CLOB (Central Limit Order Book) API for orderbook data and order placement. The A-S model requires calibrated volatility and inventory risk-aversion parameters, which must be tuned for each market's liquidity profile. OFI computation requires tick-level order event data.
Risks
Prediction market events can gap to 0 or 1 instantly upon news, creating catastrophic inventory losses that the A-S model does not anticipate. Thin liquidity on many Polymarket markets makes it difficult to exit inventory positions. The OFI signal can be gamed by other participants placing and canceling large orders. Parameter miscalibration can cause the bot to systematically quote on the wrong side.