Polymarket Bot Tutorial · Chapter 14 of 32

Polymarket پر News arbitrage: headlines، source feeds (RSS/Twitter/AP)، latency budgets، false-positive filters، اور کب news edge market price میں dissolve ہو جاتی ہے، اس پر market کو کیسے beat کریں۔

اس chapter میں کیا cover کیا گیا ہے

News arbitrage public information پر market کے دوبارہ price کرنے سے پہلے trade کرنے کی strategy ہے۔ یہ edge حقیقی ہے مگر narrow ہے - زیادہ تر "news" اُس وقت تک price میں شامل ہو چکی ہوتی ہے جب تک انسان اسے پڑھ سکے۔ اس chapter میں ہم دیکھیں گے کہ کون سے sources واقعی market کو beat کرتے ہیں، وہ latency budget جو strategy کو define کرتا ہے، اور وہ false-positive filter جس کے بغیر bot ہر retweet پر trade کرتا رہتا ہے۔

  • Information edge کی شکل کیا ہوتی ہے
  • News sources: RSS, Twitter, AP, official feeds
  • Latency budget: read-to-trade under 2 seconds
  • False-positive filters
  • کب news edge ختم ہو جاتی ہے
  • Code: news feed poll کرنا اور relevant markets پر FOK place کرنا
  • Risk: half-truths اور walked-back headlines

Information edge کی شکل کیا ہوتی ہے

News arbitrage کا مطلب ہے public information پر market کے دوبارہ price کرنے سے پہلے trade کرنا۔ Edge ایک narrow window میں موجود ہوتی ہے - عموماً 30-300 seconds - اُس وقت کے درمیان جب کوئی fact public ہوتا ہے اور Polymarket اسے reflect کرتا ہے۔

Edge کے حقیقی ہونے کے لیے تین چیزیں درست ہونی چاہئیں۔ پہلی، news source اوسط Polymarket trader سے تیز ہونی چاہیے (Twitter mainstream press سے تیز ہے؛ AP wire Twitter سے تیز ہے)۔ دوسری، news غیر مبہم ہونی چاہیے (جیسے injury announcement، court ruling) - interpretation latency کھا جاتی ہے۔ تیسری، market اتنا wide ہونا چاہیے کہ price move spread tax کے قابل ہو۔

اس edge کو hunt کرنے والے bots دو camps میں بٹتے ہیں: وہ جو direct sources subscribe کرتے ہیں اور parse کرتے ہیں، اور وہ جو Polymarket پر unusual price move دیکھ کر infer کرتے ہیں کہ news آ گئی ہے۔ دونوں valid ہیں؛ پہلی approach lead کرتی ہے، دوسری follow کرتی ہے۔

News sources: RSS, Twitter, AP, official feeds

Sources کو public-information-status تک latency کے حساب سے rank کیا گیا ہے، fastest پہلے۔

  • Direct primary sources: court filings، government press releases، central-bank announcements۔ اکثر public RSS یا API ہوتا ہے۔ سب سے تیز، false-positive rate سب سے کم۔
  • AP wire / Reuters Eikon (paid). وہ wire جسے traditional traders use کرتے ہیں۔ Consumer Twitter پر تقریباً 5-30 second lead۔
  • Twitter (X, paid API). Verified accounts کی lists: official org accounts، beat reporters۔ Free APIs کی rate-limiting بہت سخت ہوتی ہے؛ Pro tier لیں یا relay service استعمال کریں۔
  • Specialized newsletters / Discord: paid Substacks، embargoed industry feeds۔ niche markets (crypto، esports) کے لیے مفید۔
  • Mainstream press websites: news-arb edge کے لیے بہت سست۔

ہر اُس چیز کے لیے RSS استعمال کریں جو RSS publish کرتی ہے - یہ free ہے، polling intervals reliable ہوتے ہیں۔ باقی کے لیے Twitter۔ Production-serious news desks کے لیے AP۔

Latency budget: read-to-trade under 2 seconds

