quantsc / quantsc-hft-system

0 stars 5 forks source link

Create `OrderBook` class #3

Open fnorman opened 1 year ago

fnorman commented 1 year ago

This is the main class that will be running the LOB. It will be handling all the Orders on the various Stocks that are produced throughout the lifespan of the program. The LOB needs to be able to handle Orders of type buy/sell, and do so in the fashion of limit/market price actions. See this reference for more information about the difference between the two.

There are some custom data structures that may need to be implemented such that we have

  1. constant look up
  2. iteration in order of prices
  3. retrieving best bid and ask in constant time
  4. fast quantity updates

Refer to the following article about the topic.

Here is a sample implementation

anoushkanarayan commented 10 months ago

there are some things in Jainee's editOrder function that are not compiling on my end, not sure if that's just a me thing. otherwise here is where each implementation is in my code.

  1. findOrderInBookByOrderId looks up through a map so this should be constant look-up
  2. sortedPricePendingOrders is a queue with prices sorted small->large
  3. findHighestBuy and findLowestSell return the best limit orders in constant time
  4. edit order should do fast quantity updates with by setting volume