Remember when Facebook IPOed last May and it was a mess? Today the SEC released its amusing order fining Nasdaq $10 million for the mess and explaining what happened. Some computers were having a stressful day at work and so they decided to give up and hide out in the nap room, is the gist of it. I feel like I’d get along with those computers.

What started the mess is that Nasdaq opens the trading of a newly IPO’ed stock with an opening cross where it compiles quotes for a while and then crosses them in one big opening cross before continuous trading starts. And it uses the following process to do the opening cross:

  • 1 Get a bunch of orders over a ~20 minute period before trading starts
  • 2 Use a program called the IPO Cross Application to calculate the clearing price and shares crossed based on those orders, which takes a few milliseconds
  • 3 Check if any of the orders were cancelled during those milliseconds
  • 4 If they were, delete those orders and Goto 2

Did you spot the problem?1 Nasdaq’s systems engineers did not, even after the IPO Cross Application had been running on an infinite loop for twenty minutes. The SEC caught it, though, reading their order, I was worried that they’d fallen prey to it as well:

After the IPO Cross Application determined the price and volume of the cross, the matching engine performed a validation check to confirm that none of the orders on which the price and volume determination were based had been cancelled during the time that the IPO Cross Application was calculating the price and volume of the cross. The time that had elapsed during the price/volume calculation and validation check was 20 milliseconds, which is significantly longer than usual for an IPO cross, which usually takes 1 to 2 milliseconds. This additional length resulted from the larger than normal volume of orders received during the [Display Only Period from 10:45 to 11:05 when orders were submitted].

The validation check found that a cancellation had been received during the calculation and thus the validation check failed. This caused the IPO Cross Application to recalculate the cross price and volume incorporating the cancellation.

During this second price/volume calculation, two additional cancellations were received and thus the validation check failed again because the second calculation did not account for those two additional cancellations. However, due to the design of the IPO Cross Application, only the first of those two cancellations was incorporated into a third price/volume calculation, and as a result the validation check failed again. And by the time that the IPO Cross Application had run for the fourth time – thereby including the second of the two cancellations that came in during the second calculation – an additional cancellation had been received, thereby causing another failure of the validation check.

During the next price/volume calculation four more cancellations arrived.

OKAY GOT IT. This goes on for seventy pages, just like that.2

After a while Nasdaq fixed the problem by turning off the error check and just saying “if the thing misses any cancellations, we’ll just step in in place of the cancelled orders and buy/sell those shares in our error account.” But they did this only after the IPO Cross Application had fallen nineteen minutes behind the actual orders, and the solution itself caused several more problems including:

  • Various marketable orders submitted during those nineteen minutes got lost,
  • Nasdaq thus had to step into a lot more cancellations than it expected, ending up short 3mm Facebook shares after the opening cross,
  • Nasdaq – who knew? – wasn’t actually allowed to step into those cancellations and buy/short shares for its error account (or, I guess, have an error account at all), and
  • Nobody told the program that sends out order confirmations – the Execution App – that the error check was being turned off; so the Execution App, seeing that the initial cross failed the error check, just sat back with its little electronic arms crossed refusing to send out any confirmations.

So some people who’d submitted marketable orders didn’t get their orders executed, other people whose orders were executed didn’t get confirmations,3 and general unpleasantness ensued. Also Nasdaq accidentally and illegally shorted 3 million shares of an IPO that it was in the process of fucking up, which is a great idea except for the “illegally” part: the stock went down and Nasdaq made $10.8 million dollars covering its short.

The chain reaction of disaster that ensued from this makes up the bulk of the SEC order and it is consistently entertaining.4 It was perhaps less entertaining for Nasdaq, insofar as there are a whole lot of securities laws that apply to you if you run a stock exchange, and if your stock exchange just plain doesn’t work then you’re probably violating most of them. The list of violations here stretches for three pages.

Anyway Nasdaq got out of its SEC case with a $10 million fine and some undertakings to, like, fix all the bugs. Also some undertakings to institute rules allowing it to do the things that it did illegally during the Facebook IPO, which when you think about it is sort of an amazing way to resolve a regulatory violation. I bet the Libor banks would love to reach a settlement that’s like “from now on, we’ll all just agree that it’s okay to manipulate Libor.”5 For instance, Nasdaq extended the end of the pre-cross period from 11am to 11:05am at the request of one of the underwriters, which was not allowed by Nasdaq’s rules; the settlement requires that Nasdaq amend its rules “to provide for an underwriter-requested extension of the DOP for an IPO Cross.”

The bug-fixing and rule-changing both seem appropriate. The sense you get from this SEC order is that Nasdaq as an institution spent the day of the Facebook IPO acting as though it was in a different, clubbier, less rule-bound and more sensible time. The underwriters want to delay the IPO cross? Just delay it, of course; after all they’re the underwriters. Computer bug preventing you from cancelling order? Just have Nasdaq step into those orders with its error account, only fair, right thing to do, etc.

That’s all fine if you’re, like, some gentlemen trading stocks under a buttonwood tree. It doesn’t work as well for computers that are frantically cancelling their orders every time you take a millisecond to calculate. Computers need clear, consistent rules with no unforeseen application of human judgment to gum up the works. Also, if the rules work, that’s helpful too.

SEC Charges Nasdaq for Failures During Facebook IPO [SEC, and order (pdf)]

1. Is it possible that my generation is the first and last to near-universally learn about the dangers of Goto? (Also: line numbers? An earlier draft of this post was numbered 10, 20, 30, 40.) Anyway: the problem is the Goto loop. As long as there are cancellations during each few milliseconds, you’re doing this forever.

