Better Safe Than Sorry

Crypto Chassis
Open Crypto Trading Initiative
3 min readNov 14, 2022
Photo by Tom Pumford on Unsplash

Greetings, Ladies and Gentlemen! The digital asset industry is having an unprecedented tsunami for obvious reasons. The sudden collapse of FTX underlines how important it is for any investor to learn about the risks they might be taking from all angles. As an old Chinese proverb echoes: be prepared for danger in times of peace. Truly. Whether you use ccxt, or ccapi, or your in-house infrastructure, there are a lot more to code and build into a trading system when it comes to risk management. As a technology provider, our production account on FTX was a skinny $20K, too skinny to be compared to any hedge funds. Yet, we would like to share the story about the last 24 hours of its life and highlight what we did well and what we didn’t.

The strategy that our system has been stably running is the so-called atomic arbitrage. In one of our previous articles entitled “Atomic Arbitrage: A Quantitative Study”, we provided the details. Atomic arbitrage benefits from and takes advantage of market volatility. High market volatility translates into more order fills and higher PnL, thanks to the deterministic nature of the strategy. Around Nov. 9th, 2022, during the last 24 hours of our production trading system’s operational time on FTX, our system enjoyed a PnL of ~95 bps on its total account value. Then at its routine periodic checks, the system found the black swan: it calculated the average deviation of the perpetual contract prices from the underlying spot prices and found that the deviation was insanely large. Remember that the fundamental assumption behind the atomic arbitrage strategy is that the two instruments involved (in this case perpetual contract and spot) must be equivalent to each other and hedge against each other, i.e. their prices follow each other. When this fundamental assumption was detected to be no longer true, our system triggered its kill switch: cancel all open orders, close all open positions, i.e. unwind everything to pure USD. We even coded it to shut down the AWS EC2 machine as an extra precaution. This is the part that we did well. The system didn’t make judgement purely based on PnL (in fact, the last 24 hours of its life had the best PnL in its whole life). It checked the fundamentals behind the strategy and made a correct decision to kill the program and unwind everything. However, what we did not do well was to appoint an on-call human being to receive an alert when the system turned on the kill switch and immediately investigate what the root cause was and realize that FTX was melting down and funds needed to be immediately withdrawn.

That’s it. For a trading firm with a large amount of capital, there are so many risks that need to be double and triple checked. Although those most risky factors happen the least frequently, yet whey they do happen, the consequences are devastating. Does a perpetual contract’s price still follow its underlying spot’s price? Is USDT still closely pegged to USD? Does the exchange have an unscheduled downtime that leaves my positions open for an extended period of time? … We try to be as careful as possible. How about you? If you are interested in our work or collaborating with us, join us on Discord: https://discord.gg/b5EKcp9s8T and find us on Github: https://github.com/crypto-chassis/ccapi 🎉. We specialize in market data collection, high speed trading system, infrastructure optimization, and proprietary market making.

Disclaimer: This is an educational article rather than investment/financial advice.

--

--