burneh
Trading

Rent out liquidity, and manage what you're left holding.

A market maker doesn't bet on direction. It quotes a bid a touch low and an ask a touch high, earns the spread when both fill, and skews its quotes to work down whatever inventory it accumulates. The spread is the easy part. Managing inventory in a market that suddenly picks a direction is the whole job, and where we put the guards.

The quotes, in real code.

No black box. It rents out liquidity: post a bid a touch below fair value and an ask a touch above, then skew both against whatever inventory it's left holding. The cap and the vol pull are right there in the same file.

quoter.pypython
1# quoter.py — two-sided quotes that skew with inventory
2from burneh.mm import MarketMaker, Quote
3
4class InventoryQuoter(MarketMaker):
5 half = 0.03 # half-spread around fair value
6 skew_k = 0.006 # how hard to lean per lot held
7 cap = 8 # max net position before we quote one side
8
9 def quote(self, fair, inventory, vol):
10 # lean both quotes against the inventory we're holding
11 skew = self.skew_k * inventory
12 half = self.half * self.widen(vol) # widen when it's rough
13 bid = fair - half - skew
14 ask = fair + half - skew
15
16 # at the cap, only quote the side that reduces the position
17 if inventory >= self.cap: bid = None # stop buying
18 if inventory <= -self.cap: ask = None # stop selling
19 return Quote(bid, ask, self.size)
20
21 def on_shock(self, vol):
22 # a vol spike: pull the quotes rather than get run over
23 if vol > self.vol_max:
24 self.pull_all()
quoter · XYZ-PERP
quoting
ask · sell100.030
mid 100.000spread 0.060
bid · buy99.970
inventory+0.0 long

flat, quotes centered on mid

It skews with inventory.

Watch the inventory swing. As it leans long, both quotes drift down to sell it back off; as it leans short, both drift up. That skew, always working the position back toward flat, is the whole game, right up until the flow turns one-way.

The spread is easy. The inventory is the risk.

Switch the flow. Two-sided, the book earns its spread and stays near flat. One-way, the same book keeps buying a falling market, and the spread it earned is nothing next to the inventory it's stuck with.

fill tapemid 100.00
waiting for fills…
net inventory0 lots
spread captured
+$0
inventory P&L
+$0
net
+$0
two-sided flow · cycling the spread, drifting back toward flat

When price runs one way, the fills you get are the ones you don't want. The spread you earned is small; the inventory you're stuck with is not. No amount of clever quoting removes that, only the caps that make it survivable.

The guards keep inventory survivable.

Because the failure mode is accumulating into a move, the guards are all about knowing when to widen, when to stop quoting, and when to flatten and walk away.

Inventory cap

A hard limit on net position. Hit it, and the bot quotes only the side that reduces risk, exactly what you just watched.

Spread floor

It won't quote inside a spread too thin to cover fees and adverse selection. No quote beats a bad quote.

Volatility pull

When the market gaps or vol spikes, quotes widen or pull entirely rather than get run over.

Kill switch

An aggregate stop and a one-command halt that cancels every resting quote and flattens.

Market making earns a small edge many times, and it isn't a bet on where price goes.

The spread is real income, and in a balanced market it adds up. But the day the flow turns one-way, the fills you get are the ones you'd rather not have, and the inventory can dwarf a week of spread. We build the version that knows that from the start: it skews, it widens, it caps, and it walks away, instead of quoting into a move until it can't.

Rent out liquidity, and manage what you're left holding.

Two-sided quotes around fair value, inventory-aware skew, and honest about adverse selection, with the guards to widen, pull, or flatten.