DeFi active
Crypto API
Production cryptocurrency pricing API aggregating data from 12 exchanges with time-series storage
PythonFastAPITimescaleDBRedisDocker
12 exchangesRate limitingTime-series data
Overview
A production API service that aggregates real-time cryptocurrency pricing data from 12 exchanges. Provides unified endpoints for price queries, historical data, and cross-exchange comparisons with intelligent caching and rate limiting.
Architecture
- Data ingestion: Async workers maintain WebSocket connections to exchange APIs, normalizing data into a common schema
- Storage: TimescaleDB (PostgreSQL extension) for efficient time-series storage with automatic partitioning and compression
- Caching: Redis layer for hot data — current prices served from cache with sub-millisecond latency
- API: FastAPI with automatic OpenAPI docs, rate limiting per API key, and response caching
Scale Considerations
- TimescaleDB’s continuous aggregates pre-compute common queries (hourly/daily OHLCV)
- Connection pooling with asyncpg for efficient database access
- Docker Compose deployment with separate services for API, workers, and monitoring