Polymarket Bot Tutorial · अध्याय 15 of 32
Polymarket पर sports microstructure bots: in-game edge, scoreline-driven mispricing, NBA tag (745) और Tennis tag (864), live data sources, और high-frequency sports markets के लिए execution patterns.
यह अध्याय क्या कवर करता है
Sports markets Polymarket पर सबसे लगातार active non-political segment हैं। जो bots काम करते हैं, वे दो साफ़ buckets में आते हैं: pre-game line-catchers जो line set होने के बाद trade करते हैं, और in-game microstructure bots जो play के दौरान order-book movement पर react करते हैं। यह chapter दोनों को cover करता है, specific tag IDs, data sources, और latency budgets के साथ जो हर एक पर लागू होते हैं।
Sports markets Polymarket पर सबसे busy non-political segment हैं। जो execution pattern काम करता है, वह live-score feed (ESPN, PandaScore) को order-book microstructure signals के साथ combine करता है। यह chapter बताता है कि NFL, NBA, soccer, और tennis के लिए क्या काम करता है, और esports कहाँ अलग है।
- Sports markets tradeable क्यों हैं
- Pre-game vs in-game (अलग bots)
- Verified tag IDs (745 NBA, 864 Tennis)
- Data sources: ESPN, official APIs, on-screen
- In-game के लिए latency budget
- 0.99 / 0.01 trap
- Code: games book subscribe करें और react करें
Sports markets tradeable क्यों हैं
Sports markets defined timeframes (hours से days) में settle होते हैं, public live data होती है, और games के दौरान continuous order flow attract करते हैं। Tradeable market के लिए ये तीनों ज़रूरी हैं - political markets में "defined timeframe" missing होता है, weather markets में "continuous flow" missing होता है, और obscure tournaments में "public live data" missing होती है।
Sports markets पर trader population भी, मान लीजिए election markets के मुकाबले, ज़्यादा diverse होती है। Casual sports bettors भावनाओं के आधार पर price करते हैं; informed traders game के दौरान fair value की तरफ correct करते हैं। इन दोनों के बीच का gap ही bot edge है।
Volume distribution uneven होती है: NFL Sunday पर Polymarket sports markets में hundreds of millions of dollars rotate हो सकते हैं; Tuesday-night Saudi Pro League fixture शायद $50k से कम कर दे। अपनी strategy को उस जगह के हिसाब से size करें जहाँ action सच में है।
Pre-game vs in-game (अलग bots)
दो fundamentally अलग bot designs.
Pre-game line-catcher: अभी-अभी खुले markets scan करें, अपने model या sharper venue के number के मुकाबले mis-priced lines identify करें, FOK buy place करें। In-play तक hold करें, कभी-कभी resolution तक। Speed: minutes-not-seconds. Edge: model + line-shopping.
In-game microstructure: live game के order book WebSocket को subscribe करें, score events + imbalance signals पर seconds के भीतर react करें। Speed: seconds-not-minutes. Edge: latency + order flow पढ़ना।
दोनों का code लगभग साझा नहीं होता। इनके risk profiles अलग हैं, data sources अलग हैं, exit strategies अलग हैं। जो bot दोनों करने की कोशिश करता है, वह अंत में दोनों को ठीक से नहीं करता; एक चुनें।
Verified tag IDs (745 NBA, 864 Tennis)
Production tag IDs, major sports categories के लिए May 2026 में verified। इन्हें /events calls को efficiently filter करने के लिए use करें।
| Sport / League | Tag ID | Tag slug | Notes |
|---|---|---|---|
| NBA | 745 | nba | highest volume Oct-Jun |
| NFL | 450 | nfl | peak Sun/Mon Sep-Feb |
| Tennis (all) | 864 | tennis | year-round, tournament cadence |
| Soccer (general) | 1059 | soccer | combine with sub-tags below |
| EPL | 739 | epl | |
| UCL | 2186 | uefa-champions-league | |
| Esports (all) | 702 | esports | LoL+CS2+Valorant+Dota |
| MLB | 1245 | mlb | peak Apr-Oct |
| NHL | 823 | nhl | peak Oct-Jun |
Tag IDs साल दर साल stable रहते हैं। नए tags add किए जाते हैं (Saudi Pro League, IPL), लेकिन पुराने tags का renumber नहीं होता।
Data sources: ESPN, official APIs, on-screen
Traditional sports के लिए free ESPN scoreboard API आपकी ज़रूरत की सब चीज़ cover करता है: scores, period/clock, win-probability, और कभी-कभी shot location। कोई key required नहीं; rate limiting सिर्फ IP level पर होती है। Endpoint pattern: https://site.api.espn.com/apis/site/v2/sports/<sport>/<league>/scoreboard.
Esports के लिए ESPN coverage नहीं देता। Options: PandaScore ($30-60/mo, industry standard), HLTV (sirf CS2, scrapeable, कोई API नहीं), Liquipedia (community-maintained, scrapeable, slower update cadence)।
On-screen feeds (TV stream के लिए pay करके scorebug को OCR-reading करना) काम करते हैं, लेकिन operationally heavy हैं। इन्हें केवल तभी recommend किया जाता है जब आपकी strategy को ऐसे sport पर sub-3-second updates चाहिए हों, जहाँ कोई API real time में cover नहीं करती।
In-game के लिए latency budget
In-game reactive bot के लिए end-to-end latency budget.
- Score event होता है: t=0
- Source feed reflect करता है: t+3-15s (ESPN: ~10s; PandaScore: ~3s)
- आपका bot feed read करता है: t+10-16s
- Bot action decide करता है: +50ms
- FOK order place होता है: +200-500ms
- CLOB पर matched होता है: +300-1000ms (network + matching)
Total: 11-17 seconds। सबसे तेज़ professional firms paid premium feeds और co-located VPS के साथ end-to-end 3-5 seconds achieve करती हैं। Standard hosts और free ESPN पर चलने वाले retail bots slower end पर होते हैं।
जिन strategies को sub-5s चाहिए, वे retail के लिए viable नहीं हैं। जिन strategies का 10-17s window में काम बनता है, वे हैं: score के बाद line-catching, overreactions को fade करना, late-game certainty plays।
0.99 / 0.01 trap
सबसे common in-play sports bot failure: one minute left रहते हुए heavy favorite को 0.99 पर खरीदना, और easy +1¢ की उम्मीद करना। यह तीन कारणों से fail होता है।
पहला, underdog की 1% implied probability zero नहीं होती - late comebacks non-trivial frequency से होते हैं। 99.5% certain win, 200 बार खेला जाए, तो full position size पर एक loss देता है।
दूसरा, 0.99/0.01 पर spread का मतलब है कि आप share के लिए 99c pay करते हैं, success पर 1c जीतते हैं, और rare reversal पर 99c lose करते हैं। Risk-reward बहुत brutal है।
तीसरा, GTC sell at 0.999 इस्तेमाल करने वाला bot शायद ही fill होगा - उस price पर buyers नहीं होते। Position resolution तक ride करती है। अगर वह जीतता है, आपको 1c मिला। अगर reversal हुआ, तो आप 99c हार गए।
यह trap असली पैसा खोवाता है उन builders को जिन्होंने math run नहीं किया। 0.95+ priced markets से दूर रहें, जब तक आपकी strategy खास तौर पर redemption-arbitrage profile के लिए built न हो।
Code: games book subscribe करें और react करें
Reference: एक specific NBA game के WebSocket को subscribe करें, book updates log करें, imbalance signal पर FOK fire करें।
import websocket, json
THRESHOLD = 0.5 # imbalance level to trigger
def on_message(ws, message):
msg = json.loads(message)
if msg.get("event_type") != "book": return
bids = msg.get("bids", [])
asks = msg.get("asks", [])
bid_depth = sum(float(b["price"]) * float(b["size"]) for b in bids[:5])
ask_depth = sum(float(a["price"]) * float(a["size"]) for a in asks[:5])
total = bid_depth + ask_depth
if total < 100: return # too illiquid
imb = (bid_depth - ask_depth) / total
if abs(imb) > THRESHOLD:
print(f"signal imb={imb:.2f} bid={bid_depth:.0f} ask={ask_depth:.0f}")
# fire FOK here
ws = websocket.WebSocketApp(
"wss://ws-subscriptions-clob.polymarket.com/ws/market",
on_open=lambda ws: ws.send(json.dumps({"type":"Market","markets":["<CONDITION_ID>"]})),
on_message=on_message
)
ws.run_forever()
Production additions: fires के बीच cooldown, per-token inventory cap, stale book पर kill (30s में कोई message नहीं)।





