Skip to main content
Glama
funding-arb-screener

funding-arb-screener

by tordagaz-ops

funding-arb-screener

Perpetual-futures funding rates from five exchanges, in one call — with the delta-neutral spread, the annualized carry and the break-even time already worked out.

Funding is the one payment in crypto that repeats every few hours and is easy to miss. A pair paying 0.01% every eight hours is not "0.01%" — it is 10.95% a year, and the same pair on a different venue may be paying 0.008%, which is a real, market-neutral spread you can hold with two opposing positions and no directional risk. Finding that spread by hand means five tabs, five symbols spellings and a calculator.

This server does it in one request. Ask for BTC/USDT and get back every venue that trades it, its current rate, the interval that rate applies to, the annualized equivalent, the mark price and 24-hour turnover — plus which venue you should sell and which you should buy, what that pair of legs is worth per year, and how many funding periods it takes just to pay the trading fees.

get_funding_rates("BTC/USDT")            → 5 venues + the best spread
scan_funding_opportunities()             → the whole market, ranked
get_funding_history("BTC/USDT","bybit")  → is this rate normal, or a squeeze?
list_venues()                            → which exchanges are answering
  • Works with no API key — every venue endpoint used here is public.

  • One tool, five venues. Exchanges are a parameter, never a different repo.

  • Fails soft. A venue that is down returns a named failure next to the data from the venues that are up. You never get an empty result because one exchange had a bad minute.

  • Documented in English, Spanish and Russian, including the tool descriptions the model reads. Set MCP_LOCALE.

Español · Русский


Why a spread, and not just a rate

A funding rate on its own tells you what the crowd is doing. The spread between two venues tells you what you can do:

  1. Sell the perpetual on the venue with the highest rate.

  2. Buy the same perpetual on the venue with the lowest rate.

  3. Both legs are the same asset, so price moves cancel. Each funding tick, you receive on the short leg and pay on the long leg; the difference is yours.

Two numbers decide whether that is worth the trouble, and this server returns both for every symbol:

Field

Meaning

spread_annualized_pct

The net carry if the current rates held for a year, in percent.

breakeven_periods

How many funding periods of edge it takes to cover the round-trip fees.

breakeven_days

The same thing in days, using the two legs' intervals.

price_gap_bps

How much higher the short leg's mark price is, in basis points. Positive is good: you sell higher and buy lower.

The break-even assumes four fee touches — two legs, opened and closed — at 4 × fee_bps. The default fee_bps=5.5 is a taker fee on either side; pass your own.


Related MCP server: funding-arb

Install

pip install mcp-funding-arb-screener

Or from this repository:

git clone https://github.com/tordagaz-ops/funding-arb-screener
cd funding-arb-screener
python -m venv .venv
.venv\Scripts\activate          # Windows
source .venv/bin/activate       # macOS / Linux
pip install -e ".[dev]"

The package needs Python 3.10+ and installs mcp and httpx. Nothing else.

Run

python -m mcp_funding_arb                 # stdio, for a desktop client
MCP_TRANSPORT=http python -m mcp_funding_arb   # http on port 8000
MCP_TRANSPORT=sse python -m mcp_funding_arb    # sse on port 8000

A client configuration looks like this:

{
  "mcpServers": {
    "funding-arb-screener": {
      "command": "python",
      "args": ["-m", "mcp_funding_arb"],
      "env": { "MCP_LOCALE": "en" }
    }
  }
}

Deploy to Render (free)

