Skip to content

FIFO Limit Order Book Engine based on WK Selph's Limit Order Book for high-frequency trading (HFT)

Notifications You must be signed in to change notification settings

yeoshuheng/silly-little-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Silly Little Limit Order Book Engine

Introduction

A limit order is an order that only executes if a given price condition is met. Unlike a market order, the limit order guarantees the execution price but does not guarantee the execution.

Before meeting the price condition, it is left unexecuted and has to sit on the order book. A limit order book is a trading system used to manage these limit orders as well as match the lowest ask with the highest bid on a price-time priority basis.

This is a very basic mock limit order book with the bare functionalities needed and without much optimisations.

Structure

The creation of this engine was loosely based on Limit Order Book for high-frequency trading (HFT) by WK Selph.

The engine is designed such that limit prices are kept within binary heaps instead whilst the orders are kept within doubly-linked-lists on a price-level basis.

This results in the following complexities for these key operations:

  • Adding Bid/Ask: O(1)
  • Cancel: O(1)
  • Getting Best Bid/Ask: O(1)
  • Getting Volume: O(1)
  • Batch Order Matching & Execution: O(nlog(n))

About

FIFO Limit Order Book Engine based on WK Selph's Limit Order Book for high-frequency trading (HFT)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages