WEBVTT

1
00:00:00.020 --> 00:00:00.200
Hello,

2
00:00:00.320 --> 00:00:02.502
welcome back to Papers with Backtest podcast.

3
00:00:02.902 --> 00:00:06.485
Today we dive into another algo trading research paper.

4
00:00:06.705 --> 00:00:10.028
And today we're tackling something really central to market making.

5
00:00:10.228 --> 00:00:10.748
Absolutely.

6
00:00:11.149 --> 00:00:12.670
How to handle inventory risk.

7
00:00:13.330 --> 00:00:13.571
You know,

8
00:00:13.572 --> 00:00:17.454
the risk you face just by holding assets while prices are bouncing around.

9
00:00:17.714 --> 00:00:18.855
That's the core problem,

10
00:00:18.915 --> 00:00:19.255
isn't it?

11
00:00:19.256 --> 00:00:21.076
You want to capture that bid ask spread.

12
00:00:21.137 --> 00:00:22.157
That's your profit engine.

13
00:00:22.297 --> 00:00:22.538
Right.

14
00:00:22.598 --> 00:00:24.359
But every time you fill an order,

15
00:00:25.140 --> 00:00:26.321
you take on inventory.

16
00:00:26.901 --> 00:00:28.382
And if the price moves against you,

17
00:00:29.216 --> 00:00:29.356
Well,

18
00:00:29.376 --> 00:00:31.558
that spread profit can disappear fast.

19
00:00:31.598 --> 00:00:32.839
It's a real balancing act.

20
00:00:33.299 --> 00:00:36.242
And the paper we're digging into today really formalizes this.

21
00:00:36.662 --> 00:00:40.285
It's Dealing with the Inventory Risk from 2012 by Guillain,

22
00:00:40.465 --> 00:00:40.945
Lahaye,

23
00:00:41.005 --> 00:00:41.926
and Fernandez Tapia.

24
00:00:42.086 --> 00:00:43.107
A classic in the field.

25
00:00:43.227 --> 00:00:43.627
Definitely.

26
00:00:44.108 --> 00:00:44.948
So for you listening,

27
00:00:45.028 --> 00:00:46.730
our mission here is to really get under the hood,

28
00:00:47.170 --> 00:00:49.732
understand the main trading rules they derive,

29
00:00:50.112 --> 00:00:50.653
and crucially,

30
00:00:50.693 --> 00:00:53.095
how those rules held up when they were backtested.

31
00:00:53.235 --> 00:00:53.395
Yeah,

32
00:00:53.415 --> 00:00:54.276
the backtest is key.

33
00:00:54.316 --> 00:00:55.517
It's where the theory meets,

34
00:00:56.017 --> 00:00:56.197
well,

35
00:00:57.238 --> 00:00:57.678
reality,

36
00:00:57.878 --> 00:00:58.219
sort of.

37
00:00:58.260 --> 00:01:00.001
So how do they even frame this problem?

38
00:01:00.041 --> 00:01:00.942
It sounds complex.

39
00:01:01.422 --> 00:01:04.345
They approach it as a stochastic control problem,

40
00:01:04.865 --> 00:01:06.647
which sounds a bit academic,

41
00:01:06.687 --> 00:01:08.268
but the intuition is quite neat.

42
00:01:08.608 --> 00:01:08.848
Okay.

43
00:01:09.008 --> 00:01:11.670
Think about steering a ship in choppy waters.

44
00:01:12.291 --> 00:01:17.155
You're constantly adjusting the rudder based on the waves and wind the randomness to stay on course.

45
00:01:17.435 --> 00:01:22.979
So the market maker is the ship captain and the choppy waters are the price fluctuations.

46
00:01:23.240 --> 00:01:23.800
Exactly.

47
00:01:24.240 --> 00:01:26.942
The paper models that underlying reference price,

48
00:01:26.943 --> 00:01:27.363
the sort of...

49
00:01:27.684 --> 00:01:29.606
true price as a brownie in motion,

50
00:01:30.026 --> 00:01:30.907
that captures the,

51
00:01:31.247 --> 00:01:31.487
you know,

52
00:01:31.567 --> 00:01:33.028
the unpredictable wiggles.

53
00:01:33.248 --> 00:01:36.931
And that randomness is precisely what creates the inventory risk we're talking about.

