Polymarket Bot Tutorial · باب 16 از 32
Polymarket پر statistical arbitrage: cross-market pairs (correlated events)، Polymarket-vs-Kalshi spreads، mean reversion، اور جب markets آخرکار resolve ہوں تو stat-arb positions کو کیسے size کرنا ہے۔
یہ باب کیا cover کرتا ہے
Prediction markets میں statistical arbitrage اُن عارضی mispricings سے فائدہ اٹھاتا ہے جو correlated markets کے درمیان ہوتے ہیں - چاہے وہ Polymarket بمقابلہ Kalshi ایک ہی event ہو، یا Polymarket کے اندر related markets ہوں۔ Edges چھوٹے ہوتے ہیں (عام طور پر 1-3 cents) اور operationally fragile ہوتے ہیں۔ یہ باب honestly بتاتا ہے کہ کیا کام کرتا ہے، کیا نہیں، اور multi-leg execution risk کیسے زیادہ تر attempts کو ختم کر دیتا ہے۔
Cross-market statistical arbitrage Polymarket اور Kalshi، Polymarket اور Manifold، یا Polymarket کے اندر correlated markets کے درمیان transient pricing inconsistencies سے فائدہ اٹھاتا ہے۔ Edges چھوٹے ہوتے ہیں (عام طور پر 1-3 cents) اور دونوں legs پر fast execution مانگتے ہیں۔ یہ باب ایک honest playbook ہے، جس میں وہ operational complexity بھی شامل ہے جو زیادہ تر attempts کو ناکام بنا دیتی ہے۔
- Prediction markets میں stat-arb کا مطلب کیا ہے
- Polymarket-vs-Kalshi spread examples
- Polymarket کے اندر pairs (correlated events)
- Mean reversion بمقابلہ trend continuation
- Resolving (not perpetual) markets کے لیے sizing
- Risk: resolution کے بعد divergence
- Code: pairs monitor اور threshold-trigger
Prediction markets میں stat-arb کا مطلب کیا ہے
Prediction markets میں statistical arbitrage کا مطلب ہے دو ایسے markets کے درمیان spread پر trade کرنا جن کی قیمتیں consistent ہونی چاہئیں۔ Polymarket پر اس کی تین عام صورتیں ہیں۔
- Cross-venue: Polymarket اور Kalshi (یا Manifold، PredictIt) پر ایک ہی event۔ Pricing کو converge کرنا چاہیے؛ عملی طور پر یہ 2-5 cents تک drift کر سکتا ہے۔
- Same-event-pair: NegRisk multi-outcome markets میں parent بمقابلہ legs کے sum۔ Sum-to-1 invariant آپ کو arb کرنے دیتا ہے جب legs کا مجموعہ 1.0 سے کم ہو۔
- Correlated-event-pair: دو markets جو related outcomes کے بارے میں ہوں (مثلاً "Trump president on Jan 1" بمقابلہ "Trump president on Mar 1")۔ انہیں عموماً ایک دوسرے سے 2-3 cents کے اندر price ہونا چاہیے۔
Edges چھوٹے ہیں۔ Operational complexity حقیقی ہے۔ زیادہ تر attempts execution میں fail ہوتے ہیں، theory میں نہیں۔
Polymarket-vs-Kalshi spread examples
2025-26 کے مشاہدے کے مطابق، Polymarket اور Kalshi ایک جیسے بڑے US events list کرتے ہیں لیکن مستقل طور پر 1-4 cents کے فرق سے price کرتے ہیں۔ یہ gap structural reasons کی وجہ سے موجود ہوتا ہے، جنہیں آپ کو کسی بھی arb میں model کرنا پڑتا ہے۔
Structural drivers:
- Fee asymmetry: Kalshi winning trades پر 4-7% لیتا ہے (market کے لحاظ سے مختلف ہوتا ہے)؛ Polymarket کا 0 taker fee ہے۔ Arb math میں Kalshi کی cut کو net out کرنا لازم ہے۔
- Settlement risk premium: جب کسی market کی resolution ambiguous ہو، تو ایک venue کا UMA دوسرے کی judges سے مختلف resolve ہو سکتا ہے۔ Market اس risk کو price میں شامل کرتی ہے۔
- Trader population: Polymarket عموماً younger اور زیادہ crypto-native ہوتی ہے؛ Kalshi زیادہ professional / hedge سمت میں ہوتی ہے۔ وہ ایک ہی events پر systematically مختلف رائے رکھتے ہیں۔
Arb تب کام کرتا ہے جب gap structural premium plus fees سے زیادہ ہو۔ کسی market میں 5-cent gap، جہاں structural premium 1c اور combined fees 1c ہوں، اصل میں 3c کی edge ہے۔
Polymarket کے اندر pairs (correlated events)
Polymarket کے اندر correlated-event pairs، cross-venue arb کے مقابلے میں arb کرنا آسان ہوتے ہیں۔ Fee structure ایک جیسا، wallet ایک ہی، اور atomic execution ممکن ہوتی ہے۔
وہ examples جو مستقل طور پر inconsistent price ہوتے رہتے ہیں:
- Trump president on date A بمقابلہ Trump president on date B (جہاں B، A کے مقابلے میں < 90 days بعد ہو)
- Will Bitcoin hit $100k by July 31 بمقابلہ $100k by August 31
- Same binary market میں Yes بمقابلہ No legs (sum = 1.0 ہونا چاہیے؛ thin books میں کبھی کبھی 1.04 تک drift کر جاتا ہے)
Yes+No=1 arb سب سے صاف ہے: same market سے دونوں legs پڑھیں، اگر sum 0.97 سے نیچے آ جائے تو دونوں پر FOK fire کریں (spread tax کو allow کرتے ہوئے)۔ Capital required تقریباً ہر leg پر برابر ہوتا ہے؛ execution atomic ہوتی ہے جب دونوں fills ایک ہی response میں واپس آ جائیں۔
Mean reversion بمقابلہ trend continuation
Stat-arb کے دو regimes ہیں۔ Mean reversion: pair noise کی وجہ سے الگ ہو گیا ہے؛ آپ convergence پر bet کرتے ہیں۔ Trend continuation: نئے information آنے کی وجہ سے pair مزید diverge کرنا شروع ہو گیا ہے؛ آپ مزید divergence پر bet کرتے ہیں۔
ان دونوں میں فرق کرنا مشکل حصہ ہے۔ Heuristic: اگر divergence visible volume پر ہوئی ہو (whale نے ایک leg کی book کو sweep کیا ہو)، تو یہ news ہے - صرف تب fade کریں جب آپ کے پاس model ہو۔ اگر یہ low volume کے ساتھ آہستہ drift ہوئی ہو، تو یہ noise ہے - confidence کے ساتھ reversion trade کریں۔
New builders کے لیے: صرف mean reversion trade کریں، اُن pairs پر جہاں divergence تاریخی drift کے < 1 standard deviation کے اندر ہو۔ Trend continuation کے لیے ایک ایسا model چاہیے جو news کو پکڑ سکے؛ اس کے بغیر آپ informed flow کے خلاف trade کر رہے ہوتے ہیں۔
Resolving (not perpetual) markets کے لیے sizing
Prediction markets resolve ہوتے ہیں۔ Crypto pairs نہیں۔ اس سے math بدل جاتی ہے۔
Polymarket پر pair-arb position کا payout schedule fixed ہوتا ہے: جب دونوں markets resolve ہو جائیں، تو predicted spread اور actual spread کے درمیان difference lock ہو جاتی ہے۔ یہاں کوئی rolling نہیں، کوئی infinite holding نہیں۔
Sizing implication: آپ زیادہ سے زیادہ اتنا ہی hold کر سکتے ہیں جتنا time-to-resolution اجازت دیتا ہے، کیونکہ capital تب تک lock رہتا ہے۔ جو pair 6 months میں resolve ہو، وہ آپ کو share پر 3c کما سکتا ہے، لیکن اگر دونوں markets fully sized ہوں تو اس دوران آپ مزید capital deploy نہیں کر سکتے۔
صحیح framing یہ ہے: Polymarket پر stat-arb bounded-time trades کی series ہے، continuous strategy نہیں۔ Gross PnL کے بجائے locked capital per day پر PnL compare کریں۔
Risk: resolution کے بعد divergence
سب سے خراب stat-arb outcome یہ ہے کہ آپ کی prediction-of-convergence غلط نکلے کیونکہ underlying premise ہی غلط تھی۔ Examples:
- آپ نے "Trump president on Apr 1" کو short کیا، یہ سوچ کر کہ یہ "Trump president on Mar 1" کے قریب converge ہو جائے گا - لیکن date 1 market YES resolve ہوتی ہے اور date 2 NO، March impeachment کی وجہ سے۔ آپ کا "spread flat ہونا چاہیے" والا thesis غلط تھا۔
- آپ نے Polymarket بمقابلہ Kalshi پر same NBA Finals winner کا arb کیا۔ Polymarket اس ٹیم پر resolve ہوتا ہے جس نے official series جیتی؛ Kalshi ایک slightly different definition پر resolve ہوتا ہے جو overtime tie-breakers کو مختلف طرح include کرتی ہے۔ دونوں اپنے stated terms پر YES resolve ہوتے ہیں، مگر opposite directions میں۔
ہر market کے resolution criteria بہت احتیاط سے پڑھیں۔ Cross-venue arb ایک resolution-mismatch دور ہونے پر دونوں legs پر full loss میں بدل سکتا ہے۔
Code: pairs monitor اور threshold-trigger
Reference: دو correlated tokens monitor کریں، اور spread threshold cross کرے تو arb fire کریں۔
def pairs_monitor(token_a, token_b, threshold_cents=3, size=10):
"""Buy A and Sell B when (1 - ask_A) + bid_B > 1 + threshold."""
while True:
book_a = fetch_book(token_a)
book_b = fetch_book(token_b)
if not (book_a.best_ask and book_b.best_bid):
time.sleep(2); continue
# implied: cost of buying A at ask + value of selling B at bid
edge = (1 - book_a.best_ask) + book_b.best_bid - 1
if edge > threshold_cents / 100:
print(f"ARB edge={edge:.3f}; firing")
r_a = fok_buy(token_a, price=book_a.best_ask, size=size)
if r_a.status != "matched": continue
r_b = fok_sell(token_b, price=book_b.best_bid, size=size)
if r_b.status != "matched":
# leg A filled, B failed -- unhedged, exit A
fok_sell(token_a, price=book_a.best_bid, size=size)
time.sleep(3)
Partial-fill پر cleanup بہت اہم ہے۔ اس کے بغیر partial execution bot کو directional exposure دے دیتی ہے، جو stat-arb کے پورے مقصد کے الٹ ہے۔





