Recreating the LOB (limit order book)

Marcelo Perlin


Version 1.4 of GetHFData adds functions for recreating the LOB (limit order book) from the order data. The LOB is recreated by sorting all trading orders (buy and sell) and matching them whenever there is a match of prices.

Simulating the LOB is a recursive and computer intensive problem. The current code is not optimized for speed and it may take a long time to process even a small set of financial orders.

Here’s an example of usage:


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

type.output <- 'raw' # aggregates data 

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

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)