54
00:01:37.031 --> 00:01:37.512
Precisely.

55
00:01:37.692 --> 00:01:38.893
And then there's the order flow.

56
00:01:39.113 --> 00:01:40.974
How often do buyers and sellers show up?

57
00:01:41.135 --> 00:01:43.176
The model assumes this isn't constant.

58
00:01:43.276 --> 00:01:43.757
Makes sense.

59
00:01:43.857 --> 00:01:45.238
If your price is way off market,

60
00:01:45.638 --> 00:01:46.819
fewer people will trade with you.

61
00:01:47.059 --> 00:01:47.259
Right.

62
00:01:47.459 --> 00:01:49.001
They use an exponential function for that.

63
00:01:49.281 --> 00:01:50.362
The further your quote,

64
00:01:50.542 --> 00:01:51.603
your bid or ask,

65
00:01:51.983 --> 00:01:53.204
is from that reference price,

66
00:01:53.224 --> 00:01:54.945
the lower the arrival rate of orders.

67
00:01:55.666 --> 00:01:56.086
An alha,

68
00:01:56.326 --> 00:01:56.707
they call them.

69
00:01:56.940 --> 00:01:58.701
And there are parameters A and K in there.

70
00:01:59.002 --> 00:01:59.142
Yeah,

71
00:01:59.242 --> 00:02:01.323
A is like the overall market activity level,

72
00:02:01.764 --> 00:02:04.746
and A measures how sensitive traders are to your price difference.

73
00:02:05.166 --> 00:02:08.909
High A means people really react to you being even slightly off.

74
00:02:09.090 --> 00:02:09.290
Okay,

75
00:02:09.350 --> 00:02:09.650
got it.

76
00:02:10.090 --> 00:02:13.173
So the market maker wants to make money,

77
00:02:13.593 --> 00:02:14.053
obviously,

78
00:02:14.634 --> 00:02:16.275
but they're also managing this risk.

79
00:02:16.435 --> 00:02:17.256
How is that modeled?

80
00:02:17.916 --> 00:02:20.559
Their goal isn't just raw profit maximization.

81
00:02:20.739 --> 00:02:23.701
It's maximizing the expected utility of their P&L.

82
00:02:23.901 --> 00:02:24.261
Utility,

83
00:02:24.422 --> 00:02:25.723
so incorporating risk preference.

84
00:02:25.743 --> 00:02:26.163
Exactly.

85
00:02:26.440 --> 00:02:28.582
They use a tech ARA utility function,

86
00:02:28.922 --> 00:02:30.483
constant absolute risk aversion.

87
00:02:31.084 --> 00:02:31.504
Basically,

88
00:02:31.524 --> 00:02:34.286
it means the trader dislikes risk by the same amount,

89
00:02:34.446 --> 00:02:36.888
whether they're currently up a million or down a million.

90
00:02:37.028 --> 00:02:37.489
Interesting.

91
00:02:37.889 --> 00:02:38.990
And the inventory itself,

92
00:02:39.110 --> 00:02:39.330
the Q.

93
00:02:39.690 --> 00:02:40.251
That's central.

94
00:02:40.431 --> 00:02:41.892
How much stock are you holding right now?

95
00:02:42.032 --> 00:02:42.753
And there are limits.

96
00:02:42.833 --> 00:02:43.553
Q and minus Q,

97
00:02:44.194 --> 00:02:47.136
a maximum you're willing to hold and a maximum short position.

98
00:02:47.476 --> 00:02:50.419
And these limits directly affect quoting.

99
00:02:50.759 --> 00:02:51.239
Absolutely.

100
00:02:51.580 --> 00:02:52.540
If you hit inventory Q,

101
00:02:52.741 --> 00:02:55.162
the model says you stop quoting a bid price altogether.

102
00:02:55.182 --> 00:02:55.903
You don't want any more.

103
00:02:56.084 --> 00:02:56.284
Right.

104
00:02:56.364 --> 00:02:56.985
And vice versa,

105
00:02:56.986 --> 00:02:57.765
if you hit minus Q,

106
00:02:57.885 --> 00:02:58.966
you stop offering to sell.

107
00:02:59.086 --> 00:02:59.487
Correct.

108
00:02:59.707 --> 00:03:02.869
It forces you to manage that inventory level actively through your quotes.

