This is the first in MKTSTK’s HFT War Stories series. Submitted anonymously by a high frequency trader. Names of people, places, and products have been omitted:
Algo trading has a way of making your hair turn white. Sometimes it’s the wild market action. The response then is to cut risk and keep on trading. The big losses come from avoidable human errors. Those are the losses you might not come back from.
The trading world is increasingly automated. Every year there are fewer human eyes watching the market at any given time. Traders employ algorithms to cut latency and market impact. Dealers find automation indispensable in quoting thousands of different exchange traded derivatives.
If your automation is coded correctly most of the time it saves your ass. Risk management algorithms run on top of trading strategies and monitor underlying markets for signs of trouble — backing your quotes off if necessary. I have been saved by automation on numerous occasions, side-stepping big market moves and allowing me to keep trading when others ran to the sidelines.
When your automation goes haywire, however, that’s when you experience fear and anger in equal, blood-curdling, measures. Usually it’s not an obvious case of turning the strategy on and watching it go crazy, a la Knight Capital. The worst errors are subtle, they lurk in the corners of your strategy’s logic. They could be caused by code you did not write, living in lower level code that interacts directly with the market.
I discovered this risk first hand one day right before the markets closed. I was working with a new tool our developers had created to cut latency. Certain parts of the strategy which had existed within my code should have now been handled by lower level code written by developers. The changes had passed QA testing and were mission ready as far as I knew.
I had been testing this tool out on an obscure exchange listed derivative. Purchasing the contract bought a combination of separate contracts. The tool handled things fine for a week an a half. Then one day I went to turn it off and the strategy went insane, purchasing nearly two billion dollars worth of illiquid derivatives in literally the blink of an eye.
The risk limits I had coded at my level of code were worthless; the strategy launched so many orders at the market in such rapid succession that its PnL and position were not delivered to my strategy logic fast enough to catch. I had hard-coded a maximum of $80 million in risk before the strategy was supposed to kill itself.
HFT has a tendency to put you in these types of situations more often than not. You feel that visceral shot of adrenaline course through your veins. You perceive time, light, and sound as though in a tunnel. Panic must be suppressed, if only long enough to get hedged.
After fear comes anger. WHO THE FUCK DO I KILL? This emotion must be buried. If it isn’t I will lose my job and lifestyle — I might get combination sued by the government whilst given up as bait by my firm to regulators. All for code I did not fucking write, mind you.
Shit, now it was time to get the fuck out of my unwanted $2 billion position. Selling out directly was not possible: the market is too illiquid to reabsorb my gigantic inventory at this time of day. It’s a miracle I didn’t get worse prices. The only answer was to hedge it quickly into a more liquid market that was still open. No time to negotiate on price, I took a similarly large offsetting position in a product that I hoped would hedge me long enough to liquidate.
Now here is where shit got really fun. The product I hedged into was correlated to my unwanted position, but it certainly wasn’t a perfect hedge. This was around one of the debt ceiling farces, so I was shitting myself watching the news for someone from the government to inadvertently fuck me in the ass by causing my hedge to perform badly.
Now that the market was closed I was able to track down the developer who had coded the tool that went haywire. After talking it out and then checking his code, the problem was caused by a change he made yesterday. Because the contract was a combination of other contracts, it didn’t handle getting flat correctly. It kept buying contracts to get flat, not recognizing each fill using the correct multiplier. Thus it kept shoveling bigger orders into the market thinking it was closing out a position. In fact it was in an infinite loop, acquiring contracts until a risk check had a chance to kill it.
In the end, the code was fixed by correcting a minus sign. Me and my junior traders worked out of the position slowly over the course of the next day and only ended up losing around $40,000. HFT being HFT, we didn’t even lose money that day. Even so, it could have been a complete disaster. Every time I turn off a strategy I still get that feeling I am about to get fucked.
To send your own HFT War Story to MKTSTK, email firstname.lastname@example.org, please include “War Story” in the subject
Categories: High Frequency Trading