Polymarket Bot Tutorial · অধ্যায় ২৪ / ৩২
Polymarket perpetual futures (perps) bot: native 2-25x leverage, funding rate carry, liquidation distance math, ATR-based sizing, vs Binance/Bybit perps. Production-grade rules and code skeleton.
এই অধ্যায়ে কী কী আছে
Polymarket Perps হলো একটি নতুন instrument, যেখানে native 2-25x leverage এবং funding rates রয়েছে। এগুলো binary markets থেকে ভিন্নভাবে কাজ করে - liquidation বাস্তব, sizing math ভিন্ন, এবং edge sources prediction-market side-এর মতো নয়। এই অধ্যায়ে perps-specific bot patterns কভার করা হয়েছে।
এটি Polymarket trading bot তৈরি নিয়ে আমাদের ৩২-অংশের সিরিজের ২৪তম অধ্যায়। নিচের sections জুড়ে আমরা বিষয়টি গভীরভাবে আলোচনা করেছি। প্রতিটি section-এর body content chapter-by-chapter লেখা ও প্রকাশ করা হচ্ছে; FAQ answers এবং references ইতিমধ্যেই সম্পূর্ণ, এবং আমাদের নিজের trader চালানোর production experience প্রতিফলিত করে।
- perps কী এবং কেন এগুলো আলাদা
- Polymarket-এ native leverage (2-25x)
- Funding rate mechanics
- Liquidation distance math
- ATR-based position sizing
- Comparison: Polymarket perps vs Binance/Bybit
- Risk: liquidation cascade scenarios
- Code: stop সহ leveraged perp order place করা
perps কী এবং কেন এগুলো আলাদা
Polymarket Perpetual Futures (২০২৫ সালের শেষ দিকে launched) হলো binary prediction markets-এর থেকে আলাদা একটি instrument। Perps হলো underlying - BTC, ETH, বা অন্য কিছু - এর উপর continuous price exposure, যেখানে native leverage এবং funding rate থাকে।
binary-এর সঙ্গে পার্থক্য:
- Continuous: কোনো expiration date নেই, কোনো resolution নেই।
- Leveraged: nativeভাবে 2x-25x available, proxy contract gymnastics নেই।
- Funded: positive funding shorts-দের pay করে; negative funding longs-দের pay করে। Funding continuously accrue করে।
- Liquidatable: margin শেষ হয়ে গেলে exchange জোর করে আপনার position বন্ধ করে দেবে। বাস্তব loss।
Strategy-wise, perps হলো CFD trading, prediction market trading নয়। Edge sources একেবারেই আলাদা - technicals, funding-arb, basis trades; যার কোনোটাই binaries-এ প্রযোজ্য নয়।
Polymarket-এ native leverage (2-25x)
Polymarket Perps 2x থেকে 25x leverage অফার করে। leverage যত বেশি, আপনাকে liquidate করার জন্য price move তত ছোট লাগে।
10x leverage-এ, 10% adverse price move position wipe করে দেয়। BTC নিয়মিতভাবে এক সপ্তাহের মধ্যে 10% move করে, তাই কয়েক দিন ধরে রাখা 10x+ position-এ liquidation-এর ঝুঁকি অবহেলা করার মতো নয়।
Practical guidance: কয়েক দিন থেকে কয়েক সপ্তাহ ধরে রাখা swing trade-এর জন্য 2-5x leverage; day trade-এর জন্য 5-10x; 10x+ শুধুমাত্র sub-hour trade-এর জন্য, যেখানে tight stop আছে। Retail-এর জন্য 10x-এর উপরে যাওয়া gambling-এর কাছাকাছি; funding cost + liquidation tail expected return খেয়ে ফেলে।
Funding rate mechanics
Funding হলো per-hour payment, যেখানে longs shorts-দের pay করে (বা উল্টোটা), যেন perp price spot price-এর সঙ্গে tethered থাকে। Rate price gap থেকে compute হয়: positive gap → longs pay; negative gap → shorts pay।
Typical magnitude: স্বাভাবিক অবস্থায় প্রতি 8-hour period-এ 0.01-0.05%; extreme move-এ প্রতি period-এ 0.5% পর্যন্ত। Annualized করলে, এটা 1-50% - কয়েক দিন position ধরে রাখা strategy-এর জন্য যথেষ্ট বড়।
একটি strategy-র পুরো edge funding হতে পারে: যে side-এ payment পাওয়া যায়, সেখানে ঢুকুন; আর spot বা অন্য কোনো perp দিয়ে price exposure hedge করুন। এটাই classic basis-trade arb।
Liquidation distance math
Long-এর জন্য liquidation price: entry × (1 - 1/leverage). 10x-এ, $50,000 BTC-তে enter করা long $45,000-এ liquidate হবে (10% adverse)।
Short-এর জন্য: entry × (1 + 1/leverage). $50k-এ 10x short হলে liquidation হবে $55k-এ।
Theoretical liquidation price থেকে maintenance margin buffer (সাধারণত 0.5-1%, আপনার পক্ষে) বাদ দিয়ে math simplified করা হয়েছে। Sanity check-এর জন্য এই simple math ব্যবহার করুন; precise number-এর জন্য exchange-এর actual maintenance margin দেখুন।
Practical: position size + leverage এমন হতে হবে যাতে liquidation distance underlying-এর daily volatility-এর 2x-এর বেশি হয়। BTC-এর ~3% দৈনিক volatility-এর জন্য, no-stop position-এ leverage ≤ 16x হওয়া উচিত।
ATR-based position sizing
Average True Range (ATR) হলো volatility measure: শেষ N দিনের average daily price range। ATR-based position sizing risk-কে বর্তমান market condition-এর সঙ্গে যুক্ত করে।
Pattern: প্রতি trade-এ fixed dollar amount (যেমন $50) risk নিন। Position size = risk / (ATR × leverage). যদি BTC-এর daily ATR $1,500 হয় ($50k-এর 3%), এবং আপনি 10x leveraged হন, তাহলে position size হবে $50 / (1500 × 0.1) = প্রায় $3,300 notional।
এটি high-vol regime-এ position স্বয়ংক্রিয়ভাবে ছোট করে এবং low-vol regime-এ বড় করে। মূল benefit: market regime যাই হোক, একটি খারাপ দিনে আপনার equity-র ক্ষতি bounded থাকে।
Comparison: Polymarket perps vs Binance/Bybit
May 2026 অনুযায়ী, Polymarket Perps বনাম প্রধান CEX perp venue-গুলো।
| Polymarket Perps | Binance Perps | Bybit Perps | |
|---|---|---|---|
| Max leverage | 10x | 125x | 100x |
| Settlement | USDC on Polygon | USDT on BSC/internal | USDT |
| KYC required | varies by region | yes (most regions) | yes |
| API maturity | new, growing | mature, deep | mature |
| Liquidity (BTC) | moderate | extremely deep | deep |
আপনি যদি ইতিমধ্যেই Polymarket-এ থাকেন এবং একটি venue-র operational simplicity গুরুত্বপূর্ণ হয়, তবে Polymarket Perps সঠিক পছন্দ। শুধুমাত্র perp strategy-তে scale-এর জন্য CEX-গুলো liquidity-তে জেতে। আমরা যাদের চিনি, তাদের বেশিরভাগই নিজের binary position-এর সঙ্গে basis-arb করার জন্য Polymarket Perps ব্যবহার করেন, standalone perp venue হিসেবে নয়।
Risk: liquidation cascade scenarios
Catastrophic perp failure: একটি adverse move এত বড় যে liquidation ঘটায়, আর সেই liquidation নিজেই book pressure তৈরি করে আরও position liquidate করায়।
২০২৪-২৫ সালের CEX history-তে, BTC-তে একাধিক 10-20% intraday move হয়েছে, যেখানে 10x+ long কয়েক ঘণ্টার মধ্যে cascade হয়ে বেরিয়ে গেছে। Polymarket Perps-ও immune নয়; liquidity আরও পাতলা, তাই একই রকম move হলে liquidation আরও দ্রুত হতে পারে।
Defenses:
- Liquidation price-এর উপরে manual stop: hard limit এমন জায়গায় দিন, যা liquidation-এর 30-50% আগে, যাতে auto-liquidator-এর আগে আপনি বেরিয়ে আসতে পারেন (এতে liquidation fee-ও বাঁচে)।
- Position size limits: একক perp position-এ কখনোই equity-র 10%-এর বেশি risk নেবেন না।
- Regime change হলে halt: যদি 24h volatility baseline-এর 2x ছাড়িয়ে যায়, position size কমান বা নতুন entry pause করুন।
Code: stop সহ leveraged perp order place করা
Reference: hard stop সহ একটি Polymarket Perp position-এর order-placement skeleton।
def open_long_with_stop(symbol, entry_px, leverage, risk_usd):
# Compute position size from risk budget
liquidation_px = entry_px * (1 - 1/leverage)
stop_px = entry_px * (1 - 0.7/leverage) # 70% to liquidation
risk_per_share = entry_px - stop_px
shares = risk_usd / risk_per_share
# Place long entry
long_order = perp_api.place_order(
symbol=symbol, side="long", size=shares, leverage=leverage,
order_type="market"
)
if long_order.status != "filled": return None
# Place hard stop just below entry
stop_order = perp_api.place_order(
symbol=symbol, side="close", size=shares, stop_price=stop_px,
order_type="stop_market", reduce_only=True
)
return {"long": long_order, "stop": stop_order}
reduce-only stop নিশ্চিত করে যে এটি শুধু existing position বন্ধ করতে পারে, আপনাকে short-এ flip করতে পারে না। Production additions: profit-এর উপর trailing stop, funding-cost monitor, position-size halt।





