Knight Capital Failure Due to Development Bug

Learn how a trading firm lost $440 million in 45 minutes due to a software bug.

On 1st August 2012, a trading firm that goes by the name of Knight Capital lost $440 million due to what they refer to as a "trading glitch." The example of Knight Capital is of particular interest because it took the company 17 years of hard work to build itself, but it went almost bankrupt in roughly 45 minutes. A simple software update caused Knight Capital to lose 75%“Knight Capital Group.” Wikipedia. Wikimedia Foundation, November 18, 2022. https://en.wikipedia.org/wiki/Knight_Capital_Group. of its value in merely 48 hoursWikipedia: https://en.wikipedia.org/wiki/Knight_Capital_Group.

Knight Capital had a rich API providing a variety of trading functionalities to its users. Unfortunately for Knight, it didn't last because of a major developmental bug. Let's see how this failure was caused by an update in the trading algorithm of Knight Capital.

How did it happen?

This section details the sequence of events that caused the failure:

  1. Knight's software development team wanted to update their trading execution system called Smart Market Access Routing System (SMARS) within a short span of one month to complete the development cycle.

  2. The development team had to deploy the updated trading algorithm to eight production servers containing outdated dead test codeA dead code refers to a piece of code that is no longer executed. Even if it is executed, it has no effect on the overall behavior of the application. from as far back as 2003. The dead test code was called Power Peg. It was previously used for quality assurance (QA) purposes, and it required a flag to be activated. Knight repurposed the activation flag used for Power Peg to execute the SMARS updated code.

  3. The deployment team forgot to update the trading algorithm in one of the eight production servers. At the same time, the repurposed flag was activated for all production servers.

  4. This resulted in activating the flag for the execution of Power Peg on one of the eight production servers. Power Peg was a test code that placed orders that bought stocks for higher prices and sold them for lower prices. This caused disastrous losses for the trading firm.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.