42 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-...
user avatar
19 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 ...
user avatar
  • 1,616
11 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/...
user avatar
9 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), ...
user avatar
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 ...
user avatar
  • 1,616
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 ...
user avatar
  • 10.5k
7 votes

What is an efficient data structure to model order book?

I do not know in which context you want to implement a matching engine (ME). But according to me the two nice challenges in this context are: implement one in an FPGA for simulation / fast replay ...
user avatar
  • 10.5k
7 votes
Accepted

Latency and Delays across Exchanges

The round-trip latency from point A to a matching engine at point B can be thought of being comprised of two components: $RTT_{total,A \rightarrow B} = RTT_{network\_transit,A \rightarrow B} + MPL_{...
user avatar
7 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 ...
user avatar
  • 952
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 ...
user avatar
  • 1,616
6 votes

Order book size limit

I am not aware on any rules preventing a too high number of entries at a limit price. Nevertheless you usually have controls for each trader id. A trader cannot have too many orders in the book or ...
user avatar
  • 10.5k
6 votes
Accepted

What are flickering orders?

A "flickering" order is one which is repeatedly submitted and cancelled (whether it's at the top of book or not). The answer from @chollida mentions that "the goal typically is to either slow down ...
user avatar
  • 5,603
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 ...
user avatar
  • 1,616
5 votes

What are the unfair order execution/routing advantages HFT firms apparently have?

I have heard of several allegations in the recent days, but they are mostly baseless. However, there are a rare, few trading venues whose matching rules are most often accused of giving unfair order ...
user avatar
  • 5,062
5 votes

Deep bid ask orders

I fully agree with all potential rationals written here to put bids and asks deep in the book. All these interests are part of what we should name the latent order book, since potentially agent would ...
user avatar
  • 10.5k
5 votes

Deep bid ask orders

Don't discount the fact that it could be a fund testing a strategy or order type. I do this all the time. I'll take an algo that should penny on say, VWAP, and make it penny on VWAP - $10 to ensure ...
user avatar
  • 1,349
5 votes
Accepted

Model reference price of Limit order book

This reference price is also sometimes called intrinsic price. One of the simplest ways to improve it in regards to the mid-price (assuming you have the depth data) is the following: define a ...
user avatar
  • 952
5 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: ...
user avatar
  • 10.5k
5 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, ...
user avatar
  • 725
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 ...
user avatar
  • 7,997
4 votes

Deep bid ask orders

Some exchanges have agreements with market makers to provide liquidity (the market makers often get some kind of preferential treatment in return). Often these agreements will include obligations to ...
user avatar
  • 150
4 votes
Accepted

What is the correct / expected behavior for a market order sent to an empty book?

This differs from exchange to exchange but in Toronto (TSX) the rule is that the unfilled amount becomes a limit order at the last sale price. ...
user avatar
  • 1,349
4 votes
Accepted

Order Execution Algorithms

Most of the big players offer a suite of execution algorithms for big orders, as seen in this listing from Credit Suisse. Very generally speaking, the algorithms will have a pedigree going back to ...
user avatar
  • 14.4k
4 votes

Order Execution Algorithms

To slice up an order you can use several execution strategies. TWAP which will execute small slices of your order over a time period VWAP which will spread your order over time and try to minimize ...
user avatar
  • 1,349
4 votes
Accepted

how are gaps usually handled in market data received with multicast?

You are usually given an option to either - Request a re-transmission of the messages you missed (through a different channel). Request a snapshot of the current book from a dedicated server. Both ...
user avatar
  • 758
4 votes

Estimate probability of limit order execution over a large time frame

One way to do this is a simple Monte-Carlo simulation. There are formulae you can use to get the likelihood of a stock being below a price if you know the stock's volatility and time frame - see for ...
user avatar
4 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. ...
user avatar
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 ...
user avatar
  • 1,132
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 ...
user avatar
  • 3,475

Only top scored, non community-wiki answers of a minimum length are eligible