Hello,
welcome back to Papers with Backtest podcast.
Today we dive into another algo trading research paper.
And today we're tackling something really central to market making.
Absolutely.
How to handle inventory risk.
You know,
the risk you face just by holding assets while prices are bouncing around.
That's the core problem,
isn't it?
You want to capture that bid ask spread.
That's your profit engine.
Right.
But every time you fill an order,
you take on inventory.
And if the price moves against you,
Well,
that spread profit can disappear fast.
It's a real balancing act.
And the paper we're digging into today really formalizes this.
It's Dealing with the Inventory Risk from 2012 by Guillain,
Lahaye,
and Fernandez Tapia.
A classic in the field.
Definitely.
So for you listening,
our mission here is to really get under the hood,
understand the main trading rules they derive,
and crucially,
how those rules held up when they were backtested.
Yeah,
the backtest is key.
It's where the theory meets,
well,
reality,
sort of.
So how do they even frame this problem?
It sounds complex.
They approach it as a stochastic control problem,
which sounds a bit academic,
but the intuition is quite neat.
Okay.
Think about steering a ship in choppy waters.
You're constantly adjusting the rudder based on the waves and wind the randomness to stay on course.
So the market maker is the ship captain and the choppy waters are the price fluctuations.
Exactly.
The paper models that underlying reference price,
the sort of...
true price as a brownie in motion,
that captures the,
you know,
the unpredictable wiggles.
And that randomness is precisely what creates the inventory risk we're talking about.
Precisely.
And then there's the order flow.
How often do buyers and sellers show up?
The model assumes this isn't constant.
Makes sense.
If your price is way off market,
fewer people will trade with you.
Right.
They use an exponential function for that.
The further your quote,
your bid or ask,
is from that reference price,
the lower the arrival rate of orders.
An alha,
they call them.
And there are parameters A and K in there.
Yeah,
A is like the overall market activity level,
and A measures how sensitive traders are to your price difference.
High A means people really react to you being even slightly off.
Okay,
got it.
So the market maker wants to make money,
obviously,
but they're also managing this risk.
How is that modeled?
Their goal isn't just raw profit maximization.
It's maximizing the expected utility of their P&L.
Utility,
so incorporating risk preference.
Exactly.
They use a tech ARA utility function,
constant absolute risk aversion.
Basically,
it means the trader dislikes risk by the same amount,
whether they're currently up a million or down a million.
Interesting.
And the inventory itself,
the Q.
That's central.
How much stock are you holding right now?
And there are limits.
Q and minus Q,
a maximum you're willing to hold and a maximum short position.
And these limits directly affect quoting.
Absolutely.
If you hit inventory Q,
the model says you stop quoting a bid price altogether.
You don't want any more.
Right.
And vice versa,
if you hit minus Q,
you stop offering to sell.
Correct.
It forces you to manage that inventory level actively through your quotes.
So that's the setup.
How do they get to actual usable trading rules?
What should the bid and ask be?
This is where the math gets pretty involved.
They use Hamilton-Jacobi-Bellman equations,
HEB equations.
Standard toolkit for these dynamic optimization problems under uncertainty.
Right.
But solving them directly is tough.
They use a clever variable change that,
well...
simplifies things considerably.
It turns the HJB equation into a system of linear ordinary differential equations,
much more tractable.
Okay,
so the math machinery churns away and out pop the optimal quotes.
Essentially,
yes.
They derive formulas for the optimal bid and ask,
or rather the optimal distance of the bid and ask from the reference price.
And what do these optimal distances depend on?
They depend on the time left t,
Your current inventory Q and these functions VQT that come from solving those differential equations.
Ah,
the VQT functions.
What's the intuition there?
You can think of VQT as sort of the value or expected future utility if you have inventory Q with time P remaining.
The optimal quotes balance earning the spread now versus adjusting inventory for a better future state.
And the formulas also involve the risk aversion and that price sensitivity K.
Yes,
those parameters directly influence how wide or tight your optimal quote should be.
So what about the resulting bid-ask spread,
the difference between say and SB?
They derive that too.
It also depends on time and inventory,
again,
through those VQ functions.
It's dynamically adjusting based on your risk profile and market conditions.
Does it stay dynamic or does it settle down if you're,
say,
far from the end of the trading day?
That's a good point.
They look at the asymptotic behavior.
what happens when time t is far away.
The optimal quotes become almost independent of time.
They find these limits,
day and depu.
Simple rules for the long run,
basically.
Sort of.
The derivation involves eigenvectors and eigenvalues of a specific matrix,
so still mathematically grounded,
but it points towards a more stable quoting strategy when you're not up against a closing deadline.
Can these asymptotic quotes be simplified even more,
like a practical formula?
Yes,
they manage to get closed-form approximations for these asymptotic quotes.
That's really useful.
Why useful?
Because these approximations explicitly show how the optimal distances depend on things like volatility,
risk aversion,
the arrival rate A,
sensitivity K,
and of course your inventory Q.
So you can see the direct impact of changing market conditions or your own risk setting.
Exactly.
clearer intuition.
For example,
what happens if volatility squared goes up?
My intuition says you'd widen the spread.
More risk,
right?
Generally,
yes.
The approximation confirms that.
Higher psi usually means a wider optimal spread.
The exact adjustment on bid and ask separately might depend a bit on your current inventory queue,
though.
What about other parameters,
like
A, the order arrival rate?
I or A,
meaning more active trading,
tends to have the opposite effect of volatility.
It generally allows for a narrower spread.
More flow means you can manage inventory more easily,
perhaps.
And risk aversion.
That one's a bit more ambiguous in the model,
actually.
There are competing effects.
Okay.
And the Che,
the sensitivity to price.
Also complex.
But the general expectation is that as K increases,
meaning traders are more sensitive to your price,
you'd likely need to narrow your spread to stay competitive.
Makes sense.
Okay,
so we have the theory,
the asymptotics,
the approximations.
How did this translate into a backtest?
Did it actually work?
Right,
the crucial part.
They took this continuous time model and adapted it for discrete,
real-world data.
Wow.
They used tick data for France Telecom from one day in March 2012.
They had to discretize prices to the nearest tick size and time into small intervals,
representing how long an order stays active.
And the model parameters,
a,
k,
h.
a and k were calibrated from the limit order book data itself on that day.
They tried to estimate them from market activity.
And gay,
the risk aversion.
That was chosen more subjectively,
aiming to keep the simulated inventory within a reasonable range,
like Medica 10 plus 10 average trade sizes,
ATS.
Okay,
so what was the actual strategy being tested?
The model would calculate its optimal
SB and SI.
It would then place orders of a fixed size,
the average trade size,
ATS,
at those prices.
And how long did the orders last?
They stayed active for that short duration night.
If filled,
great.
If not,
they expired.
The model would then recalculate and potentially place new orders.
Quotes were updated after any trade or after it passed.
Got it.
And the results?
The paper shows some figures,
right?
Yes.
Figures 10 and 11 are key.
Figure 10 shows the inventory path of the strategy throughout the day.
You can see it fluctuating as it trades.
Trying to stay in year zero,
presumably,
but getting pushed around by the flow.
Exactly.
And figure 11 shows the cumulative P&L of this
model-based strategy.
Looks like it generally trended upwards.
It did on that day,
yes.
But the really interesting part is figure 12.
What's that one show?
It compares the model's P&L to a naive trader.
And the naive trader?
Just always post orders at the current best bid and best ask in the market.
A very simple,
passive approach.
And how did they compare?
The model-based strategy significantly outperformed the naive one in their back test.
Figure 11 shows a much better P&L than figure 12.
So,
actively managing the quotes based on inventory and risk using their derived rules actually paid off compared to just sitting on the BBO.
That's what the backtest suggests,
yes.
Figure 13 even gives a close-up view over one hour showing how the model's quotes,
SB and so,
moved relative to the market and its own inventory.
That's pretty compelling evidence for the model,
at least on that specific dataset.
It is encouraging.
Of course,
the authors rightly point out this is illustrative.
What are the caveats?
Well,
real-world implementation is harder.
For one,
parameters like A and K probably aren't constant throughout the day.
They might change with market regime.
True.
Market dynamics shift.
And there are other factors,
like passive market impact,
how your resting orders subtly affect others,
which weren't explicitly in this version of the model.
So a powerful framework,
demonstrated potential in a backtest,
but still room for refinement and further research.
For real world trading.
Precisely.
They mentioned generalizing the intensity functions and adding passive impact as important next steps.
Great stuff.
A really insightful look into managing that fundamental market making challenge.
Definitely a foundational piece of work in this area.
Thank you for tuning in to Papers with Backtest podcast.
We hope today's episode gave you useful insights.
Join us next time as we break down more research.
And for more papers and backtests,
find us at agenttps.paperswithbacktest.com.
Happy Trading.