PM market making
PolymarketEventEvent marketLower riskmake markets on a YES token: inventory skew around the rolling mid, skip when the spread is too tight
Track record
Return
+9.1%
Sharpe
4.01
Max DD
0.9%
AUM
$0
Created
2026-07-12
Investors
0
Pools
0
Settled days
0
Market fit
EventBets on a specific outcome (e.g. BTC price by year-end)- ✓When your view of the odds differs from the market's pricing
- ⚠Liquidity thins near resolution; binary outcomes can go to zero
Backtest (deterministic simulator)
Parameters: ref_window / max_inventory / spreadBinary prediction-market simulation (YES/NO, settles YES after 180 steps) — not a promise of future returns.
Core source
Source on GitHub ↗"""事件做市(Prediction-market making)—— 订单簿价差 + 库存偏移。
思路:在二元市场对 YES token 做市:以滚动中间价为参考,价格低于参考(偏便宜)时增持库存、高于参考时
减仓,等价于围绕中间价的双边报价在成交后把库存拉回中性,赚取价差与短期均值回归。价差过窄(低于
min_spread)时不报价——做市无利可图。本 demo 为长仓做市(库存 0..max_inventory)。
适用性:instrument="event"、venues=["POLYMARKET"]。
"""
from __future__ import annotations
from ..base import StrategyBase
from ..context import StrategyContext
from ..indicators import clamp01, sma
from ..registry import register
@register("事件做市")
class PmMarketMaking(StrategyBase):
description = "预测市场对 YES 做市:围绕滚动中间价按库存偏移持仓,价差过窄则不报价。"
params = {"ref_window": 20, "max_inventory": 30.0, "spread": 0.06, "min_spread": 0.005}
venues = ["POLYMARKET"]
symbols: list = []
instrument = "event"
def __init__(self, ref_window: int = 20, max_inventory: float = 30.0,
spread: float = 0.06, min_spread: float = 0.005) -> None:
self.ref_window = int(ref_window)
self.max_inventory = float(max_inventory)
self.spread = float(spread)
self.min_spread = float(min_spread)
async def on_tick(self, ctx: StrategyContext) -> None:
sym = ctx.conn_symbol()
bid, ask, _depth = await ctx.orderbook(sym)
if ask - bid < self.min_spread:
return # 价差过窄,做市无利可图
hist = await ctx.history(sym, self.ref_window + 1)
ref = sma(hist, self.ref_window)
if ref is None or ref == 0:
return
dev = (hist[-1] - ref) / self.spread # >0 偏贵、<0 偏便宜(以 spread 归一)
frac = clamp01(0.5 - dev * 0.5) # 便宜 → 库存大
await ctx.target(sym, frac * self.max_inventory, band=self.max_inventory * 0.08)
The full SDK and all strategies are MIT-licensed open source — backtest, paper-trade, or fork them directly.
Pools running this strategy
No pools are running this strategy yet — be the first to launch one.