Polymarket Bot Tutorial · Chapter 15 of 32
Polymarket-এ sports microstructure bot: in-game edge, scoreline-driven mispricing, NBA tag (745) এবং Tennis tag (864), live data sources, আর high-frequency sports markets-এর জন্য execution patterns।
এই chapter-এ কী covered হয়েছে
Sports markets হল Polymarket-এর সবচেয়ে নিয়মিতভাবে active non-political segment। যেসব bot কাজ করে, সেগুলো পরিষ্কারভাবে দুই ভাগে পড়ে: pre-game line-catchers, যারা line set হওয়ার পর trade করে, আর in-game microstructure bots, যারা play চলাকালীন order-book movement-এ react করে। এই chapter-এ দুটোই covered হয়েছে, নির্দিষ্ট tag IDs, data sources, আর latency budgets সহ যা প্রতিটির জন্য প্রযোজ্য।
Sports markets হল Polymarket-এর সবচেয়ে ব্যস্ত non-political segment। কাজ করে এমন execution pattern-এ একটি live-score feed (ESPN, PandaScore) এবং order-book microstructure signals একসাথে ব্যবহার করা হয়। এই chapter-এ বিশেষভাবে NFL, NBA, soccer, আর tennis-এর জন্য কী কাজ করে, এবং esports কোথায় আলাদা - তা covered হয়েছে।
- কেন sports markets tradeable
- Pre-game বনাম in-game (different 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: subscribe to a games book and react
কেন sports markets tradeable
Sports markets-এর settlement time নির্দিষ্ট (hours to days), public live data আছে, আর game চলাকালীন continuous order flow আসে। এই তিনটি জিনিসই tradeable market-এর জন্য প্রয়োজনীয় - political markets-এ "defined timeframe" নেই, weather markets-এ "continuous flow" কম, আর obscure tournaments-এ "public live data" নাও থাকতে পারে।
Sports markets-এ trader population-ও, ধরুন election markets-এর তুলনায়, বেশি diverse। Casual sports bettors আবেগের ভিত্তিতে price করে; informed traders game-এর course-এ fair value-এর দিকে correction আনে। এই দুটির মধ্যে gap-ই bot edge।
Volume distribution অসম: একটি NFL Sunday-তে Polymarket sports markets জুড়ে hundreds of millions of dollars rotate করতে পারে; Tuesday-night Saudi Pro League fixture-এ under $50k-ও হতে পারে। Strategy size করুন যেখানে সত্যিকারের action আছে সেখানে।
Pre-game বনাম in-game (different bots)
দুটি fundamentally আলাদা bot design।
Pre-game line-catcher:刚 opened markets scan করে, আপনার model বা sharper venue-এর number-এর বিরুদ্ধে mis-priced lines identify করে, FOK buy place করে। In-play পর্যন্ত hold করে, কখনও resolution পর্যন্ত। Speed: seconds নয়, minutes। Edge: model + line-shopping।
In-game microstructure: live game's order book WebSocket-এ subscribe করে, imbalance signals + score events-এ seconds-এর মধ্যে react করে। Speed: minutes নয়, seconds। Edge: latency + order flow পড়া।
দুটোর code প্রায় এক নয়। Risk profile, data sources, exit strategy - সব আলাদা। একই bot-এ দুটো করার চেষ্টা করলে শেষ পর্যন্ত কোনোটাই ভালো হয় না; একটিই বেছে নিন।
Verified tag IDs (745 NBA, 864 Tennis)
Major sports categories-এর জন্য May 2026-এ verified production tag IDs। এগুলো ব্যবহার করে /events calls দক্ষভাবে filter করুন।
| Sport / League | Tag ID | Tag slug | Notes |
|---|---|---|---|
| NBA | 745 | nba | Oct-Jun-এ highest volume |
| NFL | 450 | nfl | peak Sun/Mon Sep-Feb |
| Tennis (all) | 864 | tennis | year-round, tournament cadence |
| Soccer (general) | 1059 | soccer | নিচের sub-tags-এর সাথে combine করুন |
| 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-এর renumbering হয় না।
Data sources: ESPN, official APIs, on-screen
Traditional sports-এর জন্য free ESPN scoreboard API-ই আপনার প্রয়োজনীয় সবকিছু cover করে: scores, period/clock, win-probability, কখনও shot location-ও। কোনো key লাগে না; শুধু IP level-এ rate-limited। Endpoint pattern: https://site.api.espn.com/apis/site/v2/sports/<sport>/<league>/scoreboard।
Esports-এর জন্য ESPN-এর coverage নেই। Option: PandaScore ($30-60/mo, industry standard), HLTV (শুধু CS2, scrapeable, কোনো API নেই), Liquipedia (community-maintained, scrapeable, update cadence ধীর)।
On-screen feeds (TV stream-এর জন্য pay করে OCR দিয়ে scorebug পড়া) কাজ করে, কিন্তু operationally heavy। শুধুমাত্র তখনই recommended, যখন আপনার এমন strategy আছে যা এমন একটি sport-এ sub-3-second updates চায়, যার real-time API coverage নেই।
In-game-এর জন্য latency budget
In-game reactive bot-এর end-to-end latency budget।
- Score event happens: t=0
- Source feed reflects: t+3-15s (ESPN: ~10s; PandaScore: ~3s)
- Your bot reads the feed: t+10-16s
- Bot decides action: +50ms
- FOK order placed: +200-500ms
- Matched at CLOB: +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-এ চালানো retail bots আর free ESPN slow end-এ থাকে।
যেসব strategy-র sub-5s দরকার, সেগুলো retail-এর জন্য viable নয়। 10-17s window-এ কাজ করে এমন strategy হলো: score-এর পর line-catching, overreaction fading, late-game certainty plays।
0.99 / 0.01 trap
সবচেয়ে common in-play sports bot failure: এক মিনিট বাকি থাকতে heavy favorite-কে 0.99-এ buy করা, ভেবে সহজে +1¢ পাওয়া যাবে। এটি কেন fail করে, তার তিনটি কারণ।
প্রথমত, underdog-এর 1% implied probability শূন্য নয় - late comebacks non-trivial frequency-তে ঘটে। 99.5% certain win, 200 বার play করলে full position size-এ একবার loss হয়।
দ্বিতীয়ত, 0.99/0.01 spread মানে আপনি share প্রতি 99c দেন, success-এ 1c জিতেন, আর বিরল reversal-এ 99c হারান। Risk-reward brutal।
তৃতীয়ত, GTC sell at 0.999 ব্যবহার করা bot-টা খুব কমই fill হবে - সেই price-এ buyer থাকে না। Position resolution পর্যন্ত ride করে। জিতলে 1c পেলেন। reversal হলে 99c হারালেন।
এই trap বাস্তব টাকা নষ্ট করে যাদের math করা ছিল না। আপনার strategy যদি বিশেষভাবে redemption-arbitrage profile-এর জন্য তৈরি না হয়, তাহলে 0.95+ priced markets থেকে দূরে থাকুন।
Code: subscribe to a games book and react
Reference: নির্দিষ্ট 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 না এলে)।