Bot کو ingest، classify، decide، اور order place کرنا ہوتا ہے، اور یہ سب مجموعی طور پر 1-2 seconds میں ہونا چاہیے۔ Budget یہ ہے:

  • Ingest: 50-300ms (websocket feed، RSS poll، Twitter stream).
  • Classify: 50-200ms (regex / keyword match، optionally LLM اگر prompt cache کر لیا جائے).
  • Decide: 50ms (rules table lookup؛ news tag سے market slug mapping).
  • Place: 200-500ms (FOK signed order to CLOB).

Budget کا سب سے بڑا مصرف LLM classification ہے۔ 500-token GPT-4 call 1-3 seconds لگا دیتا ہے؛ یعنی پورا arb window ختم۔ Production کے لیے keyword rules سے classify کریں؛ LLM صرف keyword set کی offline calibration کے لیے استعمال کریں۔

False-positive filters

وہ news-arb bots جو false positives filter نہیں کرتے، ہر retweet پر trade کرتے ہیں اور spread tax کی وجہ سے bleed کرتے رہتے ہیں۔ تین filters:

  • Source whitelist: صرف pre-approved list میں موجود accounts/feeds پر act کریں۔ یہ list چھوٹی ہوتی ہے (10-30 sources).
  • Keyword + confirmation pair: ایک keyword match noise ہوتا ہے؛ 30s کے اندر دو independent sources میں match signal ہے۔
  • Market-state guard: اُن markets کو skip کریں جو پچھلے 60 seconds میں پہلے ہی > 5% move کر چکی ہیں - کسی اور نے پہلے ہی news catch کر لی، edge ختم ہو گئی۔

اچھی طرح tune کیے گئے filters کی false-positive rate: تقریباً 1 میں 5-10۔ 90% false-positive rate strategy کو تباہ کر دیتی ہے؛ 50% rate چھوٹے position sizes کے ساتھ قابلِ عمل ہے۔

کب news edge ختم ہو جاتی ہے

"news public" سے "price news reflect کرتی ہے" تک کا window ہر سال تیزی سے بند ہو رہا ہے۔ 2020 میں mid-priced political markets کو headline absorb کرنے میں minutes لگتے تھے۔ 2026 میں وہی headlines 30-90 seconds میں compress ہو جاتی ہیں، اس سے پہلے کہ price پوری طرح move کرے۔

Edge ختم ہونے کی نشانیاں: flagged trades پر per-trade PnL +3c سے flat ہو جائے 30-trade window میں؛ false positives کی شرح جو بعد میں پہلے ہی priced-in نکلتی ہیں 70% سے اوپر چلی جائے؛ market آپ کی FOK ask کو 200ms کے اندر hit کر دے کیونکہ کوئی اور پہلے پہنچ گیا۔

جب edge ختم ہو جائے تو honest pivot یہ ہے: سست، زیادہ interpretive news کی طرف جائیں (court rulings، central bank meeting minutes) جہاں meaning parse کرنے میں latency race سے زیادہ وقت لگتا ہے۔ یا پھر strategy چلانا بند کر دیں۔

Code: news feed poll کریں اور relevant markets پر FOK place کریں

Production skeleton: ایک news source poll کریں، rule matches چلائیں، hits پر FOK orders fire کریں۔

import feedparser, time, re
from py_clob_client.client import ClobClient

RULES = [
  {"regex": re.compile(r"out for season|torn ACL", re.I), "tag":"injury-fade"},
  {"regex": re.compile(r"federal reserve.*(rate cut|rate hike)", re.I), "tag":"fed-move"},
]

seen = set()
while True:
    feed = feedparser.parse("https://example.com/news.rss")
    for entry in feed.entries[:20]:
        if entry.id in seen: continue
        seen.add(entry.id)
        for rule in RULES:
            if rule["regex"].search(entry.title + " " + entry.summary):
                # Look up relevant Polymarket markets, place FOK
                fire(rule["tag"], entry)
                break
    time.sleep(15)

Polling intervals: RSS کے لیے 5-15 seconds۔ جہاں available ہو وہاں WebSocket (Twitter، AP wire). ہمیشہ source-provided ID سے dedup کریں؛ کبھی assume نہ کریں کہ polling exactly-once ہے۔

Risk: half-truths اور walked-back headlines

