Skip to content

RonithManikonda/market-data-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Market Data Dissemination Simulator

Go Version gRPC License: MIT Build Status

A high-performance gRPC-based market data simulator built in Go, designed to demonstrate distributed systems architecture and real-time data streaming capabilities for quantitative finance applications.

๐ŸŽฏ Project Overview

This project implements a realistic market data dissemination system that showcases:

  • ๐Ÿš€ gRPC bidirectional streaming for real-time market data distribution
  • ๐Ÿ“Š Efficient order book data structures with price-time priority
  • โšก Protocol Buffer serialization for high-performance communication
  • ๐Ÿ—๏ธ Microservices architecture patterns used in financial technology

Perfect for: Software engineering portfolios, quantitative developer positions, and fintech interviews.

๐Ÿ›๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    gRPC Stream    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚     Clients     โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚     Server      โ”‚
โ”‚                 โ”‚                   โ”‚                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ€ข Subscribe     โ”‚                   โ”‚ โ€ข OrderBook     โ”‚
โ”‚ โ€ข Display       โ”‚                   โ”‚ โ€ข Market        โ”‚
โ”‚ โ€ข Reconnect     โ”‚                   โ”‚   Generator     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Features

๐Ÿš€ Phase 1 (Completed)

  • Project Foundation: Professional Go project structure
  • Protocol Buffers: Complete gRPC service definitions
  • Order Book Engine: Efficient data structures with maps and linked lists
  • Configuration System: YAML-based instrument configuration
  • Testing Framework: Comprehensive unit tests

โœ… Phase 2 (Completed)

  • gRPC Server: Bidirectional streaming implementation with client management
  • Market Data Generator: Realistic market event simulation (60% ADD, 25% MODIFY, 15% DELETE)
  • Client Application: Interactive console client with real-time order book display
  • Error Handling: Connection management, reconnection logic, and graceful shutdown
  • Real-time Updates: Incremental order book updates with sequence numbers
  • Multi-instrument Support: Subscribe/unsubscribe to multiple instruments
  • Structured Logging: Comprehensive logging with different levels

๐Ÿ”„ Phase 3 (Next)

  • Web Dashboard: Real-time order book visualization
  • Historical Replay: Market data backtesting capabilities
  • Multi-Asset Support: Equities, futures, and options
  • Performance Metrics: Latency monitoring and optimization

๐Ÿ› ๏ธ Technology Stack

Component Technology
Language Go 1.20+
Communication gRPC with Protocol Buffers
Configuration YAML with validation
Testing Go standard testing framework
Architecture Clean architecture with dependency injection

๐Ÿ“ Project Structure

market-data-simulator/
โ”œโ”€โ”€ cmd/                    # Application entry points
โ”‚   โ”œโ”€โ”€ server/            # gRPC server main
โ”‚   โ””โ”€โ”€ client/            # Client application main
โ”œโ”€โ”€ internal/              # Private application code
โ”‚   โ”œโ”€โ”€ orderbook/         # Order book data structures
โ”‚   โ”œโ”€โ”€ config/            # Configuration management
โ”‚   โ”œโ”€โ”€ simulator/         # Market data generation
โ”‚   โ”œโ”€โ”€ server/            # gRPC server implementation
โ”‚   โ”œโ”€โ”€ client/            # Market data client
โ”‚   โ””โ”€โ”€ logger/            # Structured logging
โ”œโ”€โ”€ proto/                 # Protocol Buffer definitions
โ”œโ”€โ”€ configs/               # Configuration files
โ”œโ”€โ”€ pkg/                   # Public library code
โ””โ”€โ”€ test/                  # Test files

๐Ÿš€ Quick Start

Prerequisites

  • Go 1.20 or later
  • Protocol Buffers compiler (protoc)
  • gRPC Go plugins

Installation

# Clone the repository
git clone https://github.com/RonithManikonda/market-data-simulator.git
cd market-data-simulator

# Install dependencies
go mod tidy

# Generate Protocol Buffer code
./scripts/generate_proto.sh

# Run tests
go test ./test/... -v

# Start server
go run cmd/server/main.go

# Start client (in another terminal)
go run cmd/client/main.go --server=localhost:8080 --instruments=AAPL,MSFT

โšก Performance Targets

Metric Target Description
Latency Sub-millisecond Market data distribution
Throughput 10,000+ updates/sec Per instrument capacity
Concurrency 1,000+ connections Simultaneous client support
Memory O(log n) operations Efficient order book

โš™๏ธ Configuration

The system supports flexible configuration via YAML files. Example configuration:

server:
  port: "8080"
  event_rate: 500  # events per second per instrument
  max_clients: 1000

instruments:
  - id: "AAPL"
    symbol: "AAPL"
    order_book_depth: 10
    tick_size: 0.01
    min_quantity: 100
    initial_price: 150.00
  - id: "MSFT"
    symbol: "MSFT"
    order_book_depth: 10
    tick_size: 0.01
    min_quantity: 100
    initial_price: 300.00

๐Ÿงช Testing

Run the complete test suite:

# Run all tests
go test ./test/... -v

# Run tests with coverage
go test ./test/... -cover

# Run benchmarks
go test ./test/... -bench=.

๐Ÿค Contributing

This is a portfolio project, but suggestions and feedback are welcome! Please open an issue to discuss proposed changes.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ’ผ Career Context

This project demonstrates skills essential for:

  • ๐Ÿ“ˆ Quantitative Developer positions
  • ๐Ÿฆ Financial Technology engineering roles
  • โšก High-Frequency Trading system development
  • ๐Ÿ”„ Real-time Systems architecture

๐Ÿ—บ๏ธ Development Roadmap

๐ŸŽฎ Usage

Starting the Server

go run cmd/server/main.go

The server will:

  • Load configuration from configs/instruments.yaml
  • Initialize order books for all instruments
  • Start generating realistic market events
  • Listen for client connections on port 8080

Running the Client

# Basic client
go run cmd/client/main.go --server=localhost:8080

# Client with initial subscriptions
go run cmd/client/main.go --server=localhost:8080 --instruments=AAPL,MSFT

Interactive Client Commands

  • subscribe AAPL - Subscribe to AAPL market data
  • show AAPL - Display current order book
  • unsubscribe AAPL - Unsubscribe from AAPL
  • list - Show active subscriptions
  • help - Show all available commands
  • quit - Exit the client

๐Ÿ—บ๏ธ Development Roadmap

๐ŸŒŸ Phase 3: Advanced Features (Next)

  • Web-based real-time dashboard with order book visualization
  • Historical market data replay capabilities
  • Support for multiple asset classes (equities, futures, options)
  • Performance monitoring and latency optimization

๐Ÿš€ Phase 4: Production Features (Future)

  • Docker containerization and orchestration
  • Horizontal scaling with load balancing
  • Database persistence for historical data
  • Integration with real market data feeds

A demonstration of distributed systems architecture for financial markets

Repository โ€ข Issues โ€ข Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published