59
votes
What is an efficient data structure to model order book?
The specifics depend on if you're implementing for equities (order-based) or futures (level-based). I recommend https://web.archive.org/web/20110219163448/http://howtohft.wordpress.com/2011/02/15/how-...
26
votes
Accepted
Red Black Trees for Limit Order Book
Why do people suggest using red black trees/balanced binary trees for the levels in a limit order book?
Because people are unoriginal and keep referencing the same blog post.
Why are they ...
13
votes
How do I convert order book data into OHCL( Open,High,Low,close) format?
As Alex C. notes, OHLC bars are meant to be calculated using transaction ticks. However, you could try to make bars from bid/ask individually (or perhaps even the mean of the two as an approximation), ...
12
votes
What is an efficient data structure to model order book?
I recently stumbled upon this question after needing to do this to do some real-time microstructure analysis and have taken a look at the various possible implementations. Here are some of the pros/...
11
votes
Accepted
Backtesting using microstructure (orderbook) data
Since order book granularity backtesting is challenging, as you've pointed out, I recommend first deciding your business requirements:
Can you rely on a third party execution desk? I do not recommend ...
10
votes
Accepted
Efficient way to store orderbook in Python
The best solution is to change how you're doing it completely:
Store the data before it even gets to your program and process it later. e.g. Use your program merely as a daemon to subscribe to the ...
9
votes
Accepted
Modelling queue position
No, you have to build your model empirically with data.
Suppose $p(x)$ denotes the probability of cancel in front of you when your order is positioned $0 \leq x \leq 1$ through the queue, there are a ...
8
votes
Accepted
Order Book Dynamics
The Queue Reactive Model (by Huang, L and Rosenbaum) is an improvement of what Cont and de Larrard (CL) did.
This model is capturing
the inflows and outflows in each queue given the current state of ...
8
votes
What is an efficient data structure to model order book?
Curious how nobody in 9 years has provided an optimal answer yet?
You need a B-Tree that has been extended with a double-linked list on each node.
The B-Tree to find (or not find if they're missing) ...
8
votes
Accepted
How does one calibrate lambda in a Avellaneda-Stoikov market making problem?
(First of all, sorry to have taken so much time to see this question...)
For the paper you refer to (Guéant-L-Tapia), there is a report (in French) by Sophie Laruelle about how to do it in practice:
...
8
votes
Accepted
How can one effectively approximate the fill portion of a limit order in a FIFO order book given it's recent state?
In my opinion, instead of developing an analytical model, it's better to evaluate this probability directly from the data. Place your simulated orders at different price levels, and check whether and ...
7
votes
Accepted
Limit order book - does it get wiped over night?
Orders stay in order book for as long as you specify, e.g. "good till cancelled" (GTC) will be sitting there until it's executed or you cancel it.
There are many types, just google them - IOC, FOK, ...
7
votes
Accepted
What are the proper ways to do order book downsampling?
Two chief reasons for subsampling or using a different event space are (i) computational or spatial tractability and (ii) denoising/signal extraction.
Sergei's response seems to focus on the first ...
6
votes
Accepted
What does a electronic dealer track in a RFQ market?
Customers dont place limit orders or do they?
No, they don't. In an electronic RFQ market, the requesting participant (presumably the "customer" you are referring to) is generally not ...
6
votes
Limit Order Book disaster recovery technique
For data on a given single host, a common architecture is to write the data onto a queue (could be multi-consumer or single consumer), and have an asynchronous writer that reads it off and persists it ...
5
votes
Identify Iceberg Orders
Liquidity seeking is difficult to test empirically since price only data tells us nothing about the how transactions related to the level 1 (NBBO) order book, let alone the depth of the order book.
...
5
votes
What is an efficient data structure to model order book?
You can also utilize two red black trees.
Bids would be stored in descending order in one tree.
Asks would be stored in ascending order in the other.
The best bid and ask would always be the first ...
5
votes
Limit order book cancellations
This is somewhat of an opinion based response with some factual anecdotes at the end.
Spoofing is a very difficult concept to define, identify and prove. In voice brokered markets where transactions ...
5
votes
Red Black Trees for Limit Order Book
There is a difference about understanding LOB dynamics and using an algorithmic solution to capture these dynamics.
How LOB evolves.
We understood now long ago (see Jeremy Large's papers) that a ...
5
votes
Limit Order Book modeling
The Queue Reactive (QR) model (by Huang, L and Rosenbaum) is probably the most reliable to simulate order book dynamics. See this answer Order Book Dynamics for specific details.
Let just say that the ...
4
votes
Limit order book - does it get wiped over night?
If you are processing ITCH messages, for instance, each day is separate, and starts with an empty book. If there are such things as GTC orders anymore, the ITCH feed would resend their Add messages ...
4
votes
Accepted
Limit and Market Order for training a ML model
You are right that there are limit and market orders and nothing else. But I'll clarify it. Market orders do not stay in the order book because they instantaneously matched against limit orders and ...
4
votes
Modelling HFT data
By "modelling the LOB and the evolution of the LOB" you are modelling trades by definition as they are what determine how the LOB is going to behave.
The evolution of the limit order book is ...
4
votes
Accepted
Standard ways of simulating order books
Nowadays (4 years after your question...), the best way to simulate orderbook dynamics is probably to implement the Queue Reactive model, from Huang, Weibing, C-A L, and Mathieu Rosenbaum. "...
4
votes
How is market buy order executed when meeting both market sell order and limit sell order?
Two (or more) orders arriving at the same time makes no difference for an exchange's matching engine, the buy orders execute against sell limit orders, and the sell orders execute against buy limit ...
4
votes
How to understand micro-price (aka, weighted mid-price)?
The justification for that microprice is empirical, not theoretical. In most market I can think of, most of the time, if there are more orders and more size on the bid than the ask, then it's more ...
4
votes
Complexity of using balanced-tree to model order book
You won't usually implement a single tree. You'd usually implement a pair of trees (one for bid side, other for ask side) AND a hash map.
Since each tree is sorted, you can get the max ask and min ...
4
votes
Limit order book modeling based on computational statistics
They are different trends of research
agent based models, and you are right: Michael is a pioneer
point process based models, and I would say that Frederic's book is a reference: Limit Order Books.
...
4
votes
Accepted
How is forex market Quote-Driven?
If you use a retail platform, they do not make markets. For example, CMC markets gets the FX rate from liquidity providers like Deutsche Bank, JP Morgan, Barclays, Goldman, UBS, Citibank and HSBC. You ...
3
votes
Accepted
Does all (or any) exchange eats the positive difference between a buy order and a ask order?
What your describing is a simple limit-order book. Bob submits a limit order to buy 10 shares at \$101 so he will get filled for 5 @ 100 and 5 @ 101 and have a VWAP of \$100.5.
If a broker or ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
limit-order-book × 172market-microstructure × 55
high-frequency × 30
order-execution × 28
algorithmic-trading × 21
market-making × 19
orderbook × 19
market-data × 18
trading × 17
programming × 16
equities × 16
quant-trading-strategies × 9
order × 9
data × 8
order-handling × 7
tick-data × 5
backtesting × 4
machine-learning × 4
modeling × 4
exchange × 4
nasdaq × 4
finance × 3
futures × 3
simulations × 3
spread × 3