109
00:03:03.150 --> 00:03:04.010
So that's the setup.

110
00:03:04.090 --> 00:03:06.452
How do they get to actual usable trading rules?

111
00:03:06.712 --> 00:03:08.354
What should the bid and ask be?

112
00:03:08.614 --> 00:03:10.976
This is where the math gets pretty involved.

113
00:03:10.996 --> 00:03:13.838
They use Hamilton-Jacobi-Bellman equations,

114
00:03:14.498 --> 00:03:15.399
HEB equations.

115
00:03:15.479 --> 00:03:19.102
Standard toolkit for these dynamic optimization problems under uncertainty.

116
00:03:19.362 --> 00:03:19.622
Right.

117
00:03:20.003 --> 00:03:21.504
But solving them directly is tough.

118
00:03:21.724 --> 00:03:23.405
They use a clever variable change that,

119
00:03:23.505 --> 00:03:23.666
well...

120
00:03:24.108 --> 00:03:25.449
simplifies things considerably.

121
00:03:25.869 --> 00:03:31.094
It turns the HJB equation into a system of linear ordinary differential equations,

122
00:03:31.494 --> 00:03:32.495
much more tractable.

123
00:03:32.575 --> 00:03:32.795
Okay,

124
00:03:32.815 --> 00:03:36.978
so the math machinery churns away and out pop the optimal quotes.

125
00:03:37.278 --> 00:03:37.779
Essentially,

126
00:03:37.859 --> 00:03:38.119
yes.

127
00:03:38.439 --> 00:03:40.881
They derive formulas for the optimal bid and ask,

128
00:03:41.101 --> 00:03:44.464
or rather the optimal distance of the bid and ask from the reference price.

129
00:03:44.964 --> 00:03:46.746
And what do these optimal distances depend on?

130
00:03:47.186 --> 00:03:48.447
They depend on the time left t,

131
00:03:48.908 --> 00:03:54.052
Your current inventory Q and these functions VQT that come from solving those differential equations.

132
00:03:54.232 --> 00:03:54.432
Ah,

133
00:03:54.853 --> 00:03:56.474
the VQT functions.

134
00:03:56.614 --> 00:03:57.535
What's the intuition there?

135
00:03:57.675 --> 00:04:04.040
You can think of VQT as sort of the value or expected future utility if you have inventory Q with time P remaining.

136
00:04:04.680 --> 00:04:10.465
The optimal quotes balance earning the spread now versus adjusting inventory for a better future state.

137
00:04:10.665 --> 00:04:14.808
And the formulas also involve the risk aversion and that price sensitivity K.

138
00:04:15.220 --> 00:04:15.460
Yes,

139
00:04:15.620 --> 00:04:19.664
those parameters directly influence how wide or tight your optimal quote should be.

140
00:04:20.324 --> 00:04:22.906
So what about the resulting bid-ask spread,

141
00:04:23.366 --> 00:04:24.968
the difference between say and SB?

142
00:04:25.368 --> 00:04:26.249
They derive that too.

143
00:04:26.809 --> 00:04:29.251
It also depends on time and inventory,

144
00:04:29.411 --> 00:04:29.651
again,

145
00:04:29.731 --> 00:04:30.992
through those VQ functions.

146
00:04:31.573 --> 00:04:35.236
It's dynamically adjusting based on your risk profile and market conditions.

147
00:04:35.456 --> 00:04:38.158
Does it stay dynamic or does it settle down if you're,

148
00:04:38.338 --> 00:04:38.518
say,

149
00:04:38.678 --> 00:04:40.120
far from the end of the trading day?

150
00:04:40.460 --> 00:04:41.180
That's a good point.

151
00:04:41.260 --> 00:04:42.882
They look at the asymptotic behavior.

152
00:04:43.160 --> 00:04:45.142
what happens when time t is far away.

153
00:04:45.842 --> 00:04:48.224
The optimal quotes become almost independent of time.

154
00:04:48.324 --> 00:04:49.245
They find these limits,

155
00:04:49.565 --> 00:04:50.506
day and depu.

156
00:04:50.886 --> 00:04:52.047
Simple rules for the long run,

157
00:04:52.087 --> 00:04:52.487
basically.

158
00:04:52.888 --> 00:04:53.348
Sort of.

159
00:04:53.928 --> 00:04:58.032
The derivation involves eigenvectors and eigenvalues of a specific matrix,

160
00:04:58.132 --> 00:04:59.653
so still mathematically grounded,

161
00:04:59.833 --> 00:05:04.897
but it points towards a more stable quoting strategy when you're not up against a closing deadline.

162
00:05:05.307 --> 00:05:08.707
Can these asymptotic quotes be simplified even more,

163
00:05:09.427 --> 00:05:10.727
like a practical formula?

164
00:05:11.227 --> 00:05:11.487
Yes,

165
00:05:11.787 --> 00:05:15.727
they manage to get closed-form approximations for these asymptotic quotes.

166
00:05:15.787 --> 00:05:16.707
That's really useful.

167
00:05:16.907 --> 00:05:17.407
Why useful?

168
00:05:17.767 --> 00:05:23.287
Because these approximations explicitly show how the optimal distances depend on things like volatility,

169
00:05:23.527 --> 00:05:24.247
risk aversion,

170
00:05:24.627 --> 00:05:25.687
the arrival rate A,

171
00:05:26.227 --> 00:05:26.927
sensitivity K,

172
00:05:27.247 --> 00:05:28.507
and of course your inventory Q.

173
00:05:29.167 --> 00:05:33.127
So you can see the direct impact of changing market conditions or your own risk setting.

174
00:05:33.187 --> 00:05:34.107
Exactly.

175
00:05:34.655 --> 00:05:35.695
clearer intuition.

176
00:05:35.755 --> 00:05:36.315
For example,

177
00:05:36.635 --> 00:05:38.635
what happens if volatility squared goes up?

178
00:05:38.815 --> 00:05:40.535
My intuition says you'd widen the spread.

179
00:05:41.015 --> 00:05:41.535
More risk,

180
00:05:41.615 --> 00:05:41.775
right?

181
00:05:41.815 --> 00:05:42.255
Generally,

182
00:05:42.335 --> 00:05:42.575
yes.

183
00:05:42.655 --> 00:05:44.095
The approximation confirms that.

184
00:05:44.475 --> 00:05:47.155
Higher psi usually means a wider optimal spread.

185
00:05:47.835 --> 00:05:52.995
The exact adjustment on bid and ask separately might depend a bit on your current inventory queue,

186
00:05:53.015 --> 00:05:53.215
though.

187
00:05:53.575 --> 00:05:54.675
What about other parameters,

188
00:05:55.235 --> 00:05:55.495
like

189
00:05:56.235 --> 00:05:57.635
A, the order arrival rate?

190
00:05:57.995 --> 00:05:58.415
I or A,

191
00:05:58.855 --> 00:06:00.075
meaning more active trading,

192
00:06:00.475 --> 00:06:02.415
tends to have the opposite effect of volatility.

193
00:06:03.491 --> 00:06:05.493
It generally allows for a narrower spread.

194
00:06:05.713 --> 00:06:08.375
More flow means you can manage inventory more easily,

195
00:06:08.535 --> 00:06:08.955
perhaps.

196
00:06:09.276 --> 00:06:10.056
And risk aversion.

197
00:06:10.557 --> 00:06:12.378
That one's a bit more ambiguous in the model,

198
00:06:12.458 --> 00:06:12.778
actually.

199
00:06:12.858 --> 00:06:14.059
There are competing effects.

200
00:06:14.119 --> 00:06:14.360
Okay.

201
00:06:14.480 --> 00:06:14.940
And the Che,

202
00:06:15.320 --> 00:06:16.501
the sensitivity to price.

203
00:06:17.062 --> 00:06:17.702
Also complex.

204
00:06:17.882 --> 00:06:21.365
But the general expectation is that as K increases,

205
00:06:21.445 --> 00:06:23.927
meaning traders are more sensitive to your price,

206
00:06:24.347 --> 00:06:27.170
you'd likely need to narrow your spread to stay competitive.

207
00:06:27.350 --> 00:06:27.770
Makes sense.

208
00:06:28.210 --> 00:06:28.370
Okay,

209
00:06:28.391 --> 00:06:29.071
so we have the theory,

210
00:06:29.331 --> 00:06:30.112
the asymptotics,

211
00:06:30.113 --> 00:06:30.973
the approximations.

212
00:06:31.715 --> 00:06:33.296
How did this translate into a backtest?

213
00:06:33.356 --> 00:06:34.257
Did it actually work?

214
00:06:34.597 --> 00:06:34.878
Right,

215
00:06:34.938 --> 00:06:35.798
the crucial part.

216
00:06:36.139 --> 00:06:39.201
They took this continuous time model and adapted it for discrete,

217
00:06:39.461 --> 00:06:40.422
real-world data.

218
00:06:40.762 --> 00:06:40.962
Wow.

219
00:06:41.363 --> 00:06:46.326
They used tick data for France Telecom from one day in March 2012.

220
00:06:46.346 --> 00:06:50.710
They had to discretize prices to the nearest tick size and time into small intervals,

221
00:06:51.030 --> 00:06:53.012
representing how long an order stays active.

222
00:06:53.112 --> 00:06:54.193
And the model parameters,

223
00:06:54.273 --> 00:06:54.393
a,

224
00:06:54.453 --> 00:06:54.573
k,

225
00:06:54.793 --> 00:06:54.913
h.

226
00:06:55.013 --> 00:06:58.676
a and k were calibrated from the limit order book data itself on that day.

227
00:06:58.991 --> 00:07:00.933
They tried to estimate them from market activity.

228
00:07:01.133 --> 00:07:01.493
And gay,

229
00:07:01.553 --> 00:07:02.394
the risk aversion.

230
00:07:02.674 --> 00:07:04.575
That was chosen more subjectively,

231
00:07:05.076 --> 00:07:08.178
aiming to keep the simulated inventory within a reasonable range,

232
00:07:08.218 --> 00:07:10.880
like Medica 10 plus 10 average trade sizes,

233
00:07:11.060 --> 00:07:11.481
ATS.

234
00:07:11.621 --> 00:07:11.821
Okay,

235
00:07:11.861 --> 00:07:13.763
so what was the actual strategy being tested?

236
00:07:13.923 --> 00:07:15.944
The model would calculate its optimal

237
00:07:16.385 --> 00:07:17.245
SB and SI.

238
00:07:17.786 --> 00:07:20.128
It would then place orders of a fixed size,

239
00:07:20.168 --> 00:07:21.509
the average trade size,

240
00:07:21.629 --> 00:07:22.129
ATS,

241
00:07:22.289 --> 00:07:22.970
at those prices.

242
00:07:23.010 --> 00:07:24.351
And how long did the orders last?

243
00:07:24.571 --> 00:07:26.693
They stayed active for that short duration night.

244
00:07:27.113 --> 00:07:27.593
If filled,

245
00:07:27.794 --> 00:07:27.974
great.

246
00:07:28.355 --> 00:07:28.675
If not,

247
00:07:28.676 --> 00:07:29.255
they expired.

248
00:07:29.935 --> 00:07:33.275
The model would then recalculate and potentially place new orders.

249
00:07:33.715 --> 00:07:37.535
Quotes were updated after any trade or after it passed.

250
00:07:37.675 --> 00:07:38.095
Got it.

251
00:07:38.655 --> 00:07:39.315
And the results?

252
00:07:39.475 --> 00:07:40.675
The paper shows some figures,

253
00:07:40.715 --> 00:07:40.895
right?

254
00:07:40.935 --> 00:07:41.135
Yes.

255
00:07:41.255 --> 00:07:42.655
Figures 10 and 11 are key.

256
00:07:43.155 --> 00:07:46.415
Figure 10 shows the inventory path of the strategy throughout the day.

257
00:07:46.416 --> 00:07:48.115
You can see it fluctuating as it trades.

258
00:07:48.195 --> 00:07:49.315
Trying to stay in year zero,

259
00:07:49.455 --> 00:07:50.015
presumably,

260
00:07:50.115 --> 00:07:51.795
but getting pushed around by the flow.

261
00:07:52.015 --> 00:07:52.575
Exactly.

262
00:07:52.715 --> 00:07:55.435
And figure 11 shows the cumulative P&L of this

263
00:07:55.783 --> 00:07:56.744
model-based strategy.

264
00:07:56.844 --> 00:07:58.485
Looks like it generally trended upwards.