The repository ships a render.yaml Blueprint, so the server runs on a public HTTPS URL with no API key, no card and no Docker step.

  1. Open the Render dashboard and press New -> Blueprint (https://dashboard.render.com/blueprints).

  2. Connect GitHub and give Render access to this repository.

  3. Select the repository and press Apply. Render reads render.yaml: build pip install ., start python -m mcp_funding_arb, health check /health.

  4. When the first build finishes (2-4 minutes), open the URL Render shows: https://funding-arb-screener.onrender.com.

That page is the human view of the server: it lists every tool. The MCP endpoint is https://funding-arb-screener.onrender.com/mcp (Streamable HTTP), so a client entry looks like:

{"mcpServers": {"funding-arb-screener": {"url": "https://funding-arb-screener.onrender.com/mcp"}}}

curl https://funding-arb-screener.onrender.com/health answers with the tool count, which is the quickest way to prove the deployment is alive.

Free-plan notes: the instance sleeps after 15 minutes without traffic, so the next request takes about 50 seconds; 512 MB is enough for this server. If you rename the service or attach a domain, also update MCP_PUBLIC_HOST in render.yaml, or the Host check answers 421.

The four tools

get_funding_rates

One symbol, every venue that lists it.

Parameter

Type

Default

Notes

symbol

string

—

BTC/USDT, BTCUSDT, btc-usdt all work.

venues

list or string

all five

["bybit","okx"] or "bybit, okx".

fee_bps

number

5.5

Per-leg taker fee used for break-even.

{
  "symbol": "BTC/USDT",
  "venue_count": 5,
  "spread": { "short_venue": "okx", "long_venue": "gate", "spread_annualized_pct": 4.37,
              "breakeven_days": 18.4, "price_gap_bps": 0.67 },
  "venues": [
    { "venue": "okx", "funding_rate": 8.74e-05, "funding_interval_hours": 8.0,
      "annualized_pct": 9.57, "mark_price": 60816.9, "turnover_24h": 9.32e9 }
  ],
  "failed_venues": {}
}

Measured on a September evening, five venues answered BTC/USDT in 1.4 seconds — Bybit 7.42%/yr, Binance 8.73%, OKX 9.57%, Bitget 5.80%, Gate 5.20%, for a 4.37% spread with a 0.67 bps price gap and an 18-day break-even.

scan_funding_opportunities

The whole market, or a shortlist you name.

Parameter

Type

Default

Notes

symbols

list or string

—

Narrow the scan to these pairs.

venues

list or string

all five

Limit the fleet.

min_annualized_pct

number

5.0

Drop rows below this carry.

min_turnover_24h

number

1000000

Drop illiquid pairs.

limit

integer

10

Rows returned, 1–50.

shortlist

integer

40

Symbols kept after ranking by turnover, 2–200.

sort

string

annualized

annualized, spread or turnover.

Measured: 1,233 symbols in 2.5 seconds. The scan ranks every venue's whole book by 24-hour turnover, keeps the top shortlist, then fetches funding for just those symbols on just the venues that list them — two phases, no symbol fan-out into the void.

get_funding_history

Was that rate real, or one crowded hour?

Parameter

Type

Default

Notes

symbol

string

—

venue

string

bybit

One venue: history is per exchange.

points

integer

20

1–200 settlements.

Returns the samples plus mean_rate, median_rate, stdev_rate, positive_share, annualized_mean_pct and cumulative_pct — what you would have paid or received over the window, and how reliable the sign is. Measured on a 30-point Bybit window: mean 2.28e-05 per 8 h (2.50%/yr), positive 73.3% of the time.

list_venues

Which exchanges are answering right now. probe=false returns the configured list without touching the network — useful as a health check for your own monitoring. probe=true (default) asks each venue for BTC/USDT and reports latency and error code per venue.


Failure model

Every tool returns a dict. Nothing raises at the caller, and a partial answer is preferred to no answer:

{
  "error": "no_data",
  "message": "No exchange returned a quote for FOO/USDT.",
  "failed_venues": { "bybit": "unknown_symbol", "okx": "timeout" }
}

Code

Meaning

empty_symbol

The symbol arrived blank.

invalid_symbol

Not a recognisable pair.

unknown_symbol

A valid pair, but no venue lists it.

unknown_venue

You asked for an exchange this server does not carry.

too_few_venues

Fewer than two venues: there is no spread to compute.

invalid_limit, invalid_number, invalid_sort

Bad argument, named.

timeout, network_error

A venue did not answer in 3.5 s.

upstream_rejected, bad_payload

The venue answered with an error or nonsense.

Timeouts are per venue and per attempt: 3.5 s, two attempts, with a 1–5 s ticker cache in front. A call therefore has a ceiling of about 6 s even when everything is on fire, and partial results come back inside it.

Exchanges

Venue

Symbol form

Funding endpoint

Interval source

Bybit

BTCUSDT

/v5/market/funding/history

instruments-info.fundingInterval (minutes)

Binance

BTCUSDT

/fapi/v1/fundingRate

8 h, or fundingInfo when published

OKX

BTC-USDT-SWAP

/api/v5/public/funding-rate-history

derived from two settlement stamps

Bitget

BTCUSDT

/api/v2/mix/market/history-fund-rate

8 h default

Gate.io

BTC_USDT

/api/v4/futures/usdt/funding_rate

8 h

Every adapter speaks the venue's own dialect: Bybit reports errors inside an HTTP 200 body, numbers arrive as strings almost everywhere, Binance returns a bare object instead of a one-element list, and Gate's market-wide ticker endpoint never answers at all — which is why Gate is queried contract by contract, four at a time, and why a whole-market scan gives it a short list rather than the universe.

About that 7,788% row

Some venues fund hourly and others every eight hours. Annualizing each leg on its own clock is the correct way to compare who pays what per year, but it means a 1-hour squeeze on one venue against an 8-hour rate on another can produce a five-digit annualized figure that no one will ever collect. Read the row, not the rank: short_interval_hours and long_interval_hours are always returned, breakeven_days tells you how fast the edge turns into money, and min_turnover_24h keeps the thin pairs out. Funding rates are also the most volatile number in a perpetual; the annualized figure is a snapshot, not a promise.

Localization

MCP_LOCALE selects the language of tool titles, descriptions, parameter documentation and every error message:

MCP_LOCALE=es python -m mcp_funding_arb
MCP_LOCALE=ru python -m mcp_funding_arb

en is the default and is also what an unknown value falls back to. Symbol names, venue names and numeric fields are never translated, so a client can switch language mid-conversation without touching its parsing.

Tests

pytest                  # everything: 184 tests
pytest -m "not live"    # offline only: unit + protocol, no network
pytest -m live          # only the tests that talk to real exchanges

The suite has five layers, each with a job:

  • Unit — funding arithmetic, each venue's wire format, the scan's two-phase plumbing, all through httpx.MockTransport. No network, no sleep.

  • Tool level — the four tools driven through a real MCP client session, so the schema, the annotations and the JSON on the wire are checked, not just the Python.

  • End to end — the server started as a subprocess and spoken to in raw JSON-RPC over stdio, the way a real client does it.

  • Live — the five exchanges, marked so a laptop without a connection can skip them instead of failing.

  • Hosting — tests/test_hosting.py takes the port a platform assigns, /health, the landing page, and MCP over HTTP.

Free, and donations welcome

This server is free: every tool can be called without payment, registration or an API key. If it saves you time or money, you can send a donation -- it goes straight to the developer, with no platform in between.

Network

Asset

Address

Base

USDC / ETH

0x832e9e0FC60c35A07cf80846A9eD27aa7cb4F637

Ethereum

ETH

0x832e9e0FC60c35A07cf80846A9eD27aa7cb4F637

Nothing in the code is gated on donations: no telemetry, no licence check, no expiring demo. The whole source is MIT-licensed.

Licence

MIT. See LICENSE.

Available Tools

4 tools
get_funding_historySummarise a pair's funding historyA
Read-only

Return the funding-rate history of one pair on one exchange with summary statistics: mean, median, standard deviation, share of positive periods, best and worst period, cumulative funding over the window and the annualized mean. Use it to check whether a funding edge is persistent or a single print before trusting a scan result. Example: symbol='ETH/USDT', venue='binance', points=50.

Inputs: symbol (required), venue, points. Returns: object

get_funding_ratesCompare funding rates across exchangesA
Read-only

Return the current perpetual funding rate for one pair on five exchanges at once, plus the arbitrage view: which venue to short and which to long, the spread per funding period, the annualized spread assuming the current rates persist, the mark-price gap between the legs and how many funding periods it takes just to repay round-trip taker fees. Also reports funding interval, next funding time, mark and index price and 24h turnover per venue. Examples: symbol='BTC/USDT'; symbol='ETHUSDT', fee_bps=4.

Inputs: symbol (required), venues, fee_bps. Returns: object

list_venuesList exchanges and check their healthA
Read-only

List the exchanges this server reads and, with probe=true, run a live health check that reports latency, the number of contracts seen and whether the venue supports a whole-market scan. Call it before a scan to know which venues to expect an answer from. Example: probe=true.

Inputs: probe. Returns: object

scan_funding_opportunitiesRank pairs by funding-rate spreadA
Read-only

Scan the perpetual market across five exchanges and rank pairs by the funding-rate difference between venues — the classic delta-neutral funding arbitrage signal. One call replaces thousands of REST requests: the server pulls whole-market snapshots in one request per exchange, shortlists the most liquid pairs, then fills in the exchanges that publish rates per instrument. Filter by annualized edge and 24h turnover to drop illiquid contracts whose rates are noise. Example: min_annualized_pct=20, min_turnover_24h=5000000, limit=15.

Inputs: sort, limit, venues, symbols, +3 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool occupies a distinct axis: get_funding_rates is a single-pair, cross-venue snapshot with the arb view, scan_funding_opportunities is a market-wide ranked screen, get_funding_history is a per-pair/per-venue time series, and list_venues is venue metadata plus health check. Descriptions explicitly contrast them (e.g. history is framed as the persistence check on a scan result), leaving no plausible misselection.

    Naming Consistency5/5

    All four names are snake_case verb_noun: get_funding_rates, scan_funding_opportunities, get_funding_history, list_venues. The verbs (get/scan/list) map predictably to the action, and nouns match the domain objects.

    Tool Count5/5

    Four tools is well-scoped for a focused screener: one per workflow step (discover venues, scan market, inspect a pair, verify persistence), with no redundant wrappers. Nothing feels padded or missing at the tool-count level.

    Completeness4/5

    The surface covers the full screener workflow from venue discovery through scan, single-pair drill-down, and historical validation, with fee_bps exposed for customization. Minor gaps: no direct way to retrieve per-venue fee schedules or contract specs (fees must be supplied manually), and no batch multi-pair history call, but agents can work around both.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Real-time crypto spread, funding rates, and cash & carry yields across Binance and OKX for AI assistants.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Scans funding rate arbitrage opportunities across perpetual exchanges (Hyperliquid, Binance, Bybit, OKX) and returns cross-venue spreads and annualized yields. Uses x402 micropayments for pay-per-call access.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Live perpetual funding rates across Binance, Bybit, OKX with open interest and predicted next rate, pay-per-call via x402 micropayments (USDC on Base).
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides read-only crypto perpetual futures market data from Arbitron's tracked venues, including current funding rates, funding history, venue spreads, backtested spreads, and listings calendar, through MCP tools for AI assistants.
      2
      MIT