Providers of liquidity, or market makers, provide an essential service to any tradable market. They ensure that there is always a buy (bid) price and sell (ask or offer) price. This allows traders to enter and exit a market at any time.
If Bitcoin and the digital currency trading industry are to grow, exchanges will need more and more market makers to provide additional liquidity. There are many traders who have graduated from purely directional trading, to providing liquidity on various spot markets. This series of lessons is meant to give traders a basic understanding of how to market make digital currency derivatives.
Lesson 1 will focus on how to quote a two-way price, a simple dynamic hedging strategy, and settlement. In order to keep the math simple, we will use an 7-day expiring Ethereum Classic / Bitcoin futures contract, ETC7D.
Contract Details:
Contract Value: 1 ETC
Underlying: Poloniex ETC/XBT exchange rate
Settlement: 30-minute Time Weighted Average Price (TWAP) Friday 12:00 UTC
How to Calculate Bid / Ask Quotes
A futures contract derives its value from the underlying asset. For ETC7D, the underlying asset is the Poloniex ETC/XBT exchange rate.
Your trading program needs a live feed of the bid, ask, and last price of ETC/XBT on Poloniex. For starters, I advise you to calculate the mid price (average of bid and ask). As a market maker, you will hold futures contracts until settlement. Because a futures contract will equal spot at settlement, we can value ETC7D by the following formula:
ETC7D Quote Mid = ETC/XBT Mid Price (Spot) + Basis or Skew
After calculating your ETC7D Quote Mid, you will apply your spread. We will discuss how to calculate a Basis or Skew in Lesson 2.
As a market maker your spread compensates you for hedging costs (trading commissions, and bid / ask spread) on the underlying exchange, and the volatility of the underlying asset.
I will ignore the volatility component for now.
Spread = Spot Trading Fees + Spot Bid / Ask Spread + Market Maker Profit
The Market Maker Profit is how much you would like to earn on every trade.
Example:
Spot = 0.02 XBT
Basis or Skew = 0 XBT
Spot Trading Fees = 0%
Spot Bid / Ask Spread = 0%
Spread = 1.00%
ETC7D Quote Mid = 0.02 XBT
ETC7D Quote Bid = 0.02 XBT * 0.995 = 0.0199 XBT
ETC7D Quote Ask = 0.02 XBT * 1.005 = 0.0201 XBT
These quotes will be calculated then sent to BitMEX.
Simple Dynamic Hedging
Your goal as a market maker is to be market neutral. As other traders hit your bids and lift your asks, you must hedge yourself in the spot market.
Since each ETC7D contract represents 1 ETC, if you sell 1 ETC7D contract, you must buy 1 ETC. If you buy 1 ETC7D contract you must long sell or short 1 ETC.
A trader buys 300 ETC7D contracts at 0.0201 XBT from you. You are now short 300 ETC. Your trading program will automatically buy 300 ETC/XBT on Poloniex for 0.02 XBT.
Symbol | Position | Trade Price | XBT Value |
ETC7D | -300 | 0.0201 XBT | -6.0300 XBT |
ETC/XBT | +300 | 0.0200 XBT | +6.0000 XBT |
Unrealised Profit | +0.03 XBT |
You now have 0 ETC exposure. Because you have sold ETC7D at a greater price than where you bought ETC spot, you have an unrealised profit of 0.03 XBT.
You are still quoting a two-way market of 0.0199 XBT / 0.0201 XBT for 300 contracts each side. A new trader decides to sell 300 contracts at your Bid price of 0.0199 XBT. Your ETC7D position is flat (you sold 300 ETC7D previously, and now you just bought 300 ETC7D), and you are long 300 ETC/XBT; your net exposure is long 300 ETC. Your trading program long sells 300 ETC/XBT at 0.02 XBT.
Symbol | Position | Trade Price | XBT Value |
ETC7D | -300 | 0.0201 XBT | -6.0300 XBT |
ETC/XBT | +300 | 0.0200 XBT | +6.0000 XBT |
ETC7D | +300 | 0.0199 XBT | +5.9700 XBT |
ETC/XBT | -300 | 0.0200 XBT | -6.0000 XBT |
Realised Profit | +0.06 XBT |
Your portfolio is flat. You have realised a profit of 0.06 XBT or 1% of the value of your quotes. That 1% equates to the spread you built into your Bid and Ask quotes.
This is the simplest form of market making. You take the underlying spot price, apply a spread, and dynamically hedge 1:1 whenever anyone trades on your quotes.
Settlement
If you hold a futures contract over settlement, it will expire and leave you with no exposure.
Your Portfolio:
Symbol | Position | Trade Price | XBT Value |
ETC7D | -300 | 0.0201 XBT | -6.0300 XBT |
ETC/XBT | +300 | 0.0200 XBT | +6.0000 XBT |
Unrealised Profit | +0.03 XBT |
If you do nothing, on Friday 12:00 UTC your ETC7D position will go to 0, and you will be left long 300 ETC/XBT. Your goal is to be market neutral, so during the settlement calculation period you need to reduce your spot hedge to 0.
ETC7D expires based on a 30-minute TWAP. BitMEX will take the spot prices on Poloniex each minute and compute an average, which then becomes the settlement price. To capture the unrealised profit of 0.03 XBT, you to sell ETC/XBT at the ETC7D settlement price.
Your trading program will split your spot hedge into 30 slices, or 10 ETC. Each minute you will sell 10 ETC at market to match the price used in the settlement calculation. Because the settlement calculation uses the last price each minute, you theoretically will match the settlement price.
Any difference between your sell trade executions and the prices used in the settlement calculation is called Slippage. In this example, if your Slippage is more than 0.50%, you will lose money. If you have 0% of Slippage you will earn the full unrealised profit.
In Lesson 2, I will explain how to calculate a Basis and Skew. These two variables tie in closely with inventory management.
If you wish to begin market making on BitMEX, please take a look at our sample market making bot on Github.