https://miro.medium.com/max/1400/0*2arApVA3c-sEuK3E

Photo by Keith Johnston on Unsplash

Greetings! In a previous article entitled “Simplified Avellaneda-Stoikov Market Making” we discussed how to use such a strategy to manage and control a portfolio’s inventory risk. Avellaneda & Stoikov taught us that we should adjust our bid/ask prices in order to hedge against inventory risk, and the amount to be adjusted should be linearly proportional to the one-side inventory excess. For small market swings this is a decent weapon for ourselves to be protected from running out of inventory (on one side). However, crypto markets are famous for its extreme volatility and seem to be constantly manipulated by the hands of some invisible devils. When markets make large trending movements, simple market makers are very susceptible to something called “adverse selection” and can quickly become unfortunate victims due to attacks by sophisticated traders (who are called “informed traders”). Avellaneda & Stoikov only provide very limited protections under these circumstances (see analysis below). In this article, we will have an in-depth discussion on the subject of how to proactively defend ourselves against informed traders and market manipulators.

First let us take a step back to review what a market maker’s responsibilities are. Surprising or not, this is important. Quoted from Investopedia:

A market maker participates in the securities market by providing trading services for investors and boosting liquidity in the market. They specifically provide bids and offers for a particular security in addition to its market size. Market makers typically work for large brokerage houses that profit off of the difference between the bid and ask spread.

In short, market makers are responsible for liquidity provisioning, in the presence as well as in the absence of informed traders. In particular it means that if we are contracted as liquidity provider for a given exchange or a given token, we’ve agreed to constantly provide quotes on the market whether we are being adversely selected by informed traders or not (although the definition of constantly can be tricky). What should we do under such a circumstance? If we aren’t contracted to fulfill such duties but participate in free-will market making, what should we do when being attacked by informed traders? In either case we genuinely think that we need to at least temporarily stop quoting on the market. Through simple backtest experiments, we can easily see that adverse selection can in fact drain our account at astonishingly fast speed. Without any defense, it is somewhat equivalent to suicide. Even if we, as market makers, have hard contracted responsibilities (with an exchange or a token project) to provide liquidity under all circumstances, we also have the fundamental rights to at least stay alive and survive from harsh conditions. Draining an account just to constantly provide liquidity isn’t a sustainable solution. So what’s next?

Let us take a look at Avellaneda & Stoikov’s strategy: does it add adequate protection to us from adverse selection? A little bit but not enough. There are three outcomes after we place our orders using such a strategy. A. If both the bid and the ask orders get filled, we’ve been successfully “selected” on both sides and prevented our inventory from drifting further away from its neutral position. That’s cool. B. If the undesired side of the orders gets filled, needless to say that we are under more attacks. That’s not cool. C. If the desired side of the orders gets filled, the inventory is back to its neutral position. Depending on the fill prices relative to those when the inventory initially drifted away from its neutral position, we could have netted a gain or we could have incurred a loss. Unfortunately based on analytics it is more likely to be a loss for us and a gain for the informed traders: i.e. we first bought high and then sold low or we first sold low and then bought high. That’s not cool. As we can see that the protection that Avellaneda & Stoikov’s strategy offers to us against adverse selection is reactive, i.e. after the damage already happened it tries to heal the wound. So what’s next?

We genuinely think that proactive defense using technical indicators is the solution to the problem. To be precise, we’d add a layer of logical guards before placing orders such that the intelligent analytics coming out of these guards will decide whether we should proceed to placing orders at all and if so at what prices and quantities with a good balance between liquidity provisioning and account sustainability. And this is exactly what we’ve worked on in the past several weeks. In the latest release of our spot market making application, we’ve added a plethora of advanced trading parameters for end users to configure and most of these are related to technical indicators. For example, a simple and familiar one is the Price of Change Indicator. A less familiar one is the Roll Coefficient. Let us look at a vivid example to see what can be achieved by using these indicators, all in the context of high frequency market making. In the first plot shown below, you are a dutiful market maker and you constantly place bid orders right below the mid price and ask orders right above the mid price. In a single typical day your account balance will evolve like this:

https://miro.medium.com/max/1280/1*CRxr27wbZehZWK0bXTmS-w.png

Naive market making on Kucoin BTC/USDT on 2021–08–09.

The red curve represents the quote balance and the green curve represents the base balance. Notice how vulnerable this account is: large swings back and forth between being dumped with excessive amount of base assets when base assets are less desired and being dumped with excessive amount of quote assets when quote assets are less desired. That’s not cool.

Now let us add an ROC indicator: if the magnitude of the ROC value is above certain threshold, then we temporarily stop placing orders to minimize the risks of getting adversely selected by informed traders. In the same single typical day your account balance will evolve like this:

https://miro.medium.com/max/1280/1*-VLhOH3j7DtQn7vqpTrpzw.png

Intelligent market making on Kucoin BTC/USDT on 2021–08–09.

Much steadier. Did you notice that in the intelligent market making plot the quote balance and base balance (i.e. red curve and green curve) have small segments of horizontal lines. Those are the visual manifestations of our weapons: we stopped quoting during those periods of time upon detection of adverse selection. And shortly after, we resumed normal quoting activities when the market turbulence subsided. That’s cool.