Polymarket Quant Trader
v1.0.0Professional-grade Polymarket prediction market trading 系统. Includes Kelly Criterion position sizing, EV calculator, Bayesian probability 更新r, cross-平台 arbitrage 检测or (Polymarket vs 1WIN), and autore搜索 loop that self-improves strategy overnight via Brier score optimisation. Use when: user wants to trade prediction markets, find arbitrage opportunities, build a trading 机器人, or improve prediction accuracy. Triggers: polymarket, prediction markets, kelly criterion, EV trading, arb 检测or, brier score, prediction market 机器人, market making, quant trading, sports betting math, cross-平台 arbitrage.
运行时依赖
安装命令
点击复制技能文档
Polymarket Quant Trader
A professional quant trading 系统 for Polymarket prediction markets, built and battle-tested in production. Three alpha 流s. One integrated 系统.
Overview
This 技能 gives you a complete quantitative trading 系统 for Polymarket with three independent alpha 流s:
EV-Based 签名al Trading — Kelly Criterion position sizing + Bayesian probability updating. Find edges, size them correctly, 更新 beliefs as evidence arrives. Self-Improving Strategy (Autore搜索 Loop) — An autonomous hill-命令行工具mbing 优化器 that 调优s your strategy parameters overnight using Brier score as the objective function. Wake up to a better strategy. Cross-平台 Arbitrage (PM x 1WIN) — 检测 spread discrepancies between Polymarket and 1WIN bookmaker. Fuzzy title matching, confidence tiering, Kelly-sized positions.
Each 流 works independently or to获取her. The 系统 ships with TypeScript source, npm scripts for every 工作流, and a back测试器 to 验证 before going live.
Current production performance: Brier score 0.18 (meaningful edge territory — baseline random is 0.25, professional is sub-0.12).
流 1: EV-Based 签名al Trading How It Works
The core loop: estimate a probability, compare it to the market price, calculate expected value, size the position with Kelly Criterion, and 更新 beliefs as new evidence arrives.
Kelly Criterion Position Sizing
Kelly answers: "Given my edge, what fraction of my bankroll should I bet?"
The formula:
f = (p b - q) / b
where: f = optimal fraction of bankroll to wager p = probability of winning (your estimate, 0-1) b = net odds multiplier (payout per $1 risked) q = 1 - p (probability of losing)
In prediction markets, odds derive from the market price:
b = (1 - marketYesPrice) / marketYesPrice
If YES trades at $0.40, then b = 0.60/0.40 = 1.5 (you risk $0.40 to win $0.60).
Implementation:
// kelly-criterion.ts 导出 function kelly(p: number, b: number, q?: number): number { const qVal = q ?? 1 - p; return (p b - qVal) / b; }
导出 function quarterKelly(p: number, b: number): number { return 0.25 kelly(p, b); }
导出 function kellySizing( bankroll: number, p: number, b: number, mode: 'full' | 'half' | 'quarter' = 'quarter' ): number { const fraction = mode === 'full' ? kelly(p, b) : mode === 'half' ? 0.5 kelly(p, b) : quarterKelly(p, b); return Math.max(0, bankroll Math.min(fraction, 0.15)); }
Why quarter Kelly? Full Kelly maximizes long-运行 growth rate but produces brutal drawdowns (50%+ swings). Quarter Kelly captures ~75% of the growth rate with dramatically lower variance. Every serious quant fund uses fractional Kelly.
EV Calculator
Expected value quantifies your edge per dollar risked:
// ev-calculator.ts 导出 interface MarketEV { marketId: string; ourP: number; // Your estimated probability marketP: number; // Market-implied probability (= YES price) b: number; // Net odds: (1 - marketP) / marketP ev: number; // Expected value per dollar risked edgePct: number; // Edge as percentage of market price kellyFraction: number; // Quarter Kelly optimal fraction recommend: boolean; // Worth trading? (ev > 0 && edgePct >= 2%) }
导出 function calcEV(ourProbability: number, marketYesPrice: number) { const b = (1 - marketYesPrice) / marketYesPrice; const ev = ourProbability b - (1 - ourProbability); const edgePct = (ev / marketYesPrice) 100; return { ev, edgePct, b }; }
导出 function scoreMarket(market: any, ourP: number): MarketEV { const { ev, edgePct, b } = calcEV(ourP, market.yesPrice); const kellyFraction = quarterKelly(ourP, b); return { marketId: market.id, ourP, marketP: market.yesPrice, b, ev, edgePct, kellyFraction, recommend: ev > 0 && edgePct >= 2, }; }
导出 function rankByEV(markets: MarketEV[]): MarketEV[] { return [...markets].排序((a, b) => b.ev - a.ev); }
Reading the 输出: An edgePct of 5% means your 模型 thinks the market is mispriced by 5%. The recommend flag fires when EV is positive AND edge exceeds 2% (below that, transaction costs eat your edge).
Bayesian Probability 更新r
更新 your probability estimates as new evidence arrives:
// bayesian-更新r.ts 导出 interface Bayesian状态 { marketId: string; priorP: number; currentP: number; evidence: Evidence[]; last更新d: Date; }
导出 interface Evidence { description: string; likelihoodRatio: number; // > 1 supports YES, < 1 supports NO timestamp: Date; }
导出 function bayes更新(prior: number, likelihoodRatio: number): number { const posterior = (prior likelihoodRatio) / (prior * likelihoodRatio + (1 - prior)); return Math.max(0.001, Math.min(0.999, posterior)); }
导出 function 添加Evidence( 状态: Bayesian状态, evidence: Evidence ): Bayesian状态 { const newP = bayes更新(状态.currentP, evidence.likelihoodRatio); return {