Skip to content

About

Trading engine prototyped in Python and written in C++.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

Overview

This trading engine implements a limit order book system, which is a core component of electronic trading platforms. It efficiently manages buy and sell orders, maintains price-time priority, and executes trades when orders match.

Key Features:

  • Double-sided order book (buy side and ask side)
  • FIFO (First In, First Out) matching algorithm
  • Fast order insertion, deletion, and modification
  • Trade execution and reporting

Components

C++ Implementation

  • Order: Represents individual buy/sell orders with price, quantity, and type.
  • Limit: Price level that contains a linked list of orders at the same price.
  • OrderBook: Main component that manages the order book structure and matching logic.
  • Trade: Represents matched trades with price, quantity, and timestamp.

Python Implementation

  • Market: Simulates market data generation with realistic price movements.
  • Ticker: Contains market data like bid/ask prices and volumes.
  • Limit: Manages orders at a specific price level.
  • Order: Individual order representation.
  • OrderBook: Manages the full order book structure with SortedDict for optimal performance.

Key Performance Optimizations:

  • C++: Custom linked lists for efficient order management.
  • Python: SortedDict for O(log n) price level access.
  • Both: O(1) order removal and O(1) matching for most cases.

Future Enhancements

Potential Future Improvements:

  • Pro-rata matching algorithm implementation.
  • Market data feed integration.
  • Persistence layer for order storage.
  • Performance benchmarking suite.
  • REST API for order submission.

About

Trading engine prototyped in Python and written in C++.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages