BASE MAINNET · USDC · Perpetual funding rates · $0.0075/CALL

Perpetual funding rates in 3 steps

Use the official x402 buyer SDK for Perpetual funding rates. The script below uses this API's exact POST method, selected input and current price. First validate the quote for free. Only a separate, explicit --pay flag permits ONE purchase with the buyer's own authorized wallet. No seller access to the wallet.

Inspect sample or evidence · Product details and payment options · All API contracts · Raw Node.js script

1. Install Node.js 20+ and dependencies:

npm install @x402/fetch @x402/evm viem

2. Get the buyer script and run dry:

curl -fsS "https://bounty-engineer-x402-prod.onrender.com/buyer-quickstart.mjs?tool=funding-rates" -o buyer-quickstart.mjs
node buyer-quickstart.mjs

3. Only if you independently approve the price and need the result, set BUYER_BASE_PRIVATE_KEY locally and call:

node buyer-quickstart.mjs --pay

Funding Base USDC and a small amount of gas may be necessary for the buyer wallet. Your agent must use its own spending policy. Never place secrets in URLs, chats or webpages. A free sample does not constitute a paid purchase.

Need this every day? Set up a repeatable, buyer-authorized workflow

For periodic market-data requests, the API is already automatic after each buyer-authorized call. Choose the rail that fits your measured workload; buying a plan does not cause our server to trade or make requests for you.

  1. Pay as needed: POST read a free funding-rate schema preview or inspect a free real-data sample first. The live individual-symbol x402 route lists $0.0075 per successful paid call. Your own agent decides when to repeat it and must enforce its spending budget.
  2. Monthly Funding Data: $49.90/month for 10,000 prepaid API credits, or $199.90/month for 50,000 prepaid API credits. Credits apply only to the funding-rate tools, and batch requests consume multiple credits. Compare against pay-as-you-go before subscribing; a larger package is not automatically cheaper.
  3. Scheduled product-price/stock evidence: test a public product URL free. Then choose $29.90/month Starter (10 URLs, 12-hour checks) or $99.90/month Pro (25 URLs, 6-hour checks). Unlike buyer-triggered x402 calls, this product does schedule the purchased monitoring job after confirmed payment and customer watchlist setup.

Compare funding API volume costs with the free machine quote · See Commerce Radar's labeled sample JSON

PayPal renewals occur only after the buyer authorizes a subscription; billing confirmation is verified server-side before access or monthly credits are granted. One-time Base USDC purchases are not recurring wallet debits. No automatic buying, fictitious ROI, sales guarantee, or access to private store accounts.

Source for Perpetual funding rates

import {wrapFetchWithPaymentFromConfig} from "@x402/fetch";
import {ExactEvmScheme} from "@x402/evm";
import {privateKeyToAccount} from "viem/accounts";

// NODE >=20. Run in dry-run mode by default. To authorize precisely ONE
// transaction, add --pay and a caller-owned, funded Base wallet ENV secret.
// NEVER give the merchant your key or use a seller wallet here.
const ORIGIN="https://bounty-engineer-x402-prod.onrender.com";
const ENDPOINT="https://bounty-engineer-x402-prod.onrender.com/v1/funding-rates";
const PAY_TO="0xf0c39261192686cdcce529b9919a37863de4c77c";
const BASE_CHAIN="eip155:8453";
const BASE_USDC="0x833589fcD6eDb6E08f4c7c32d4f71b54bdA02913".toLowerCase();
const MAX_MICROUSDC=7500n; // Maximum for this selected API result.
const requested={"symbol":"BTCUSDT","providers":["binance","bybit"]};
const body=JSON.stringify(requested);
const approve=process.argv.includes("--pay");
const probe=await fetch(ENDPOINT,{
  method:"POST",headers:{"content-type":"application/json"},body
});
if(probe.status!==402)throw Error("Merchant did not return 402; abort");
const challenge=probe.headers.get("PAYMENT-REQUIRED");
if(!challenge)throw Error("No official PAYMENT-REQUIRED; abort");
const message=JSON.parse(Buffer.from(challenge,"base64").toString("utf8"));
const options=Array.isArray(message.accepts)?message.accepts:[];
const matched=options.find(p=>
  p.network===BASE_CHAIN &&
  p.payTo?.toLowerCase()===PAY_TO &&
  p.asset?.toLowerCase()===BASE_USDC &&
  BigInt(String(p.amount??p.maxAmountRequired??"-1"))>0n &&
  BigInt(String(p.amount??p.maxAmountRequired??"-1"))<=MAX_MICROUSDC
);
if(!matched)throw Error("Expected merchant payee, Base USDC and selected API price cap did not match");
console.log("Verified Base USDC quote:", {
  endpoint:ENDPOINT,network:matched.network,
  price_usdc:Number(BigInt(String(matched.amount??matched.maxAmountRequired)))/1_000_000,
  payee:matched.payTo
});
if(!approve){console.log("DRY RUN. To make ONE authorized purchase, use --pay.");process.exit(0);}
const key=process.env.BUYER_BASE_PRIVATE_KEY;
if(!key || !/^0x[a-f0-9]{64}$/i.test(key))
  throw Error("Set BUYER_BASE_PRIVATE_KEY only in your own local environment");
const account=privateKeyToAccount(key);
const paymentFetch=wrapFetchWithPaymentFromConfig(fetch,{
  schemes:[{network:BASE_CHAIN,client:new ExactEvmScheme(account)}],
  paymentRequirementsSelector:(_version,accepts)=>{
    const p=accepts.find(a=>
      a.network===matched.network &&
      a.payTo?.toLowerCase()===PAY_TO &&
      a.asset?.toLowerCase()===BASE_USDC &&
      BigInt(String(a.amount??a.maxAmountRequired??"-1"))===BigInt(String(matched.amount??matched.maxAmountRequired))
    );
    if(!p)throw Error("Paid challenge changed between quote and signing");
    return p;
  }
});
const response=await paymentFetch(ENDPOINT,{
  method:"POST",headers:{"content-type":"application/json"},body
});
if(!response.ok)throw Error("Purchase not fulfilled: HTTP "+response.status);
if(!response.headers.get("PAYMENT-RESPONSE"))
  throw Error("Successful HTTP response lacks settled x402 payment receipt");
console.log("Authorized paid result:",await response.json());