77trust / 100

Defi Funding Carry

by Tanod chainpeek in Onchain & crypto

x402 APIPassing, checked 2 h ago

Funding rate arbitrage: cross-venue perpetual funding carry ranking across Binance, Bybit, OKX, Hyperliquid and dYdX (chainpeek, Tanod). Use when an agent needs the best cross-venue perp funding arbitrage pairs across Binance, Bybit, OKX, Hyperliquid and dYdX.

POST https://tanod.dev/v1/defi/funding-carry

Last 30 days

All checks passedSome failedAll failedNot checked

Status and outage history · Atom feed

Uptime
100%
Response time
455 ms typical, 1.0 s slowest 5%
Last check
2 h ago
Next check
any minute now

How to call it

POST https://tanod.dev/v1/defi/funding-carry

Each call costs $0.005 in USDC on Base, paid with the request over x402.

Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.

Example request

From the listing.

POST https://tanod.dev/v1/defi/funding-carry
content-type: application/json

{
  "symbols": [
    "BTC",
    "ETH",
    "SOL"
  ],
  "taker_fee_bps": 5
}

Parameters

ParameterTypeRequiredDescription
holding_daysnumberNoDays the position is held; the fees are amortised over it (default 7). Default: 7.
limitintegerNoRows returned, 1-100 (default 20). Default: 20.
min_volume_usdnumberNoA venue is only used for a symbol when its 24 h volume there reaches this (USD), so it applies to both legs. Default 0. Default: 0.
symbolsarray of string or nullNoOptional: only these base assets (case-insensitive, at most 50), such as BTC. Names listed on fewer than two of the chosen venues are returned in symbols_not_found. Default: null.
taker_fee_bpsnumberNoTaker fee per side in basis points (default 0). Net APR subtracts 4 taker legs (open and close on both venues): 4 x bps / 100 x 365 / holding_days. Default: 0.
venuesarray of string or nullNoOptional subset of hyperliquid, dydx, binance, bybit, okx (at least two). Default: all five. Default: null.

Example response

The provider's example. We can't check it without paying.

Example response, 70 lines
{
  "annualization": "rate / interval_h x 8760 x 100, simple (not compounded)",
  "cache": "fetched",
  "count": 1,
  "fee_cost_annualized_pct": 10.429,
  "holding_days": 7,
  "markets": [
    {
      "annualized_pct_by_venue": {
        "bybit": -4.583,
        "okx": 1.445
      },
      "long": {
        "funding_annualized_pct": -4.583,
        "funding_hourly": -0.0000052313,
        "funding_rate": -0.00004185,
        "index_price": 82803.47,
        "interval_h": 8,
        "mark_price": 82760.8,
        "open_interest_usd": 4667526797.96,
        "venue": "bybit",
        "volume_24h_usd": 2832332361.74
      },
      "long_venue": "bybit",
      "net_annualized_pct": -4.401,
      "short": {
        "funding_annualized_pct": 1.445,
        "funding_hourly": 0.0000016501,
        "funding_rate": 0.0000132006,
        "index_price": 82808.4,
        "interval_h": 8,
        "mark_price": 82763.1,
        "open_interest_usd": 2496421859.48,
        "venue": "okx",
        "volume_24h_usd": 3857128901.15
      },
      "short_venue": "okx",
      "spread_annualized_pct": 6.028,
      "symbol": "BTC",
      "venues_compared": 2
    }
  ],
  "markets_ranked": 1,
  "net_formula": "net = spread - 4 x taker_fee_bps / 100 x 365 / holding_days",
  "note": "Data only, not trading advice. Funding rates change and may differ from the rate finally settled.",
  "pair": "long the venue with the lowest hourly funding, short the venue with the highest; shorts receive positive funding",
  "rate_basis": {
    "bybit": "current-period rate",
    "okx": "current-period rate"
  },
  "sorted_by": "spread_annualized_pct desc",
  "source": {
    "bybit": {
      "docs": "https://bybit-exchange.github.io/docs/v5/market/tickers",
      "name": "Bybit v5 linear",
      "url": "https://api.bybit.com/v5/market/tickers?category=linear"
    },
    "okx": {
      "docs": "https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate",
      "name": "OKX v5 swaps",
      "url": "https://www.okx.com/api/v5/public/funding-rate?instId=ANY"
    }
  },
  "taker_fee_bps": 5,
  "venues_failed": [],
  "venues_used": [
    "bybit",
    "okx"
  ]
}

Call it from code

The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.005.

curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://tanod.dev/v1/defi/funding-carry' \
  -H 'content-type: application/json' \
  --data-raw '{"symbols":["BTC","ETH","SOL"],"taker_fee_bps":5}'

# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://tanod.dev/v1/defi/funding-carry' \
  -H 'content-type: application/json' \
  --data-raw '{"symbols":["BTC","ETH","SOL"],"taker_fee_bps":5}' \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
JavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

// Pays at most $0.005 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.005" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.005 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Ftanod.dev%2Fv1%2Fdefi%2Ffunding-carry&method=POST
const res = await pay("https://tanod.dev/v1/defi/funding-carry", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "symbols": [
      "BTC",
      "ETH",
      "SOL"
    ],
    "taker_fee_bps": 5
  }),
});
console.log(res.status, await res.text());
Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

# Pays at most $0.005 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.005"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))

with x402_requests(client) as session:
    res = session.post(
        "https://tanod.dev/v1/defi/funding-carry",
        json={
            "symbols": [
                "BTC",
                "ETH",
                "SOL",
            ],
            "taker_fee_bps": 5,
        },
    )
    print(res.status_code, res.text)

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402941 ms$0.005
5 h agoPassed4021.1 s$0.005
9 h agoPassed4021.0 s$0.005
13 h agoPassed402417 ms$0.005
17 h agoPassed4021.0 s$0.005
21 h agoPassed4021.0 s$0.005
25 h agoPassed402380 ms$0.005
28 h agoPassed402355 ms$0.005
32 h agoPassed402268 ms$0.005
35 h agoPassed402999 ms$0.005
39 h agoPassed402351 ms$0.005
42 h agoPassed402320 ms$0.005
46 h agoPassed402455 ms$0.005
2 days agoPassed402394 ms$0.005
3 days agoPassed4021.0 s$0.005