GetHFData newest version (1.4) allows the recreation of the LOB (limit order book) based on order data. A limit order book is the standard format that trading occurs in most exchanges. Order are sent and executed whenever there is a match of order prices from sellers and buyers. Recreating the LOB is a recursive problem where all trading orders must be sorted, added and organized into a LOB object. Based on the LOB, we have information about the mid quote, best bid/ask, spread and LOB depth. These variables are usually used in studies regarding market liquidity.

I want to thank Prof. Satchit Sagade and House of Finance - Goethe Uni for inviting me as a visiting researcher in June 2017. Not only I had a wonderful time there, most of the code for the LOB reconstruction was developed during my stay.

Be aware that recreating the LOB is a computer intensive problem. The current code is not optimized for speed and may take a long time to finish, even for a few periods of trading days. Here’s an example of usage for the new code:


first.time <- '10:00:00'
last.time <- '17:00:00' <- '2015-08-18' <- '2015-08-18'

type.output <- 'raw' 

my.assets <- 'PETR4F' 
type.matching <- 'exact' = 'equity-odds' <- 'orders' 

df.out <- ghfd_get_HF_data(my.assets =my.assets, 
                           type.matching = type.matching,
                           first.time = first.time,
                           last.time = last.time,
                           type.output = type.output)
df.lob <- ghfd_build_lob(df.out)