Funding Rate Arbitrage Monitor in Python
Poll one API for funding-rate divergence across Bybit, Binance, and Hyperliquid instead of maintaining three separate exchange integrations.
The Problem: 3 Exchanges, 1 Spread
Perpetual futures funding rates rarely match across venues. Bybit, Binance, and Hyperliquid each compute funding independently from their own order books, and at any given moment one exchange can be paying longs while another is paying shorts on the same symbol. That divergence is the raw material for a market-neutral funding-rate arbitrage: go long on the exchange with the lower (or negative) funding rate, short an equivalent notional on the exchange with the higher rate, and collect the difference every funding period — while the price exposure on the two legs cancels out.
The mechanical idea is simple. Actually watching for it is not. Doing this by hand means opening three exchange APIs, mapping their symbol lists and funding intervals to each other, normalizing the units (some report per-8h, some per-hour, some annualized), and re-checking all of it every few minutes across however many symbols you care about. Bybit alone lists funding for 500+ perpetuals. Do that across three exchanges and you are maintaining three rate-limited clients, three response schemas, and a symbol-reconciliation layer before you've written a single line of arbitrage logic.
This playbook replaces all of that with one HTTP call. Smart Money API already samples funding rates from Bybit, Binance, and Hyperliquid, normalizes them onto a common per-8h basis, computes the cross-exchange spread and an annualized APR, and hands you a ranked list of opportunities. Your job becomes: poll, filter by a threshold you choose, and act (or just log it and watch).
Prerequisites
You'll need:
- Python 3.8 or newer
- The
requestslibrary (pip install requests --break-system-packagesor inside a virtualenv) - Optionally, a free API key from smartmoneyapi.com/signup — the endpoint in this playbook is public and works without one, but a key raises your throughput ceiling and is required for the full (uncapped) version described in "What to Build Next"
GET /v1/derivatives/funding-arb is a public endpoint. It returns the top 10 opportunities by spread size — enough to build and test the monitor below.
The Endpoint
GET https://api.smartmoneyapi.com/v1/derivatives/funding-arb takes no required query parameters. It refreshes roughly every 2 minutes server-side, so polling more often than that just re-fetches the same snapshot. Each opportunity in the response includes which exchange to go long on (the one with the lower funding rate) and which to short (the higher rate), the spread itself, an annualized APR for comparing opportunities at a glance, and a mechanical profit estimate per $10,000 of notional for a single funding period.
estimated_profit_per_10k_per_8h is a mechanical spread calculation for one 8-hour funding period (see profit_horizon_hours on the same object), assuming the spread holds and ignoring fees, slippage, and withdrawal/transfer time between exchanges. It is not a backtested return and not a promise of profit. Funding rates resettle roughly every 8 hours, and spreads can close — or reverse — before you can actually enter both legs. Treat this as a monitoring signal to investigate, not an executable guarantee.
Python Monitor Script
This script polls the endpoint on a loop, prints a summary each cycle, and raises a console alert for any symbol whose spread crosses your chosen threshold. It uses a persistent requests.Session(), reads an optional API key from the SMARTMONEY_API_KEY environment variable, and handles timeouts and connection errors without crashing the loop.
JavaScript / Node.js Variant
The same single-poll logic in Node.js (18+) using the built-in fetch — no npm dependencies. Wrap the pollOnce() call in a setInterval if you want the same 120-second loop as the Python version.
The public endpoint caps results at the 10 largest spreads. A free account still gets you 200 calls/day on this endpoint plus the rest of the public data surface — upgrade later if you need more.
Create a free account →Expected Output
A single poll of the public endpoint returns JSON shaped like this (fields trimmed to one opportunity for readability — the live response can include up to 10):
The Python script above would turn that BTC row into a console line reading something like: ALERT BTC: spread 0.0142% (15.55% annualized) — Long BTC on bybit / Short on binance — est. $1.42 per $10k/period — Low spread — ensure fees do not consume the arbitrage margin.
What to Build Next
Once the monitor loop above is running reliably, a few natural next steps:
- Upgrade to the full list.
GET /v1/funding-arb(Trader tier, $29/mo, needs anX-API-Keyheader) returns every opportunity the scanner finds — not just the top 10 — plusspread_historyandspread_rawfields for tracking how a spread evolved before you saw it. - Go raw with the funding heatmap.
GET /v1/derivatives/heatmap(Trader tier) gives you the underlying per-exchange funding rate and open interest for every symbol — useful if you want to compute your own spread logic instead of relying on the pre-ranked opportunity list. There's a public, top-10-capped sibling atGET /v1/derivatives/funding-heatmapif you want to prototype first. - Add your own execution guardrails. Before wiring this into anything that places orders, add checks for available balance on both exchanges, current withdrawal limits if you need to rebalance collateral, and a minimum spread that clears your expected round-trip fees on both legs — the API surfaces the opportunity, not the trade.
- Persist snapshots. Log each poll to a local SQLite file or CSV so you can see how often large spreads actually appeared versus how long they lasted — useful context before deciding a threshold is worth automating around.
Skip the three exchange integrations
One API key gets you normalized funding, open interest, and long/short ratio data across Bybit, Binance, and Hyperliquid — plus on-chain, options, and whale-flow data on the same key.
See plans and limits