2. Not really.

3. And so entered them again. And again and again and again, if they were UBS, who I guess were trying to get in on the infinite-loop action.

4. I enjoyed this for instance:

On May 18, 2012, trading in Zynga was halted twice pursuant to NASDAQ Rule 4120(a)(11), after Zynga’s share price moved more than 10% in a five-minute window. The first Zynga halt occurred at 11:37 a.m., with Zynga stock trading at $7.15. Under Rule 4120(a)(11), trading was to resume after a halt cross at 11:42 a.m.14 However, NASDAQ uses the IPO Cross Application for halt crosses as well as IPO crosses, and the IPO Cross Application – which had fallen behind the pace of Facebook orders by 19 minutes – was still occupied with orders from the Facebook IPO cross.

Thus, when NASDAQ was finally able to issue the bulk print for Zynga and resume continuous trading at 12:27 p.m., the IPO Cross Application had only processed orders received between 11:37 a.m. and 11:55 a.m. And, as with the more than 30,000 orders in the Facebook IPO cross, approximately 365 cross-eligible orders in Zynga that were received between 11:55 a.m. and 12:27 p.m. were processed in violation of NASDAQ’s price-time priority rules. Those orders were not placed into the continuous trading book for Zynga and confirmations for orders executed in the halt cross were not sent out to members until approximately 1:50 p.m.

Zynga’s motto is basically “anything bad that happens to Facebook happens to us too.”

5. They obviously will, right?

20 comments (hidden to protect delicate sensibilities)
Show all comments ↓

Comments (20)

  1. Posted by OpportunityCost | May 29, 2013 at 2:06 PM

    Nasdaq illegally shorts 3mm FB, profits $10.8M, and is fined $10M by the SEC. Another solid day at the office for the SEC. (in my best borat voice) "high five!! nnnyes"

  2. Posted by Dead_cat | May 29, 2013 at 2:08 PM

    Fascinated to hear about the "dangers of Goto". Is it drugs and fast women?

  3. Posted by Guest | May 29, 2013 at 2:11 PM

    Yes, your generation is the first and the last to learn the dangers of Goto.

    The previous generation needs to take special training just to figure out how to use e-mail, and the next generation just assumes that everything will work perfectly and if it doesn't, blame the programmers in India. Our generation is pretty much the only one that both uses computers effectively while also knowing how to actually program them, and what can go wrong in the process.

  4. Posted by Guest | May 29, 2013 at 2:17 PM

    Slow women sound pretty dangerous too.

  5. Posted by hans gruber | May 29, 2013 at 2:24 PM

    (with evil german accent): "You ask for miracles, nasdaq? I give you the S.E.C."

  6. Posted by greater generation | May 29, 2013 at 2:29 PM

    I'm a little confused. Will need some date ranges in order to understand this comment and determine whether I agree.

  7. Posted by Napping Computers | May 29, 2013 at 2:31 PM

    We'll get the margs ready!

  8. Posted by Kweku Leeson, CFA | May 29, 2013 at 2:33 PM

    Hmm, problems related to a position in an error account of questionable validity, no concerns.

  9. Posted by Enriqueta Vizcaino | May 29, 2013 at 2:33 PM

    Fast women sounds more dangerous, just saying. Nasdaq needs to hire…. ME!

  10. Posted by Laura Ingalls | May 29, 2013 at 2:40 PM

    A queef is not a unit of measurement, assholes. Grow the hell up.

  11. Posted by Guest | May 29, 2013 at 3:30 PM

    Does your generation know about the reply button?

  12. Posted by Talk to Up Chuck | May 29, 2013 at 4:07 PM

    I'm more interested in hearing about the free n easy chicks in Goa as I diversify my Faceplant shorting profits………..Faceplant 2012……..Tesla 2013……..

  13. Posted by Guest | May 29, 2013 at 4:17 PM

    There are always outliers, but this is my experience:

    Started career before '70: Hits "Print" on every document received in electronic format
    Started career between '71 and '85: Can use a computer, but gets a helpless look on face any time anything goes wrong and has tech support on speed-dial
    Started career between '86 and '00: Computer savvy, can trouble-shoot problems and do a little bit of programming, calls tech support only as a last resort
    Started career after '01: Comfortable with computers, but assumes everything will work and calls tech support the second something goes wrong

  14. Posted by Guest | May 29, 2013 at 4:18 PM

    No. I just randomly click on the screen until the reply box appears.

  15. Posted by Im_a_Dude | May 29, 2013 at 5:08 PM

    no, they hit the "reply all" button

  16. Posted by Talk to Up Chuck | May 29, 2013 at 5:52 PM

    Siri find me definition of reply button……….

  17. Posted by Shazar | May 29, 2013 at 8:16 PM

    Aint nobody using GOTO….

    while(!crossCheckValid()){
    makeUBSLoseLotsOfMoney()
    }

  18. Posted by bruno | May 29, 2013 at 10:43 PM

    Actually, it's a bit more complicated:
    "Nasdaq actually made roughly $10.8 million on the decline in Facebook’s shares. It contributed those profits to member firms that were hurt in the IPO mess. Nasdaq has agreed to pay $62 million to those firms."
    (http://qz.com/88987/sec-documents-show-how-nasdaqs-computers-bungled-facebooks-ipo/)

  19. Posted by abc | May 30, 2013 at 6:43 AM

    Go back to slashdot.org

  20. Posted by 2 cubes over | May 30, 2013 at 10:25 AM

    I would say ML is refering to those between the ages of 30 & 40.