Build a Perp Funding and Polymarket Alert Bot With Public APIs
On an actual scan at 03:29 UTC on November 28, 2026, the bot read 179 Hyperliquid contracts, 562 Binance contracts and 43 usable Polymarket quotes from a 50-market sample. Binance reported HAEDALUSDT funding at −0.0164689 per four-hour period. Annualized, that prints as −3,606.7%. That number is a useful outlier to investigate. The time window and the unit are essential context for reading it.
Here's how to build a small Python bot that compares funding in the same units, estimates what four taker fills cost, and sends a digest when rates or spreads cross your thresholds. The market APIs require zero API keys. Telegram and Discord delivery use your own messaging credentials.
1. Read the settlement interval with the rate
Hyperliquid's public /info endpoint accepts {"type": "metaAndAssetCtxs"}. The result pairs the contract universe with contexts containing an hourly funding field. Binance supplies lastFundingRate via /fapi/v1/premiumIndex, interval overrides via /fapi/v1/fundingInfo, and quote assets plus contract status via /fapi/v1/exchangeInfo.
def annualized_percent(period_rate: float, hours: float) -> float: return period_rate * (24 / hours) * 365 * 100 # The same 1 bp period rate means different things at different cadences. print(annualized_percent(0.0001, 1)) # 87.60% print(annualized_percent(0.0001, 4)) # 21.90% print(annualized_percent(0.0001, 8)) # 10.95% Fetch the Binance metadata before comparing rates. For an active stablecoin perpetual without a symbol override, use the eight-hour default. Join the venues on the underlying ticker. The gross spread is the absolute difference in annualized rates. The higher signed rate identifies the short leg of the model, even when both rates are negative.
Hyperliquid funding rules · Binance futures market data
2. Put the fee estimate on the same footing
Capital of 1,000 USDC at 2× leverage per leg, split evenly, gives 1,000 USDC-equivalent notional on each venue. A hypothetical 36.5 percentage point annualized funding spread earns 1.00 USDC-equivalent per day before costs at that size. With example taker fees of 0.045% and 0.05%, entry and exit cost 1.90 USDC-equivalent in total.
notional = 1_000 * 2 / 2 gross_daily = notional * 0.365 / 365 round_trip = notional * 2 * (0.00045 + 0.00050) net_daily = gross_daily - round_trip / 30 net_apr_pct = net_daily / 1_000 * 365 * 100 break_even_days = round_trip / gross_daily That works out to 0.94 USDC-equivalent per day, 34.19% net APR over a 30-day fee amortization period and a 1.90-day fee break-even. These are model outputs for a constant rate, equal notionals and stablecoin parity. Slippage, basis moves, margin limits and liquidation can change the outcome. The terminal exposes the fee and duration inputs so you can see when the estimate turns negative.
3. Compare live quotes on Polymarket
Start with GET /markets?active=true&closed=false&limit=50&order=volume24hr&ascending=false on Gamma. Keep markets accepting orders with both quotes and calculate bestAsk - bestBid. In the same November 28 snapshot, the widest usable quote in the sample had a 28¢ bid and a 54¢ ask, a 26¢ spread. A wide spread is a liquidity signal. Check order-book depth and available size before trying to execute anything.
Polymarket market response fields
4. Run the scanner and route its alerts
git clone https://github.com/quietstack-labs/crypto-alpha-scanner.git cd crypto-alpha-scanner python pro-bot-kit/scanner_pro.py --json python pro-bot-kit/scanner_pro.py --watch 300 --min-apr 25 --min-spread 0.04 --min-volume 10000 python scripts/alpha_snapshot.py Set DISCORD_WEBHOOK_URL to enable a Discord channel, or set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID for Telegram. Use the scan thresholds to control what gets through. The watch process suppresses repeats of the same leaders per destination. The separate snapshot command exits nonzero and leaves stdout empty if any market feed fails, which lets an external publishing job skip that cycle.
Telegram sendMessage · Discord incoming webhooks
Try the live funding calculator or get the Pro Alert Bot Kit with its setup guide and tests in one ZIP.