News-arb bot کا بدترین دن وہ ہوتا ہے جب headline غلط نکل آئے۔ مثالیں: Reuters tweet کہتی ہے "Trump fires Yellen," market 8 cents jump کرتی ہے، 12 minutes بعد tweet delete ہو جاتی ہے اور درست کر دی جاتی ہے۔ 8c پر buy کرنے والا bot اب -3c پر inventory hold کر رہا ہے اور کوئی recourse نہیں۔

Defenses:

  • Two-source confirmation: کبھی ایک tweet پر trade نہ کریں؛ 60-180 seconds کے اندر دوسری independent source سے corroborating signal ضروری ہو۔
  • Position size scaled to source confidence: AP wire = full size; verified beat reporter کی Twitter = 50%; rumor source = 25%.
  • Auto-exit on retraction signal: اگر آپ کی استعمال کردہ source 30 minutes کے اندر correction جاری کرے، تو PnL سے قطع نظر market پر exit کریں۔

Walk-back problem news-arb position sizing پر ایک hard ceiling ہے۔ ہر signal پر $50 trade کرنا آپ کو 30% false-positive rate کے ساتھ survive کرنے دیتا ہے؛ $500 trade کرنا نہیں۔

اکثر پوچھے جانے والے سوالات

کیا retail bot واقعی news پر market کو beat کر سکتا ہے؟
ہاں - مگر صرف تب جب آپ کے پاس تیز، reliable news source اور low-latency execution path ہو۔ Twitter (اب X) API restrictions سے پہلے gold standard تھا؛ Reuters/AP/Bloomberg کی RSS اگلی بہترین چیز ہے۔ جیسے جیسے مزید bots compete کر رہے ہیں، retail edge سکڑ گیا ہے؛ 50ms نہیں بلکہ 200-1000ms total read-to-trade کی توقع رکھیں۔
مجھے کن news sources کو subscribe کرنا چاہیے؟
AP (apnews.com)، Reuters (reuters.com)، اور BBC کے RSS feeds آپ کو broad coverage دیتے ہیں۔ Polymarket-specific: platforms کے اپنے Twitter اور Discord channels اکثر market changes پہلے announce کرتے ہیں۔ مخصوص topics کے لیے: government press releases (Federal Reserve PDFs، CFTC، WHO).
میرا bot news پر کتنی تیزی سے react کرے؟
Retail edge کے لیے: news کے ظاہر ہونے سے لے کر order submit ہونے تک 2 seconds سے کم۔ HFT-tier edge (دوسرے bots کے مقابلے میں) کے لیے: 200ms سے کم۔ زیادہ تر retail 1-3 second window میں compete کر سکتی ہے کیونکہ باقی retail bots یا تو اس سے بھی سست ہوتے ہیں یا بعض feed types پر موجود ہی نہیں ہوتے۔
False-positive news triggers سے کیسے بچوں؟
News کو specific market کے ساتھ احتیاط سے match کریں۔ "Ceasefire" 100 contexts میں آ سکتا ہے؛ صرف کچھ آپ کے specific market کے لیے اہم ہوں گے۔ keyword AND market-tag filters استعمال کریں: trigger کرنے سے پہلے keyword "ceasefire" AND market-tag "Israel-Hezbollah"۔ اس سے بھی بہتر - trade سے پہلے LLM کے ذریعے news کو relevant classify کریں۔
جب news بعد میں walked back ہو جائے تو کیا ہوتا ہے؟
آپ کی position چند seconds میں winning سے losing میں flip ہو سکتی ہے۔ News-arb bots کو fast exit policy چاہیے: اگر follow-up source N minutes کے اندر headline سے contradict کرے، تو loss پر بھی فوراً position close کریں۔ ہمارا rule: اگر کوئی follow-up original signal پر confidence کم کرے تو -3% سے -5% پر close کریں۔
کیا news arbitrage قانونی ہے؟
Public news پر trade کرنا جہاں تک ہمیں معلوم ہے ہر جگہ قانونی ہے۔ Material non-public information (insider tips، leaks قبل از official release) پر trade کرنا قانونی نہیں۔ Public sources تک محدود رہیں، trade ٹھیک رہے گی۔