x402-crypto-derivatives-data (Python)
Crypto derivatives data API for AI agents and trading bots: perpetual futures funding rates with predicted funding, funding history and a funding arbitrage scanner, a perp screener, open interest, futures basis and term structure, options implied volatility, skew and max pain, liquidations, and order book depth with slippage, across Bybit, Hyperliquid, dYdX, Gate, Kraken, Bitfinex, Deribit and OKX. 10 routes, $0.003 or $0.005 per call, paid per request with x402 (USDC on Base). No API key, no signup.
This is the Python client for https://derivs.duoleads.com. It is also part of duo-data-utilities (as DuoClient(...).derivs); this package has the derivs client only and does not depend on it. TypeScript: x402-crypto-derivatives-data on npm.
Install
pip install x402-crypto-derivatives-data
Python 3.10 or later. eth-account (installed with it) creates the wallet account that pays.
Quick start
import os
from eth_account import Account
from x402_crypto_derivatives_data import DerivsClient
# Your wallet holds USDC on Base. Read the key from the environment, never a literal.
client = DerivsClient(Account.from_key(os.environ["PAYER_KEY"]))
funding = client.funding_rates(coin="BTC") # $0.003
for venue in funding["venues"]:
print(venue["venue"], venue["apr_pct"], venue["next_funding_time"])
arb = client.funding_arbitrage(min_apr=20, min_volume_usd=1_000_000) # $0.005, all coins
book = client.orderbook(coin="BTC", size_usd=250_000) # $0.003
Each method pays the 402 challenge with your wallet and returns the JSON answer as a dict (with venues_missing, units, as_of and a see_also pointer). DERIVS_ROUTES lists all 10 routes with price and MCP tool. client.call_with_receipt(path, params) also returns the settlement receipt.
Price guard
Before anything is signed, the client checks the payment requirement: Base USDC only, only to the service's address 0xCD673f7e1daD254347AEab6be0DEFe8b9C6b3A39, and never above the cap. By default each route is capped at its own listed price ($0.003 or $0.005); DerivsClient(account, max_price_usd=0.003) sets one cap for every route and refuses the $0.005 routes. A refused call signs nothing and raises PriceGuardError. The client never retries a paid call on its own.
Errors and charges
Bad input is a free 400 with error.expected. When fewer venues answer than the route needs, the answer is a 503 and nothing is charged. Both raise DuoApiError.
Links
- Service and docs: https://derivs.duoleads.com (OpenAPI: https://derivs.duoleads.com/openapi.json)
- Paid MCP server with the same 10 tools:
https://derivs.duoleads.com/mcp
Data only, not investment advice, not affiliated with any exchange. The client sends a User-Agent naming this package and its version; pass user_agent= to change it.
MIT licensed.
Metadata
Release files for x402-crypto-derivatives-data 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| x402_crypto_derivatives_data-0.3.0.tar.gz | 17.2 kB | Without provenance | Details for x402_crypto_derivatives_data-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| x402_crypto_derivatives_data-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for x402_crypto_derivatives_data-0.3.0-py3-none-any.whl |
Total release size: 35.7 kB
Release files / x402_crypto_derivatives_data-0.3.0.tar.gz
| Download URL | x402_crypto_derivatives_data-0.3.0.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ce80864a39f7e9581f30425a9ba97f8610093bea6e99d9b93ce7bdf1b9d7a86
|
|
BLAKE2b-256 checksum How to use checksums |
86f399f319efc9669c46777d3b64b8f586ce4eaf3f693b0935253841ed81c063
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / x402_crypto_derivatives_data-0.3.0-py3-none-any.whl
| Download URL | x402_crypto_derivatives_data-0.3.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
604cf607d1993168db343e34c89936be7108a5e1b03695b107575df4e88be33b
|
|
BLAKE2b-256 checksum How to use checksums |
a7de19ee2645c274fd17c7c9522b3b556a7fc90920b1a3d0d3c1e43433257c05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for x402-crypto-derivatives-data 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.