Quantitative trading of stocks, options and futures using Matlab

Menu

Bitfinex: cascading margin calls resulting in flash crash

Today Bitcoin prices took a dive as margin traders on one of the largest exchange Bitfinex got their orders liquidated. For many close market observers and more sophisticated traders this did not come as a surprise. In fact, long positions have been building up continuously over the last couple of months in anticipation of a new bubble in Bitcoin prices and reached as high as $30m in outstanding swap positions on Bitfinex.

Now, this wouldn’t be a problem all by itself as long as there is enough capital backing the loan. Unfortunately, most of those long positions were entered around 600 – 640 USD/BTC and the collateral was mostly provided in Bitcoins itself. The following chart nicely shows the buildup of long positions, peaking around July 14 with close to $32m in swaps.

Running some quick math based on the maintenance margin of Bitfinex of 13% and assuming Bitcoin as collateral we find that margin calls should start around the 520 – 540 USD/BTC mark. Yesterday, prices came close and today they finally jumped over the cliff.

The problem is that once margin calls set in you have a cascading effect which rips through the order book, causing even more orders to reach the point of no return and increasing the downward momentum further. These kind of events are not limited to Bitcoin exchanges but can also occur on major exchanges such as during the 2010 flash crash in the US. The cause of such a flash crashe can vary and goes from fat finger mistakes to programming errors to cascading margin calls.

It is interesting to see how the exchanges deal with these events. In the US, Nasdaq implemented market wide circuit breakers which will cause trading to stop under such extreme circumstances.
Bitcoin markets are not yet as advanced and usually continue trading. If we look at the order action on Bitfinex today we see something very peculiar:

It seems (and this is just a guess as there is no official comment from the exchange) as if Bitfinex is running an algorithm to handle the margin calls. The algorithm starts selling but limits itself to a 10% drop in prices within 1 minute. If prices drop more than 10% in 1 minute it will stop selling and wait for buy orders to come in. Once there are again a certain amount of buy orders in the orderbook the algorithm starts selling again until all margin calls are met.
Edit: LeMogawai was the first to point this out in this post and it matches my personal observation at the time of the event.

This seems to be an interesting way to deal with cascading margin calls but can also be considered as borderline market manipulation from the exchange side. By spreading out the sell orders over time the downwards momentum is reduced, however traders end up trading against the exchange itself and not the market anymore. The exchange has an informational advantage at that point and is therefore more likely to profit than the traders. Fortunately, this only lasted for about 10 minutes after which control was given back to the market.

Other exchanges which also offer margin trading such as BTC-e and OKcoin are now in a favorable position and can learn from todays events. Implementing a system more closely resembling the circuit breakers of big exchanges such as Nasdaq might be a smart first move.