Back to Portfolio
FastAPIWebSocketRedisPythonBinance APIREST API

CryptoStream

Client: Stackera
Year: 2024
CryptoStream

Project Overview

CryptoStream is a robust, production-ready FastAPI service designed to deliver real-time cryptocurrency price data with minimal latency. The platform streams live crypto prices directly from Binance over WebSocket connections, ensuring users receive instant price updates for supported trading pairs including BTC/USDT, ETH/USDT, and BNB/USDT. The service implements intelligent caching using Redis to store the latest price data, enabling fast retrieval through REST API endpoints while reducing load on external data sources. The WebSocket implementation supports flexible subscription models, allowing clients to subscribe to specific trading pairs via query parameters or receive updates for all supported pairs. The REST API provides a simple interface to fetch the latest cached price for any supported symbol, with proper error handling for unsupported pairs. The application is containerized with Docker and deployed on Render, ensuring high availability and easy scalability. The architecture includes configurable connection limits, environment-based configuration for Redis and Binance endpoints, and comprehensive test coverage. The service is designed with horizontal scaling in mind, supporting multiple app replicas behind load balancers with shared state via Redis pub/sub for consistent broadcasting across all instances.

Key Results

  • Real-time WebSocket streaming of cryptocurrency prices
  • REST API for cached price retrieval with sub-millisecond response times
  • Redis-based caching for optimal performance and reduced API calls
  • Docker containerization for easy deployment and scaling
  • Production deployment on Render with high availability
  • Support for multiple crypto pairs with flexible subscription model
  • Comprehensive test coverage and error handling