The limit order book (LOB) containing high-frequency data for Amazon over a 1-day period was used to calibrate a market making algorithm. To remove the noise of the high-frequency data and get an accurate measure of the running volatility, the two-scaled realized volatility (TSRV) subsampling technique was used.
The optimal bid-ask spread was calculated using Hamiltonian-Jacobian-Bellman (HJB) equation where the diffusion of the stock price was stochastic volatility with 0 drift. That is:
The utility function used was:
That is, we are punished for holding inventory at the end of the trading day.
Then using Bellman's principle of optimality:
And applying Ito's lemma, we get the resultant HJB:
with terminal condition,
To reduce the dimensions, we use the ansatz solution:
This ansatz solution along with the implicit finite different method is known to converge to the viscosity solution and is unique.
To solve the HJB PDE, the Thomas Algorithm was implemented, and the optimal bid and ask spreads were calibrated to be:
Then using these optimal quotes, backtests were ran to test the efficacy. At time
Sources: Amit Zubier Arfan, (2021), On the Topic of Market Making Models: Applying and Calibrating with Stochastic Volatility and Limit Order Book Data.
Dependencies:
pip install plotly