Funding
by Perp Gap API in Markets & finance
Use when an agent must pick the cheapest venue to hold a stock perp or size funding carry. Funding on trade.xyz, Aster, Lighter and OKX normalized to hourly and annualized APR, interval and next funding time, cheapest venue to be long or short, carry spread, optional 24h/7d/30d history; one ticker or tickers=all. Bad params return 400/404 before any charge. Errors: 400, 402, 404, 502. Data, not advice.
https://perp-gap-api.perpgap.workers.dev/funding- Price
- $0.02
- per call in USDC
- Uptime
- 91.3%
- last 30 days
- Response time
- 246 ms
- 502 ms slowest 5%
- Last check
- Failed
- 16 h ago, next in 9 h
Reliability
Latest check failed 16 h ago: Timed out
Status and outage history · Atom feed · Watch with other listings
How to call it
GET https://perp-gap-api.perpgap.workers.dev/funding
Each call costs $0.02 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.
GET https://perp-gap-api.perpgap.workers.dev/funding?history=7d&ticker=NVDAParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
history | string | No | Optional history window (single ticker). One of: 24h, 7d, 30d. |
min_spread_apr | string | No | Board only: minimum venue APR spread in pp. |
ticker | string | Yes | Stock ticker, case-insensitive (free list: GET /catalog). |
tickers | string | No | Optional alternative to ticker: 'all' for the full board. One of: all. |
Example response
The provider's example. We can't check it without paying.
Example response, 84 lines
{
"as_of": "2026-10-22T21:41:01.561Z",
"history": {
"hourly_apr_pct": {
"aster": [
[
"2026-10-16T00:00Z"
]
],
"hyperliquid-xyz": [
[
"2026-10-15T22:00Z"
]
],
"lighter": [
[
"2026-10-15T22:00Z"
]
],
"okx": [
[
"2026-10-16T00:00Z"
]
]
},
"mean_apr_pct": {
"aster": 3.43,
"hyperliquid-xyz": 5.25,
"lighter": 5.41,
"okx": 4.03
},
"note": "Aster and OKX settle every interval_h hours (8h for most stock perps); their points are per settlement, annualized.",
"points": {
"aster": 21,
"hyperliquid-xyz": 168,
"lighter": 168,
"okx": 21
},
"window": "7d"
},
"sign": "positive = longs pay shorts; apr_pct = hourly rate x 8760 x 100",
"summary": {
"carry_trade": "long aster / short hyperliquid-xyz collects ~5.48% APR in funding at current rates (before fees, basis and weekend risk)",
"cheapest_long": "aster",
"cheapest_short": "hyperliquid-xyz",
"max_spread_apr_pct": 5.48
},
"ticker": "NVDA",
"us_session": "after-hours",
"venues": {
"aster": {
"apr_pct": 0,
"hourly": 0,
"interval_h": 8,
"next_funding": "2026-10-23T00:00:00.000Z",
"rate": 0,
"symbol": "NVDAUSDT"
},
"hyperliquid-xyz": {
"apr_pct": 5.48,
"hourly": 0.00000625,
"interval_h": 1,
"next_funding": "2026-10-22T22:00:00.000Z",
"rate": 0.00000625,
"symbol": "xyz:NVDA"
},
"lighter": {
"apr_pct": 3.5,
"hourly": 0.000004,
"interval_h": 1,
"market_id": 110,
"rate": 0.000004,
"symbol": "NVDA"
},
"okx": {
"apr_pct": 0,
"hourly": 0,
"interval_h": 8,
"next_funding": "2026-10-23T00:00:00.000Z",
"rate": 0,
"symbol": "NVDA-USDT-SWAP"
}
}
}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.02.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i 'https://perp-gap-api.perpgap.workers.dev/funding?history=7d&ticker=NVDA'
# 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 - 'https://perp-gap-api.perpgap.workers.dev/funding?history=7d&ticker=NVDA' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: 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.02 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.02" });
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.02 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fperp-gap-api.perpgap.workers.dev%2Ffunding
const res = await pay("https://perp-gap-api.perpgap.workers.dev/funding?history=7d&ticker=NVDA");
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.02 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.02"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.get("https://perp-gap-api.perpgap.workers.dev/funding?history=7d&ticker=NVDA")
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
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 16 h ago | Timed out | - | - | - |
| 4 days ago | Expected HTTP 402, got 404 | 404 | 95 ms | - |
| 5 days ago | Expected HTTP 402, got 404 | 404 | 140 ms | - |
| 6 days ago | Expected HTTP 402, got 404 | 404 | 108 ms | - |
| 8 days ago | Expected HTTP 402, got 404 | 404 | 84 ms | - |
Show 10 older checks
| 8 days ago | Expected HTTP 402, got 404 | 404 | 128 ms | - |
| 8 days ago | Expected HTTP 402, got 404 | 404 | 99 ms | - |
| 9 days ago | Expected HTTP 402, got 404 | 404 | 91 ms | - |
| 9 days ago | Passed | 402 | 222 ms | $0.02 |
| 9 days ago | Passed | 402 | 543 ms | $0.02 |
| 9 days ago | Passed | 402 | 130 ms | $0.02 |
| 10 days ago | Passed | 402 | 267 ms | $0.02 |
| 10 days ago | Passed | 402 | 291 ms | $0.02 |
| 10 days ago | Passed | 402 | 296 ms | $0.02 |
| 10 days ago | Passed | 402 | 355 ms | $0.02 |