Skip to main content

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.

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x402-crypto-derivatives-data 0.3.1
File Size Uploaded Provenance Actions
x402_crypto_derivatives_data-0.3.1.tar.gz 17.3 kB Without provenance Details for x402_crypto_derivatives_data-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for x402-crypto-derivatives-data 0.3.1
File Interpreter ABI Platform Actions
x402_crypto_derivatives_data-0.3.1-py3-none-any.whl Python 3 none any Details for x402_crypto_derivatives_data-0.3.1-py3-none-any.whl

Total release size: 35.9 kB

Release files / x402_crypto_derivatives_data-0.3.1.tar.gz

Download URL x402_crypto_derivatives_data-0.3.1.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e3cb17c67d47b81856762762f2aa2514b62bf434c0996f3e0014ed5ba197cb1d
BLAKE2b-256 checksum
How to use checksums
4680d2c83d29694d0805b25bf574e7378aa9c29152145bfbe8f48fab64a9e024
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.1-py3-none-any.whl

Download URL x402_crypto_derivatives_data-0.3.1-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3be784b77c9787b7f69fb1e99cc3c40ac690f3c57197c309e7ebe9e879acb6c3
BLAKE2b-256 checksum
How to use checksums
6999927bbe83023814689c1d4a68ae05578450dc1f737ffd8bee60ad03d32157
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.1

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.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page