# How does one calibrate lambda in a Avellaneda-Stoikov market making problem leading to Gueant-Lehalle-Tapia model?

The title is similar to that of the question I was referred to here which has been answered by Lehalle himself!

I'm trying to implement the Gueant-Lehalle-Tapia model which is how I got to this answer where Lehalle refers to another paper by Sophia Laruelle (here, crude English translation by AI: here) where in Section 3.1 she explains how to first estimate the lambda and then use regression to estimate A and K in the GLT formulae. What I don't understand it how I would do it in a real dataset. What she suggests is using a Nelson-Aalen type of estimator within a timeframe of [0, T] to calculate the lambda. But then in the next paragraph she says that T=15 transactions (Ref. Figure 1). Am I supposed to resample based on time or ticks? And then I don't understand how she would use this to calculate lambda for different distances as she suggests in the figure.

In trying to answer this I came across this library hftbacktest and the author Naz's related question here about this particular problem. And he seems to ignore what Sophia suggests and instead assuming arrivals to be a Poisson process, models the inter-arrival times and fits as exponential to find the lambda.

I'm quite confused! To summarise my question, all I want to know is that if I had a days worth of trades tick data how would I get to Sophia's Figure 1 in Section 3.1 of the paper? Thanks a lot.

PS: A first year Quant very new to market making. Sorry if I made a mistake or didn't explain anything required.

For generating that Figure, its exactly like Lehalle said.

I dont remember where I saw the specific points, but my solution was something like this:

1. Take a $$\delta$$ value and make a binary array with a 1 if the traded price is less than Reference Price (Mid, microprice, etc..) - $$\delta$$ (For bid case, + $$\delta$$ ask case) and 0 if not.

2. Then, take a subset of data(10/15/20 min would be fine). So for a 15min sample, all the data between 9:30Am and 9:45Am, then for 9:45 to 10:00, ...

3. For each of the subsets, you count the number of 1 in the binary array and append it to a list.

4. Iterating through all the subsets in your day/s, take the mean of the list, and then you have your first pair ($$\delta$$, $$\lambda$$).

5. Iterate trough all $$\delta$$s and you will have a similar Figure like Sophie Laurelle.

Some things to consider besides those that are mentioned in the posts you shared:

• This can be done for bid and ask, so you can have different $$\lambda$$ for each $$\delta$$. Generally, the LOB exhibit symmetric properties, and they will likely be together. For an easy solution, you can also take the mean and you will have a single curve.

• This Poisson estimation is based on the the sample time you take, so the lambda would be $$\hat{\lambda}_{10min}$$ and its going to be different to $$\hat{\lambda}_{20min}$$(Not necessarily twice the first one), but probably the general form of the figure will not change much, just something scaled.

• Consider that the parameters estimated (k, A) are used to construct your optimal spread, so when plugging the estimated parameters, you can have a sense if the optimal spread is too little/big (depends totally on the market) for the actual market spread (ask - bid). Think that you have to be executed to at least try to make a profit, so the numerical values need to be "reasonable".

• Remember that there isnt a "best" way to solve this problems, so start simple and then try to be creative and see what small changes do to the strategy PnL. (Ref price, params change, some forecasts, etc..) Obviously backtesting this in HFT is difficult, but its surprising that small changes in the strategy can have a huge impact in real PnL.

My english writing its not the best, but hope it helps!

• Thank you so much for this to be honest I was not expecting a reply. You have pointed me in the right direction I'll surely get something out of this. Cheers
– Jay
Commented Dec 1, 2023 at 18:33
• For future reference, here's Tapia's dissertation that points to and elaborates on what the answer suggests. link
– Jay
Commented Dec 1, 2023 at 18:35