Project Details

Stock Exchange Simulator

A robust, high-performance REST API for simulating stock trading operations, built with Rust, Axum, PostgreSQL, and Redis.

Gallery

No gallery images available

About This Project

A robust, high-performance REST API for simulating stock trading operations, built with Rust, Axum, PostgreSQL, and Redis. This core service provides authentication, balance management, trading operations, and real-time price updates via WebSocket connections.

🚀 Features

Core Trading Features

  • 💰 Balance Management - Secure deposit and withdrawal operations with precise decimal handling
  • 📈 Stock Trading - Buy and sell operations with real-time price validation
  • 📊 Portfolio Management - Track holdings with automatic average price calculations
  • 📋 Transaction History - Complete audit trail of all trading activities

Real-time Features

  • 🔄 WebSocket Support - Real-time price updates for subscribed tickers
  • 📡 gRPC Integration - Connects to external price feed service for live market data
  • Redis Caching - High-performance price caching and session management

Security & Reliability

  • 🔐 JWT Authentication - Secure token-based authentication with configurable expiration
  • 🛡️ Password Security - Argon2 password hashing with salt
  • Input Validation - Comprehensive request validation and sanitization
  • 🚫 SQL Injection Protection - Compile-time verified queries with SQLx
  • 📝 Audit Logging - Security event logging for monitoring
  • 🔒 Error Handling - Sanitized error responses preventing information disclosure

Architecture & Performance

  • 🏗️ Clean Architecture - Modular design with clear separation of concerns
  • 🔗 Connection Pooling - Efficient database and Redis connection management
  • 📏 Request Limits - Configurable request size limits for DDoS protection
  • 🎯 Type Safety - Rust's strong type system prevents runtime errors

Tech Stack

Websockets
Websockets
Rust
Rust
Tokio
Tokio
PostgreSQL
PostgreSQL
Redis
Redis

Tags

rustredisgrpctradingaxumsqlxwebsockets