Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create OrderBook class #3

Open
fnorman opened this issue Sep 27, 2023 · 1 comment
Open

Create OrderBook class #3

fnorman opened this issue Sep 27, 2023 · 1 comment

Comments

@fnorman
Copy link
Collaborator

fnorman commented Sep 27, 2023

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
Copy link
Contributor

anoushkanarayan commented Nov 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants