DeFi API service providing funding rates and crypto market data via x402 payment protocol
A production-grade API that aggregates funding rates, arbitrage opportunities, and market data from 12+ exchanges. Built with FastAPI and designed for high-frequency trading applications.
- Multi-Exchange Integration: Real-time data from 12 exchanges (Binance, Kraken, KuCoin, OKX, dYdX, Hyperliquid, and more)
- Funding Rate Arbitrage: Identify funding rate spreads across exchanges
- x402 Payment Protocol: Built-in micropayment support for API access
- Production Infrastructure: Redis caching, Prometheus metrics, OpenTelemetry tracing
- Rate Limiting: Smart rate limiting per exchange
- Alerting: Telegram notifications for arbitrage opportunities
| Exchange | Funding Rates | Spot | Perps |
|---|---|---|---|
| Binance | ✅ | ✅ | ✅ |
| Kraken | ✅ | ✅ | ✅ |
| KuCoin | ✅ | ✅ | ✅ |
| OKX | ✅ | ✅ | ✅ |
| dYdX | ✅ | - | ✅ |
| Hyperliquid | ✅ | - | ✅ |
| Gate.io | ✅ | ✅ | ✅ |
| Bitget | ✅ | ✅ | ✅ |
| MEXC | ✅ | ✅ | ✅ |
| GMX | ✅ | - | ✅ |
| Vertex | ✅ | - | ✅ |
| Drift | ✅ | - | ✅ |
# Clone the repository
git clone https://github.com/yourusername/x402.git
cd x402
# Set up environment
cp .env.example .env
# Edit .env with your API keys
# Install dependencies
pip install -r requirements.txt
# Run the API
uvicorn main:app --reloadGET /funding-rates # All funding rates across exchanges
GET /funding-rates/{symbol} # Funding rates for specific symbol
GET /arbitrage # Current arbitrage opportunities
GET /health # Health check
┌─────────────────┐ ┌──────────────────┐
│ FastAPI App │────▶│ Redis Cache │
└────────┬────────┘ └──────────────────┘
│
┌────┴────┐
│ │
┌───▼───┐ ┌───▼───┐
│Exchange│ │Exchange│ ... (12 exchanges)
│Adapters│ │Adapters│
└───────┘ └───────┘
See .env.example for all configuration options.
MIT