On Friday, an initial public offering by Lenexa, Kansas-based exchange operator BATS Global Markets — which had taken more than a year of careful preparation — came undone within seconds. The question now is: When will BATS try again?

What should have been a triumphant moment for CEO Joe Ratterman, 45, quickly turned into a nightmare. At 10:45am, one of the Lenexa, Kanas-based exchange operator’s 32 matching engines encountered a glitch in the computer code related to the launch of trading in the company’s own stock, which had priced at $16.00 a share the day before, March 22. When the stock opened at $15.25 on March 23, BATS appeared to have started trading successfully. But the software bug immediately began to interfere with the exchange’s messaging system, preventing prices from being continuously updated — and wreaking havoc with BATS’ new issuance.

Unrelated stock symbols, from A through BFZZZ, were also affected. Apple’s stock, AAPL, was caught up in the confusion when a single trade for 100 shares on a BATS venue caused the price to drop more than 9 percent to $542.80, setting off a circuit breaker that suspended all trading in the stock nationwide for five minutes. Ratterman, who was watching the crisis unfold over the shoulders of his trade desk managers, was stunned. “I think a lot of stomachs sank,” he says. “I know mine did.”

Within ten seconds of detecting the problem,  BATS’ software engineers had sprung into action, Ratterman says, halting trading of BATS’ shares and scrambling to isolate the coding error in the system. But the damage was done. Although the team pinned down and patched the software glitch in two-and-a-half hours, company executives — who had initially announced that trading in BATS shares would resume at 1:15pm — decided to pull the IPO after consulting with its underwriters, led by Morgan Stanley. All erroneous trade executions for the day were broken. BATS’ IPO, which had been designed to put NYSE Euronext and Nasdaq OMX on notice that their powerful duopoly in company listings faced a new challenger, had failed.

Although BATS’ core trading business is unlikely to be affected by its botched IPO, its public market malfunction could not have come at a worse time given regulators’ heightened sensitivity to technical issues in electronic trading. No one has yet forgotten the carnage wrought by the “ flash crash” on May 6, 2010, which hewed nearly 1,000 points from the Dow Jones Industrial Average in minutes. Although the fallout from BATS’ coding error was well-contained, the inability of the company to identify the problem prior to inaugurating trading in its own shares — despite months of rigourous testing — may attract regulators’ interest. On the day itself, Ratterman says, his team reached out to the Securities and Exchange Commission within minutes to alert them to the fact that BATS was experiencing a technical issue affecting its primary market.

The irony of the BATS IPO debacle is that virtually all of the major exchanges in the U.S. and Europe occasionally suffer trading malfunctions and outages that inconvenience and irritate their customers, but very few ever gain as much public scrutiny. The last major high-profile crisis occurred just over a year ago, in February 2011, shortly after the London Stock Exchange Group migrated all of its equity trading onto a new software platform designed by its subsidiary, MillenniumIT. Barely two weeks later, the whole system crashed, suspending all trading on the LSE for nearly four hours.

 “Trading glitches aren’t that unusual — it is part of the way that the markets operate and there is no such thing as a foolproof system,” says Richard Perrott, a London-based analyst who covers diversified financials for Hamburg-based Berenberg Bank. “The incumbent exchanges don’t have 100 percent track records. BATS was unlucky to get hit on a day by a failure in its own stock, when the problems were extremely visible.”

BATS had willingly stepped into the spotlight. The company’s decision to list its shares on its own exchange was a gutsy move, intended to open a new frontier in the battle between a generation of fast, techno-centric exchange operators like BATS and older, more established incumbents, like NYSE Euronext and Nasdaq OMX. The team at BATS knew that they were making a high-profile public statement by designing and launching a listings service, which was a technical risk — none of them had run a listings service before. But moving into listings seemed like a natural next step for Ratterman and his team, who favor faster, cheaper, more efficient trading systems.  Company listings in the U.S., which remain firmly under the purview of NYSE Euronext and Nasdaq OMX, are still fee-rich services that have not seen much competition.

BATS traces its scrappy, competitive corporate ethos directly back to its founder and inaugural CEO, Dave Cummings, chairman of Kansas City, Missouri-based automated trading firm Tradebot Systems. Had BATS' IPO gone ahead, Cummings, who is a member of BATS’ board of directors, would have held 2.92 million shares through his wholly-owned investment vehicle Tradebot Ventures Fund — a stake that would have been worth a tidy $44.5 million at BATS’ opening auction price of $15.25 per share. (By comparison, Ratterman’s 405,962 shares would have been worth about $6.2 million.) The outspoken Cummings started the business in 2005 with 12 employees, including Ratterman, most of whom had come from his existing team at Tradebot. Frustrated by the pricing power of the dominant exchanges, Cummings set out to create a rival trading platform that could challenge the incumbents for market share by offering banks, broker-dealers and high-frequency trading firms lightning-quick, low-cost trade execution. Barely six months after the company’s founding, BATS launched its inaugural trading platform in January 2006.

Since its inception, BATS has grown rapidly. The company now operates two U.S. stock exchanges, its primary market BATS BZX Exchange and a secondary market, BATS BYX Exchange, as well as an equity options market, BATS Options. In the U.S., BATS has won combined market share of 11 percent in domestic equities based on February’s monthly trading volumes; its options market has gained market share of 2.8 percent. The exchange operator also has an established presence in Europe, having launched a European equity-trading platform, BATS Europe, in 2008. Last February, BATS made a bid for its larger rival, Chi-X Europe, and closed the deal in November. The new business, known as BATS Chi-X Europe, has a combined market share in European equities of 25.3 percent as of February, based on the value of shares traded.

Although its core trading business is unlikely to be affected by its botched IPO, BATS will now have to decide when and if it wants to risk another IPO attempt. Ratterman won’t be drawn on the issue, saying simply that it is a decision that will be made through ongoing discussions between management and the board. Those conversations “will start this week and carry on,” he says. “We’ve got some work to do and we need to retrench.”

In his e-mail, Cummings baldly voiced his opinion that BATS ought to develop a plan to go public in the second quarter, if possible, and “move past the issue” of its failed IPO. Opinions are still divided in the analyst community. Berenberg’s Richard Perrott believes that BATS ought to work hard to defend its market share in U.S. equities, grow its options business and complete the integration of Chi-X Europe before relaunching the IPO. “They probably need to do all of that before they start to think about marketing themselves afresh to investors” he says.

But Adam Honoré, research director at Boston-based advisory firm Aite Group feels that the company ought to waste no time before making another attempt. “It would be ludicrous for them to hold out on this,” he says. “You fix your system issues, you do some adequate testing and you get back out there.”

The only material impact from the trading glitch, he points out, will be on BATS’ share price. “They are not going to get $16 a share,” he adds, “but that’s the punishment they get.”