{"uid":"cap_WkNSNsON6VtcgV6T6Ap8y","slug":"perp-gap-funding-rate-comparison-api-a07feadb","name":"Perp Gap Funding Rate Comparison API","description":"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.","url":"https://perp-gap-api.perpgap.workers.dev/funding?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["ticker"],"properties":{"ticker":{"type":"string","pattern":"^[A-Za-z0-9.]{1,12}$","examples":["NVDA"],"description":"Stock ticker, case-insensitive (free list: GET /catalog)."},"history":{"enum":["24h","7d","30d"],"type":"string","description":"Optional history window (single ticker)."},"tickers":{"enum":["all"],"type":"string","description":"Optional alternative to ticker: 'all' for the full board."},"min_spread_apr":{"type":"string","pattern":"^[0-9.]+$","description":"Board only: minimum venue APR spread in pp."}},"additionalProperties":false}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"sign":{"type":"string"},"as_of":{"type":"string"},"ticker":{"type":"string"},"venues":{"type":"object"},"history":{"type":"object"},"summary":{"type":"object"},"us_session":{"type":"string"}},"description":"Error responses are JSON {error: string, hint?: string}. 400 bad params (never charged); 402 payment required; 404 ticker/market not listed (checked before settlement, never charged); 502 upstream error. Full field docs: /openapi.json."}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_OTIR1zunFXuLICFGc1ntm","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns normalized funding rates across trade.xyz, Aster, Lighter, and OKX for a stock perpetual, identifies the cheapest venue to be long or short, and optionally includes historical funding data.","exampleAgentPrompt":"I'm thinking of holding an NVDA stock perp long — can you check which of trade.xyz, Aster, Lighter, and OKX has the cheapest funding rate right now, and show me the 7-day history?","exampleUseCases":[{"title":"Cheapest venue for stock perp long","prompt":"I want to go long TSLA perp and hold it for a while — which venue has the lowest annualized funding rate right now so I minimize my carry costs?"},{"title":"Carry spread arbitrage screening","prompt":"Pull the full board of stock perps and show me which tickers have the widest funding spread between venues — I'm looking for carry arb opportunities where at least 5 percentage points APR separate the cheapest and most expensive venue."},{"title":"Historical funding cost analysis","prompt":"What were the funding rates on AAPL stock perp across all venues over the past 30 days? I want to see if there's a consistent pattern in which exchange is cheapest."}],"resultDescription":"A JSON object containing per-venue normalized funding rates (hourly and annualized APR), the next funding timestamp and interval, a summary identifying the cheapest venue for long and short positions, the carry spread between venues, current US session status, and optionally a history object with 24h/7d/30d funding snapshots. Errors return JSON {error, hint?}.","failureModes":["400 Bad Request — invalid ticker format, unrecognized query params, or missing required fields; never charged","402 Payment Required — x402 payment header missing or insufficient; call not processed","404 Not Found — ticker is valid format but not listed on any tracked venue; checked before settlement so never charged","502 Bad Gateway — upstream venue API unavailable or returned unexpected data"],"whenToPreferThis":"Use this endpoint when an agent needs to choose the lowest-cost venue to hold or open a stock perpetual position based on funding rates. It is the authoritative cross-venue funding comparison for trade.xyz, Aster, Lighter, and OKX, with rates normalized to hourly and annualized APR for direct comparison. Prefer it over manual venue checks or general market data APIs when funding carry cost is the decision variable.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-28T06:37:03.939Z","isFirstParty":false,"canonicalSlug":"perp-gap-funding-rate-comparison-api-a07feadb"}