Skip to content

A Java application to simulate a basic fixed price matching single instrument order book.

Notifications You must be signed in to change notification settings

KyranRana/BasicOrderBook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BasicOrderBook

Java CI with Maven

Focus:

  • Singlethreaded implementation
  • Fixed price order matching
  • Buying and selling a single instrument

SingleInstrumentOrderBook

Add Order:

  1. Validation
    • Check order is not null
    • Check order does not exist
    • Check order matches instrument of order book
  2. Order matching
    • Check order with same price level on the opposite side.
      • If no, continue to step 3
      • if yes, match on earliest orders at price level until order partially / fully satisfied
        • For each order fully satisfied
          • Remove order from order book
          • Evaluate best bid and ask price
        • If order is partially satisfied, continue to step 3
  3. Store order against price level

Remove order:

  1. Validation
    • Check order exists
    • Check order matches instrument of order book
  2. Remove order
  3. Evaluate best bid and ask price

Get best price

  • if side is BUY, return highest bid price
  • if side is SELL, return lowest ask price

Get orders at level:

  • given price, return orders for price level ordered by how they arrive

About

A Java application to simulate a basic fixed price matching single instrument order book.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages