A key concept for MMs is how you manage inventory. Avellaneda and Stoikov is basically the model everyone uses for this. Then there comes the offset, basically how wide your spreads are. That's your basic model of liquidity provision...
From there we get to have some fun! If you can create multiple forecasts for different timeframes (and at a super-advanced level compute speeds) you can make spreads asymmetric and intentionally hold inventory...
Even if you aren't making markets an MM HFT model can help a simple alpha strategy. Make a short-term prediction, and a long(er) term prediction (still HFT lol). If they both line up put some limit orders through. You can now load up on inventory for the...
direction of your short term forecast (if you don't get hit who cares, no loss), but to exit you don't need to use market orders (or super aggressive limit orders which may end up crossing and getting taker fees) because you are not in any sort of rush to exit...
you are still collecting alpha as you try to use limit orders to get out. You collect the BAS (maybe even end up positive if you can get flat exchange fees bc both are maker orders) and you earn alpha on your predictions. As long as your predictions are somewhat right you...
will do well. This solves the issue of adverse trading. This is a lot of limit orders who aren't really MMs just cheap alpha, but the majority of them are still somewhat MM. I'll go into this now:
You have your offset from the midprice (irl use the microprice, github in roadmap, instead of midprice), then you make your spreads asymmetric and accrue inventory relative to your timeframe predictions and the predictions of how much of that you can get out using...
limit orders. The reason for speed is so that you can update those spreads as the market shifts and as alpha potentially turns around (and now you have your spreads asymmetric the wrong way!!!). I won't speak on this too much but there are fancy order types that let you
workaround this so that the price doesn't move and your limit order becomes aggressive and you get filled as a market order (which is how super aggressive LOs get treated exchange fee-wise). I had a previous thread where I complained about diminished OB liquidity...
and then proceeded to give papers on how to take part in it XD. Go have a look they're at the end of the thread. For good examples just go through the roadmap. The github repo examples are great. Even if you are not looking at MM repos the modelling repos just show...
how to engineer features etc. There is at least 2-300 features you could get just from copying repositories. Also, go through my signal processing thread for a good modeling example. Hopefully, this doesn't come off as self-pumping I just cba to repeat myself...
Cython is pretty damn fast anyways. You can use C++ and it is recommended if you are doing loads of MM shit, but the alpha strat using LOs works fine in Cython and doesn't need too much low-latency. The HFT book in the roadmap is great for getting to know exchanges.
-fini
• • •
Missing some Tweet in this thread? You can try to
force a refresh
A thread on all the components of latency, optimizations, & assumptions with modelling it.
...
This will primarily be for HFT, and focus on digital assets, but I will explain which parts are digital assets specific and which parts are not as much of it is generally applicable.
...
So what are the 3 "components" to our latency:
1. Our compute 2. The network 3. The matching engine
It’s the gains in performance you accumulate over time from tuning your strategy and improving it.
…
When it comes to non-HFT, accumulated improvement often leads to overfitting.
Continuing to tune the model once created often leads to decreases in performance other than simple re-fitting of the model on new data that has come out.
Let’s say a new trade has occurred on an exchange, if we have a latency edge we want to be one of the people incorporating it into price instead of one of the people reacting to price changes.
…
As we can see based on this below Pepe, a trade will cause an initial spike before a much slower levelling off.
Where it levels off to (relative to starting point) is going to be important to know as well as both the spike up and return points.
Fill probability analysis is primarily useful when optimizing maker/taker trades.
These are trades where the first leg we make into and then the rest of the legs are takers.
This is a limit order and then market orders the rest of the way (either limit IOC or market)
...
An example of this is triangular arbitrage, where we make into the first leg and then use taker orders to exit.
How can we estimate the probability of getting filled at any given level, and thus use this information to determine the optimal amount of spread to quote?
What is a mark? Well a mark is how we value something.
We can mark to model (our own subjective value of what something is worth), or mark to market (the current price), or mark to cost to close (market price with liquidity cost factored).
…
That’s mostly accounting systems though. Let’s talk about the relevant part for market making.