Skip to content

rekon307/x402

Repository files navigation

x402 - DeFi Data API

Python 3.11+ FastAPI License: MIT

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.

Features

  • 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

Supported Exchanges

Exchange Funding Rates Spot Perps
Binance
Kraken
KuCoin
OKX
dYdX -
Hyperliquid -
Gate.io
Bitget
MEXC
GMX -
Vertex -
Drift -

Quick Start

# 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 --reload

API Endpoints

GET /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

Architecture

┌─────────────────┐     ┌──────────────────┐
│  FastAPI App    │────▶│  Redis Cache     │
└────────┬────────┘     └──────────────────┘
         │
    ┌────┴────┐
    │         │
┌───▼───┐ ┌───▼───┐
│Exchange│ │Exchange│  ... (12 exchanges)
│Adapters│ │Adapters│
└───────┘ └───────┘

Environment Variables

See .env.example for all configuration options.

License

MIT

About

DeFi API service providing funding rates and crypto market data via x402 payment protocol. 12 exchange integrations with arbitrage analysis.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors