That was one expensive bug.

Knight Capital Group installed a new version of its algorithmic trading software which started aggressively buying up shares of 140 companies on the New York Stock Exchange not long after the markets opened on Wednesday.

"Wizzard Software, for example, shot above $14 after closing the night before at $3.50. Abercrombie & Fitch jumped 9 percent within minutes, hitting $36.75 after closing the night before at $33.80. Harley-Davidson suddenly fell 12 percent, to $37.84 from $43.23."

The sudden swings in stock prices and surging trading volume disrupted the stock markets before Knight noticed the problem and shut down its software after just 45 minutes.

After the dust settled, Knight's automatic trader had lost $400 million — almost $10M a minute. To make matters worse, it's own stock's value has collapsed, losing three-quarters of its value, putting the company at risk as it seeks financing or a new owner.

Knight's bad day is a symptom of a larger problem in our financial systems and, perhaps, in a complex society in which automated systems play key roles.

"For investors, it was the latest breakdown in the increasingly complicated electronic systems that run stock trading. Those systems have been showing signs of strain as more traders and big investment firms use powerful computers to carry out trades in mere fractions of a second. These trading issues have become so problematic and frequent that many experts believe they have shaken investors' faith in markets, especially after the deep losses they suffered during the financial crisis and the recession that followed. As a result, many small investors have been fleeing the stock market."

This week's fiasco is the the third stock trading debacle in the last five months. Such problems present us with new challenges in understanding how we can build automated software systems that can perform important and consequential actions safely.  This will require advances in software engineering, artificial ingelligence, and distributed systems as well as ensuring that computing practitioners understand and employ best practices in building software systems.