Perp Basis Scanner
Compares spot and perpetual futures prices across Binance, Bybit, OKX, and Deribit for a given symbol, reporting the basis (spread between spot and perp) and an approximate annualized rate. This is a research/monitoring tool, not an execution engine — it does not place orders.
When to use this skill
- The user wants to check whether a spot-vs-perp basis trade (cash-and-carry) looks attractive right now for a given coin.
- The user asks "what's the basis on BTC/ETH/SOL across exchanges" or wants to compare funding rates and mark-price spreads side by side.
- The user wants a lightweight, repeatable way to watch basis drift over a
session (
watchmode).
How to run it
python3 scripts/basis_scanner.py scan BTC ETH SOL
python3 scripts/basis_scanner.py scan BTC --json
python3 scripts/basis_scanner.py scan BTC --exchanges binance,deribit
python3 scripts/basis_scanner.py watch BTC ETH --interval 30
scan runs once and prints a table (or JSON with --json). watch repeats
the scan on an interval (seconds) until interrupted with Ctrl+C.
What it covers
- Binance: spot
/api/v3/ticker/price+ futures/fapi/v1/premiumIndex(mark price + last funding rate). - Bybit: v5
/market/tickersfor bothspotandlinearcategories. - OKX:
/market/tickerfor spot and-SWAPinstruments, plus/public/funding-rate. - Deribit:
/public/get_index_price(spot index) +/public/tickerfor the-PERPETUALinstrument (BTC/ETH/SOL only — Deribit doesn't list perpetuals for every coin).
Limitations
- The "annualized basis" figure is a rough extrapolation
(
basis_pct * 3 * 365), not a real funding-payment forecast — actual funding rates float and can flip sign. - No order-book depth is used, so this does not account for slippage on entry/exit.
- Deribit only supports BTC, ETH, and SOL perpetuals; other symbols will
return an error row for that exchange and can be excluded with
--exchanges. - All endpoints are public and unauthenticated; if an exchange rate-limits
or blocks the request, that row will show an
errorfield instead of failing the whole scan.
