R Code for limit order book (LOB) modelling
The R code here was written as part of an essay "Stochastic Modelling of Limit Order Books in Continuous Time". The data is from NASDAQ, provided through LOBSTER. Sample data from LOBSTER is available here https://lobsterdata.com/info/DataSamples.php
The code is split into 2 sections: Section 1 investigates the reliability of a model proposed by Cont and Larrard in their 2013 paper "Price dynamics in a Markovian limit order market" Section 2 investigates the market microstructure, in particular examining (i) Order arrival rate (ii) Order size distribution
For a quick explanation of LOBs, see investopedia https://www.investopedia.com/terms/l/limitorderbook.asp
Or for an indepth academic overview of LOBs, see the survey paper here https://people.maths.ox.ac.uk/porterm/papers/gould-qf-final.pdf where there are some good diagrams on the 3rd page.
Or check out the explanation on my website at www.jmackillop.ml