265
00:07:58.525 --> 00:07:59.286
It did on that day,

266
00:07:59.386 --> 00:07:59.686
yes.

267
00:08:00.387 --> 00:08:02.448
But the really interesting part is figure 12.

268
00:08:02.528 --> 00:08:03.249
What's that one show?

269
00:08:03.689 --> 00:08:07.332
It compares the model's P&L to a naive trader.

270
00:08:07.833 --> 00:08:08.693
And the naive trader?

271
00:08:08.933 --> 00:08:13.457
Just always post orders at the current best bid and best ask in the market.

272
00:08:13.977 --> 00:08:14.838
A very simple,

273
00:08:14.958 --> 00:08:15.839
passive approach.

274
00:08:15.999 --> 00:08:16.840
And how did they compare?

275
00:08:17.160 --> 00:08:21.663
The model-based strategy significantly outperformed the naive one in their back test.

276
00:08:22.275 --> 00:08:25.578
Figure 11 shows a much better P&L than figure 12.

277
00:08:25.958 --> 00:08:26.078
So,

278
00:08:26.618 --> 00:08:34.665
actively managing the quotes based on inventory and risk using their derived rules actually paid off compared to just sitting on the BBO.

279
00:08:34.945 --> 00:08:36.346
That's what the backtest suggests,

280
00:08:36.386 --> 00:08:36.686
yes.

281
00:08:37.247 --> 00:08:42.291
Figure 13 even gives a close-up view over one hour showing how the model's quotes,

282
00:08:42.711 --> 00:08:43.251
SB and so,

283
00:08:43.752 --> 00:08:46.814
moved relative to the market and its own inventory.

284
00:08:47.034 --> 00:08:48.876
That's pretty compelling evidence for the model,

285
00:08:48.877 --> 00:08:50.417
at least on that specific dataset.

286
00:08:50.671 --> 00:08:51.411
It is encouraging.

287
00:08:51.431 --> 00:08:51.791
Of course,

288
00:08:51.792 --> 00:08:53.831
the authors rightly point out this is illustrative.

289
00:08:54.151 --> 00:08:54.971
What are the caveats?

290
00:08:55.111 --> 00:08:55.291
Well,

291
00:08:55.471 --> 00:08:57.291
real-world implementation is harder.

292
00:08:57.531 --> 00:08:58.051
For one,

293
00:08:58.091 --> 00:09:02.051
parameters like A and K probably aren't constant throughout the day.

294
00:09:02.151 --> 00:09:03.991
They might change with market regime.

295
00:09:04.131 --> 00:09:04.391
True.

296
00:09:04.591 --> 00:09:05.591
Market dynamics shift.

297
00:09:05.751 --> 00:09:06.911
And there are other factors,

298
00:09:06.951 --> 00:09:08.551
like passive market impact,

299
00:09:08.711 --> 00:09:10.931
how your resting orders subtly affect others,

300
00:09:10.971 --> 00:09:13.331
which weren't explicitly in this version of the model.

301
00:09:13.491 --> 00:09:14.671
So a powerful framework,

302
00:09:15.251 --> 00:09:17.291
demonstrated potential in a backtest,

303
00:09:17.771 --> 00:09:20.191
but still room for refinement and further research.

304
00:09:20.423 --> 00:09:21.444
For real world trading.

305
00:09:21.584 --> 00:09:22.204
Precisely.

306
00:09:22.505 --> 00:09:28.229
They mentioned generalizing the intensity functions and adding passive impact as important next steps.

307
00:09:28.429 --> 00:09:28.970
Great stuff.

308
00:09:29.010 --> 00:09:33.433
A really insightful look into managing that fundamental market making challenge.

309
00:09:33.613 --> 00:09:35.715
Definitely a foundational piece of work in this area.

310
00:09:36.215 --> 00:09:38.877
Thank you for tuning in to Papers with Backtest podcast.

311
00:09:39.238 --> 00:09:41.540
We hope today's episode gave you useful insights.

312
00:09:41.960 --> 00:09:44.122
Join us next time as we break down more research.

313
00:09:44.702 --> 00:09:46.223
And for more papers and backtests,

314
00:09:46.443 --> 00:09:49.666
find us at agenttps.paperswithbacktest.com.

315
00:09:50.289 --> 00:09:50.881
Happy Trading.

