My last thread on market making concluded that managing inventory risk is key to staying in the MM business
This one’s dives into exactly what that means, and I’ll walk through a cheeky math model for how to do it as a full automated / algorithmic trader
Kinda interesting how 2 of the top HFs ever, Citadel and Renaissance, are known for polar opposite cultures. Citadel being this cutthroat corporate revolving door vs. Renaissance being a chill academic vibe that nobody ever leaves. And don’t get me started on Bridgewater
My favorite type of market participants to date are tradfi L/S equity type dudes who came in, spread some comps and ran a DCF on like PissAssCoin and are down 98% on spot
To round out the trilogy, I figured I'd write a third and final thread with some more qualitative insights and thoughts on market making and profitable liquidity provision
No math this time, but lots of important concepts to understand in practice
Getting started as a quant is about putting down the fucking research papers and immersing yourself in as much real market data as possible
Papers are stale & noisy; reading doesn't get you paid
All you need to know is how to iteratively follow a data-driven scientific method
gm crypto twitter
thought I'd kick things off by dropping some knowledge on electronic market making
a thread on how institutions are built by programming computers to buy low sell high
Love playing chess, make an absolutely redacted move, and watching my opponent hesitate on the obvious response because they can’t tell if it was a mistake or I’m actually seeing 5 steps into the future
A useful thing that market making taught me about life is that there’s more value in knowing what could happen and reacting fast when it does than the fool’s game of trying to predict everything everywhere all at once
Let’s say you had to pick 1 book to take a good mathematican who knows nothing about markets and give them the minimum viable knowledge to do quant research
What book would you pick?
Sorry this thread was a billion tweets long, I feel like a VC influencooor
Hope it was a helpful starting point and at least kinda understandable
MM is a pretty complex game and this is one of the harder parts of it
Crypto as a whole widely touts the arrival of “institutions” as a bull case when in reality the arrival of retail en masse has driven more absurdly bullish price action than any institution ever could
Maybe I’m old school, but a lot of things about SBF made me implicitly dislike him
Treats his physical health like shit, talks way too fast, talks to people like they’re 4 years old, uses philanthropy to justify absurd greed, promotes the cringiest everyman image I’ve ever seen
Need 3 things for market making:
1. Good sense of fair value
-> Picking up the pennies
2. Good sense of counterparty’s informedness
-> Knowing when to dodge the steamroller
3. Low-latency system
-> Knowing how to dodge it fast
Add a sprinkle of risk mgmt and that’s it
A few preliminaries
you should know market structure & terminology basics if you don’t already (e.g. order types, LOBs, spreads), this is a good intro,
you should read the original thread first, this one is more advanced,
gm crypto twitter
thought I'd kick things off by dropping some knowledge on electronic market making
a thread on how institutions are built by programming computers to buy low sell high
One of the simplest fair price “forecasts” is to use the most dominant exchange/mkt by volume and quote around it everywhere else
There will be a lead-lag effect where info from Big Venue is ahead of Small Venue and it’s your job as market efficiency plumber to bring it there
The line between quant and discretionary trading isn't as firm as beginners often think
Trading is *always* discretionary, a quant only uses more stats to aid their judgment
Referring to quant as "systematic" trading is truer to practice in my experience
The model here is from the paper “HFT in a limit order book” by Avellaneda & Stoikov. The derivation is non-trivial so I’ll focus on the motivation and results here
many think that making good decisions with poor information is a sign of intelligence, but it’s mostly luck
the smartest people are mostly focused on finding ways to get more information until the move is clear
nothing is truly hard or stressful when you’re well informed
@quantymacro
Once in an interview they told me: "make a market on the number of companies in the S&P 500"
I replied fast: "69 @ 420, 7 up"
Everybody clapped and now I get to personally click the "liquidate retail" button at CitSec when Ken tells me to
the model part is where it gets harder
if this gets any interest I'll follow up with an ELI5 thread on the math behind a classical model from academia (Avellaneda & Stoikov)
it isn't the full picture, but it's definitely a strong starting point to being profitable as a MM
Future things to consider if you really wanna print money:
- how you define the fair value of an asset (is the mid-price really good or is it unreliable sometimes?)
- how do tick sizes and exchange rules affect your strategies?
- how do you incorporate alpha into your pricing?
if you (yes you, anon) wanted to do this for yourself, the minimum you'd need is a model for managing inventory risk and software to place LOs orders for you on an exchange according to your strategy
for software BitMEX has a good starting point:
A few ways:
(1) Resize your hedge with a market order on B
(2) Widen your quotes to adjust for uncertainty
(3) Skew your quotes based on your delta
(4) Skew your quotes based on alpha signals
Let's start with some motivation
Consider a pawn shop
When a customer arrives wanting to sell, you do a few things:
(1) Value their stuff best you can
(2) Offer to buy it below your valuation
(3) If they accept, store it until you can flip it for more than you paid for it
A&S defines the indifference price as
r(s,q,t) = s – q * gamma * sigma^2 * (T – t)
where:
s = mid-price
q = inventory
gamma = risk-aversion param
sigma = volatility
T = end time
t = current time
Every MM and their mother knows this paper so there’s no unique alpha here, *but* it is the foundation of many models and you should know it too
And ofc none of this financial advice, just theoretical quanty shit
can someone explain why I keep seeing PFOF presented as "front-running" ? I'm legit confused
don't the trades print to the tape in order like any other market? I always thought the benefit to MMs was just retail flow is as noisy / low toxicity as it gets
Let me be blunt. Those who are afraid of AI feel deep down that they are impostors & have no edge. If you have a 1) clear mind, 2) a deep, not just cosmetic, undertanding of your specialty, 3) and/or are original enough to reinvent yourself when needed, AI will be your friend.
Principally, the risks are:
(1) bad valuations make you trade at bad prices
(2) you buy something but can't find anyone to sell it to
(3) price moves adversely b/w the time you buy and sell
(4) you bought too much and run out of cash until you sell some
1/ Building a crypto HFT system is a challenging and rewarding journey.
A mega-thread covering:
Trading strategies ("what")
The infrastructure and latency optimization ("how")
Exchange selection ("where")
Market dynamics ("who")
What I wish I knew when getting started 🧵
advice to young people: put a satellite dish on the roof of your dorm room to get real time stock quotes
this will give you real time stock quotes and also an inspiring narrative to raise billions in capital on for the next 20 years
imagine feeling like a good trader and someone shows you a backtest of a bot that trades off your timeline and massively underperforms
feels very bridgewater-esque
are you signal or noise anon?
all alpha is contrarianism
but all contrarianism is definitely not alpha
be mindful of when something different is actually better for you vs. just different
The elites won't tell you this but you should use 100x lev on all LOs for a MM strategy. If you know you're holding it for 30 secs and max DD per position is 50 bps nothing can actually go wrong
if you listen to
@SBF_FTX
interviews, the guy clearly first became a multimillionaire through the repeated application of that mindset + common sense, and I really believe almost anyone can do this
That’s roughly the MM business
Your store is your portfolio and the inventory you keep in it is financial assets, I like this comparison because it makes the term inventory risk clearer
If you’re running a business like this what are your major risks?
what the fuck is an indifference price
I’m glad you asked
it’s the price at which you’d be indifferent to buying/selling one more unit of the asset you’re trading
in simplest terms, it answers “how cheap would I need to this thing to be to reasonably buy more of it?”
How do you quantify uncertainty in the future value of the asset?
You should’ve said volatility (i.e. variance of returns over a lagging period)
The takeaway is that to implement (2), our MM model should widen its pricing when volatility is high
My take on the morning routine discourse, which is an asinine discourse with good intentions, is the following is optimal:
1) 2 mins cold-ish shower (~6/10 cold)
2) Brush teeth, dress well
3) 10 mins sunlight (walk to office or deli)
Total: 30 minutes and 0 dollars
Recently been thinking of building something combining advanced market analytics with a low-friction alpha research workflow
The goal being to provide the same type of tooling that quant prop firms could build internally to a broader audience of traders w/o software skills
this is formally known as adverse selection + inventory risk
adverse selection = your counterparty is informed and you're def on the wrong side of the trade
inventory risk = your book is skewed long/short due to an imbalance in buyers/sellers (you'd like to be delta neutral)
Sanity check - why do we do this? Because trading happens both ways, and to sell something you must own it. Hedging like this lets you own it without assuming market risk
Now you only care about diff b/w the position on A and B (delta), which varies as your orders fill on A
the cost of taking risks is potentially losing your capital
the cost of not taking them is dying with regrets
if you were on your deathbed, how much would you pay to get rid of all those regrets?
It’s purely reactive, not predictive
If you have alpha signals, you could incorporate those into the MM model as well to position yourself more favorably for the future state of the market, but this is obvious
This can greatly help to reduce adverse selection but is hard
This is attractive if your delta is too negative - the asymmetry adjusts the probability of getting fills in the direction you want
Important to emphasize this skew isn't based on future predictions, it’s only adjusting pricing based on the current state of *your* portfolio
A&S specifically defines the value function
u(s,x,q,t) = max E [ -exp(-gamma (X_t + q_T S_T)) ]
where:
max is over delta(a), delta(b)
E = expected value
X_t = cash
q_t = inventory
S_t = mid-price
(X, q, s are all stochastic)
Based on the previous equations, A&S models lambda(delta) ~ A exp(-k delta)
where
A = frequency of MOs
k = alpha * K
K = proportionality constant
You’d typically do a regression against market data to get at a good value of K, but I’ve said enough for now
I tend not to trust engineers who dress or present themselves poorly, because good engineering and systems design is a fundamentally creative, opinionated, and aesthetic process - it cannot be done well by someone lacking basic aesthetic sensibilities
For (2)
Suppose XYZ has a mid-price of $100, what’s the difference between quoting $99 @ $101 vs. $95 @ $105?
Namely the tradeoff is high volume + low margins vs. low volume + high margins
The latter also gives you more room for uncertainty in the future value of the asset
Adjusting your hedge is the easiest way, but it’s relatively expensive
You gotta pay taker fees and cross the spread on B, hedging can eat into margins p badly
We should focus more on techniques 2-4 instead to make more money
If your buys/sells are filled evenly, your delta stays close to zero, but if flow is very one-sided, you could get into trouble if you don’t adapt
How do you adapt to one-sided flow?
Been writing Python for like 8 years and I still don't really understand how the import system works
Idk why but it's like the quant dev equivalent of centering a div
so how do you fix this?
there are roughly two ways
(1) you can try to predict the direction of the market over short time frames and trade with it
(2) you can adjust your quotes dynamically to manage your inventory, keeping your market risk low while capturing spreads
Finally let’s talk about modeling order flow
Specifically, we’d consider the frequency, size distribution, and impact of market orders on price
Let’s say frequency is constant, like total volume / avg. size of order
The greatest achievements in my life have not come from the pursuit of greatness so much as the avoidance of boredom. For me it doesn’t seem to work any other way
If q > 0, r < s indicating a desire to sell, and vice-versa with q < 0 indicating a desire to buy
If sigma >> 1, volatility is high and your pricing is further from mid-price
That captures the basics of what we want already
and if it starts mooning, you're gonna be selling right when you'd make more money holding
basically with every trade you get filled, there's a decent chance you're gonna be on the wrong side of it
the old saying: "I don't wanna be in any club that'll have me as a member"
This is why you might hear people saying that modern MM is more like cheap alpha execution rather than true liquidity provision
The spreads help you break-even while the directional bets from your alpha generates the real PnL
A keen, thesis-driven investor might note that the catalysts of this crash - a hedge fund and a centralized lending platform blowing up - have absolutely no bearing on the fundamental value or usage of the Ethereum blockchain
so that's the basic game we're playing as a MM: manage inventory risk so we can stay in business
it's a lot like selling options or insurance - you make small premiums (spreads) most of the time and occasionally lose big on tail risk events
in earnest, I've been on a hiatus from trading for the last 6 months, having shut off my bots back in june consumed by feelings of tiredness and uncertainty
@CL207
The loss I can live with, it’s what it is. But what really really annoys me is how I could misread the situation so badly and get fucked myself. And that’s despite seeing all the sketchy shit on chain. Never trusting any crypto company again
Let’s say XYZ/USDT trades on exchanges A and B and you wanna make a market in it on A
You go long $100k XYZ on A and short $100k XZY on B at the start of the trading day, now you have a delta-neutral position on A to use for use for providing liquidity
hodl is massive psyops for the majority of coins
a bag of rocks doesn’t get any heavier if you hold it for 10 hours vs. 10 mins, your arms just get weaker
In A&S, the params you have control over are gamma (personal risk-aversion), k, and T (end-time)
With those you can compute the reservation price, the optimal spreads to quote around it, and begin market making with some inventory control
if you have direct market access, you can code a bot to post LOs for you and effectively be a MM
and in crypto, all exchanges have free APIs so there are really no (financial) barriers to entry
so a question: what stops just anyone from doing this and printing infinite money?
also note that if you're familiar with AMMs, what I'm talking about is the same concept as impermanent loss
generally the rewards have to be super high to compensate LPs for the IL, which is always bound to happen over enough time (excluding like stablecoin pools)