Slashdot Mirror


Swedish Stock Exchange Hit By Programming Snafu

New submitter whizzter writes "I was reading the Swedish national news today and an image in a stock exchange related article struck my eye. An order had been placed for 4 294 967 290 futures (0xfffffffa or -6 if treated as a 32-bit signed integer), each valued at approximately 16,000 USD, giving a neat total of almost 69 trillion USD. The order apparently started to affect valuations and was later annulled, however it is said to have caused residual effects in the system and trading was halted for several hours."

136 comments

  1. Sven and Ole Found a Trading App by eldavojohn · · Score: 5, Funny

    Sven: Hey der Ole, check out dis new app I got on my phone here.
    Ole: *takes the phone and looks at the screen* Oh hey idn't dat neat? A stock trading app!
    Sven: Yeah I'm like a big shot power björker now! Börk! Börk! Börk!
    Ole: Oh ja, you betcha, hey I gotta a hot tip, I'm gonna buy six futures of Ikea for ya.
    Sven: Ole, you idiot! Stop that, I've only got a few cents on my account.
    Ole: Oh! Jajaja, oops, you're in da red now. Oofta, I'll fix this here, lemme just sell 'em real quick.
    Sven: No, stop, you'll just make things worse!
    Ole: I don't see a 'sell' button on dis thing, oh, I know! *punches some buttons* Oh dear. Oh shoot. Ja, I'm in a little over my head here, Sven.
    Sven: *grabs the phone* Negative 460 trillion dollars!? OLE, WHAT DID YOU DO?
    Ole: Oh well, ya see, I just bought negative six shares, ja? To undo me buying six positive shares, ja? And I guess der was like ... some underflow involved der? With de app, ja? Ah gosh gee, Sven, I'm sorry, I'll pay ya back after I settle up with da liquor store first, of course.

    --
    My work here is dung.
    1. Re:Sven and Ole Found a Trading App by sl4shd0rk · · Score: 2, Funny

      'll pay ya back after I settle up with da liquor store first, of course.

      Slashdot: We aren't racist/sexist. We shamelessly pick on everyone.

      --
      Join the Slashcott! Feb 10 thru Feb 17!
    2. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 5, Informative

      As a Swede I found the above posts very funny, though some things could be pointed out for the sake of clarity.

      1) Björk is actually from Iceland. Can we elect The Swedish House Mafia as representatives of our culture instead please?
      2) While I think Swedes on average consume a bit more hard liquor than the US, it's nothing like eastern Europe. We are mostly a beer people, and we are not afraid to import quality stuff. Though I guess in comparison to what goes for beer in the US, it's can almost be considered hard liquor ;-)
      3) IKEA isn't a publicly traded company, and it's now owned by what is a series of (supposedly) non-profit trusts across the world with the single objective to keep it alive forever. Yes, Billy the bookcase will probably outlive you.

    3. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      Signs you haven't been to the US: mentioning that "what goes for beer in the US" is low alcohol...

    4. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 1

      While we are happy to absolve you of the atrocity known as Bjork, us Americans of a certain age will always remember our first encounter with the Swedes:

      http://muppet.wikia.com/wiki/The_Swedish_Chef

      Börk! Börk! Börk!

      Good times.

    5. Re:Sven and Ole Found a Trading App by Kozz · · Score: 2

      As a USAian of midwestern extraction and mixed Scandinavian heritage, we enjoy our "Sven & Ole" (and sometimes Lena) jokes. I was most impressed by eldavojohn's shibboleth, "oofta" (though more usually spelled uff-da). eldavojohn, where are you from? Wisconsin, Minnesota, or Michigan's U.P.? :)

      --
      I only post comments when someone on the internet is wrong.
    6. Re:Sven and Ole Found a Trading App by Grog6 · · Score: 2

      One of the first Slashdot April Fool's Day jokes had stories written in different fake languages; the Swedish one was written as tho by the Muppets' Swedish Chef. :)

      --
      Truth isn't Truth - Guliani
    7. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      1: The Swedish House Mafia? You must be kidding me. http://de1.eu.apcdn.com/full/88837.jpg
      2: The US has well over 2000 breweries, Sweden has 20-something. Mainly because of a absolutely dominating beer oligopoly with synergetic effects in dominating the pub distribution making sure that there are very few and expensive, or none other brand beers sold in bars. They call them "guest beers" and the owner loses bonuses if he/she has too many. Scary stuff, that has made sure swedish beer culture is low in european standards. Swedish standard draft is 5,2% and is like making love in a canoe, f* close to water.

      / Ludvig
      Skåne, Sweden (+ a year of two of pacificNW microbrewery pub indulgement :)

    8. Re:Sven and Ole Found a Trading App by lgw · · Score: 1

      From the very early days of usenet:

      alt.swedish.chef.bork.bork.bork

      alt.french.captain.borg.borg.borg

      alt.ensign.crusher.die.die.die

      CleverNickname took the last one a bit personally, but he was young then.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    9. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      Lol. "Ole" is Norwegian. Ola, is a Swedish guy though. I know him..

    10. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      Considering there are actually no "liquor stores" at all in Sweden.. Apart from the state monopoly "Systembolaget".

    11. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      "uff-da" I suppose that is supposed to mean usch då..? :) /Svensk rättstavningsfröken

    12. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      It's funny though. To me as a born and raised Swede, "the Swedish chef" never sounded Swedish at all, he sounded like an American mumbling gibberish.. The muppet show was a regular part of what was shown on Swedish television in the 70-80's as well.

    13. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      Great beginning, horrible ending. You cannot get a license to open a liquor store in Sweden as alcohol is a state-controlled monopoly.

    14. Re:Sven and Ole Found a Trading App by DES · · Score: 1

      "uff-da" I suppose that is supposed to mean usch då..?

      It's the Norwegian equivalent. I wince every time I catch myself saying it.

    15. Re:Sven and Ole Found a Trading App by tehcyder · · Score: 2

      Signs you haven't been to the US: mentioning that "what goes for beer in the US" is low alcohol...

      Standard draft or canned beer in the US is (a) tasteless and (b) not very alcoholic. Yes, I know you have organic microbreweries in Seattle making 13% ABV stouts (or whatever), but when Joe Sixpack gets his beer it will normally be some variant of Miller/Bud/Coors Light. Those are by far the top-selling beers in America, and are 4% alcohol, which is pretty much the minimum you can make something and still call it beer.

      --
      To have a right to do a thing is not at all the same as to be right in doing it
    16. Re:Sven and Ole Found a Trading App by fatphil · · Score: 1

      But in the context of a Swedish story, anything over 3.5% is "starköl" (stark\"ol) - "strong beer".

      Hmmm..... Pripps Blå (Bl\aa) - surely named after the sound you make when trying to drink it?

      --
      Also FatPhil on SoylentNews, id 863
    17. Re:Sven and Ole Found a Trading App by fatphil · · Score: 1

      So first my character becomes 2 separate 8-bit values.
      Then they're turned into html entities.
      Then those are escaped such that they're rendered literally.

      So that's 3 conversions when in fact none was necessary.

      I'm glad I supplied the TeX equivalents, I suspected something might go wrong, but even I am shocked how braindead /. turns out to be!

      --
      Also FatPhil on SoylentNews, id 863
    18. Re:Sven and Ole Found a Trading App by KingMotley · · Score: 1

      Signs you haven't been out of the US: You think US beer is either good, or contains a normal amount of alcohol compared to the rest of the world.

    19. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      What??? A girl on slashdot??? what has happened? ;)

    20. Re:Sven and Ole Found a Trading App by jandrese · · Score: 1

      I'm pretty sure Rob and whomever is maintaining Slashcode now is absolutely terrified of Unicode after having a few comment pages reversed and other formatting snafus. It's a shame though, because safe handling of Unicode is far from impossible and way better than what they're doing now.

      --

      I read the internet for the articles.
    21. Re:Sven and Ole Found a Trading App by BitwizeGHC · · Score: 1

      The Swedes in TGWTDT practically lived on aquavit, alongside coffee and sandwiches.

      Then again I think those books were more about Stieg Larsson's much more exciting, thriller-screenplay Sweden than actual Sweden.

      --
      N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
    22. Re:Sven and Ole Found a Trading App by Anonymous Coward · · Score: 0

      Sorry I didn't mean to upset the order of things.. and actually make my presence known. No need to be nervous...

  2. 64 bits by Anonymous Coward · · Score: 0

    Lucky they weren't using a 64 bit platform !

  3. Just be happy they weren't using 64-bit integers by Anonymous Coward · · Score: 2, Funny

    Imagine it 0xFFFFFFFFFFFFFFFA. That's a big enough number that it's unreasonable to type without scientific notation :)

  4. SNAFU..... by m.shenhav · · Score: 4, Insightful

    ..... the word is being abused here.

    1. Re:SNAFU..... by Anonymous Coward · · Score: 3, Insightful

      What, you think the markets aren't normally AFU?

    2. Re:SNAFU..... by mcgrew · · Score: 1, Redundant

      It's not a word, it's an acronym for "situation normal, all fucked up." Seems appropriate to me.

    3. Re:SNAFU..... by Aighearach · · Score: 2

      Wrong. It is a word whose first reference was an acronym, though used from the start as a word.

      m-w defines it: a situation marked by errors or confusion : muddle; also : an error causing such a situation <a scheduling snafu>

      Remember kids, etymology is fun and educational but it should not be used as a guide for the definition of a word. Instead... use the definition as the definition. Etymology's value is historical and linguistic, not communicative.

    4. Re:SNAFU..... by idontgno · · Score: 1

      Agreed. I think the acro-word they're looking for is FUBAR.

      Although the authorities believe the CAN fix it. So "Beyond all repair" may not be literally true.

      --
      Welcome to the Panopticon. Used to be a prison, now it's your home.
    5. Re:SNAFU..... by slashmydots · · Score: 1

      They mistranslated it from Swedish. It was supposed to say snafuck lol.

    6. Re:SNAFU..... by greyblack · · Score: 1

      Thank you! Etymology-Man!

      --
      Everybody uses broad generalizations.
  5. Speed at the cost of accuracy by Anonymous Coward · · Score: 1, Insightful

    This is what happens when you want million transactions a second. You have to forgo input validation on your trading systems. Do these people ever learn?

    1. Re:Speed at the cost of accuracy by Anonymous Coward · · Score: 0

      It takes sub millisecond to validate input.... probably takes far longer to verify that all parties have enough money/stock to trade which might involve checking against a database.

    2. Re:Speed at the cost of accuracy by Anonymous Coward · · Score: 1

      Do you have any evidence that this bug was caused by input validation being skipped to enable high-frequency transactions? No? Didn't think so.

    3. Re:Speed at the cost of accuracy by skovnymfe · · Score: 2

      Why bother? If something gets fucked up, Mr. Street just rolls back all the bad, and gives us another chance. No problem.

    4. Re:Speed at the cost of accuracy by Anonymous Coward · · Score: 0

      I never referred to high-frequency trading. The exchanges in general never validate input. They assume the brokers validate them and just execute them. And is there even a question of input not being validated? I would love to see how this passed validation.

    5. Re:Speed at the cost of accuracy by The_Wilschon · · Score: 1

      They used an unsigned int -- how could they possibly validate against a negative value? It's not their fault that the computer on the other end of the network was using a signed int. /sarc

      --
      SIGSEGV caught, terminating

      wait... not that kind of sig.
  6. Different article on same website by schneidafunk · · Score: 1

    I have never seen that website before and decided to scroll down to see the other articles. There's a much more interesting article at the bottom titled:
    "The body as a network"

    --
    Some people die at 25 and aren't buried until 75. -Benjamin Franklin
  7. remember all those pesky compiler warnings by Anonymous Coward · · Score: 0

    warning: conversion from int to unsigned int, possible loss of data

    Gotcha!

    1. Re:remember all those pesky compiler warnings by Anonymous Coward · · Score: 0

      Not loss, win! -6 is much less than a few billion.
      (the warning would be quite nonsense though, I don't think you would ever lose any information/data by converting int to unsigned, it just might not be in the representation you expected - unsigned to int is a different, e.g. when using one's complement you could indeed lose information)

  8. Not so local by j1976 · · Score: 3, Informative

    The stockholm stock exchange is part of the NASDAQ-OMX group ( http://www.nasdaqomx.com/aboutus/whatisnasdaq/ ) . Do they use the same software?

  9. 32 Bit by Anonymous Coward · · Score: 0

    Let's see into what problems they run if programs start using 64 bit...

  10. Good Point Here by Murdoch5 · · Score: 1

    This is why you always use dynamic storage like a link list when you potentially have to deal with numbers bigger then the address bus width.

    1. Re:Good Point Here by vlm · · Score: 5, Funny

      This is why you always use dynamic storage like a link list when you potentially have to deal with numbers bigger then the address bus width.

      Naah just use a FLOAT. After all, nothing bad could ever happen when doing financial calcs with FLOATs, right?

      (note to sarcasm impaired... ahh on 1.9999999nd thought forget about it)

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    2. Re:Good Point Here by gstoddart · · Score: 4, Insightful

      This is why you always use dynamic storage like a link list when you potentially have to deal with numbers bigger then the address bus width.

      A linked list of digits? Seems a little much given that there's data types meant to handle really big numbers.

      At a minimum someone should be bounds/sanity checking their inputs before it goes anywhere past the user interface -- you have to assume your users will type all sorts of random stuff into your fields.

      Then again, I am often surprised when testing new software that when I do something completely random I often see issues.

      I remember a developer saying to me once "but nobody is ever going to do that" -- the reality is, unless you actively prevent it, sooner or later they will; and in the case of many users, it's more like within the first 5 minutes. They don't know or care what you think is 'normal' inputs -- they're going to do what they do no matter what.

      --
      Lost at C:>. Found at C.
    3. Re:Good Point Here by Murdoch5 · · Score: 1

      HAHA Oh of course! Also NEVER check the scope of the value stored or initialize to 0.

    4. Re:Good Point Here by Anonymous Coward · · Score: 0

      Dynamic storage allocation is not deterministic.

    5. Re:Good Point Here by Murdoch5 · · Score: 1

      Oh I agree that you need to scope check everything and using big data types can help. If I was working something as big and complex as a stock system I would make my own big data storage, sure a link list is over kill but if you ever think is it big enough then you need to make it bigger.

    6. Re:Good Point Here by Anonymous Coward · · Score: 0

      This is why you always use dynamic storage like a link list when you potentially have to deal with numbers bigger then the address bus width.

      A linked list of digits? Seems a little much given that there's data types meant to handle really big numbers.

      It's also not very difficult to take a valid guess at maximum allocation size of a result, like b111 * b111 is b110001 or b111 + b111 is b1110. You can with reasonable efficiency just use a normal continuous buffer.

      From my experience timed used to allocate memory blocks or copy bits is trivial compared to operations like division (which is pretty complicated).

      Libraries like gmp optimized structures to improve performance, and I don't believe memory allocations are a primary issue.

    7. Re:Good Point Here by Anonymous Coward · · Score: 0

      Google's C++ style guide suggests using int for all small numbers, and never using unsigned ints for numbers that are expected to be non-negative. Instead asserts should be used to check that inputs are non-negative. Anyway, this would have caught this bug.

    8. Re:Good Point Here by Anonymous Coward · · Score: 0

      Rofl, the software that my company makes does quantity on hand calculations by float. Seems weird when I run into someone who apparently has 34.00000000000043 bottles of something on hand.

      "Look for the little bit that spilled on the floor, that is what it is counting"

    9. Re:Good Point Here by BitwizeGHC · · Score: 1

      Is this a troll? Not even Lisp implements bignums this way...

      --
      N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
    10. Re:Good Point Here by Murdoch5 · · Score: 1

      ..... no, you program a linked list, which any first year computer student could do and use it to implement safe big number handling. C doesn't handle big numbers this way either, but you can still use it.

  11. oopsie... by maz2331 · · Score: 4, Informative

    ...someone forgot that putting an int into a function that expects a UINT32 is not a good idea....

    1. Re:oopsie... by Anonymous Coward · · Score: 2, Insightful

      If I was writing an exchange system, I'd use something like Ada, where there are well tested add-ons that let you prove the accuracy and integrity of the algorithms.

      In C, I almost never use signed integers. It's rare that I ever need negative values. If I'm subtracting, in the vast, vast majority of situations I expect to end up with a positive number. If the result would prove negative, something is broken. Using unsigned integers with modulo arithmetic I at least get a value in the correct domain. I only ever have to check for sane upper bounds, not upper _and_ lower bounds. It's half as much work, and half as much to go wrong.

    2. Re:oopsie... by Anonymous Coward · · Score: 0

      Agree with Ada.

      How do you check if your value is still valid after subtracting by a bigger number?
      Do all your library function accept unsigned datatypes as well, or do they accept signed datatypes, thus giving the same error.
      Do you program for the Swedish exchange?

    3. Re: oopsie... by Anonymous Coward · · Score: 0

      Ada's virtually unheard of in this world. Most exchange systems are written in with Java*, or C++. Stability and predicable performance are both incredibly important to these applications, these languages offer a good combination of runtime performance, wide use, and good implementations.
      * with careful attention to memory allocation to eliminate GC overhead. You'd be surprise how far this is taken.

  12. Curious how they did that ... by gstoddart · · Score: 4, Interesting

    Since I doubt you can buy -6 shares, and likely nobody had access to $69 trillion USD (including the US government)... this sounds like it was done by someone who knew it would cause problems with the system.

    I don't know about most of you, but I couldn't initiate a trade for that kind of money. How could someone even do this without having some good knowledge of how the system works?

    You'd really have to assume there should be some pretty obvious checks and balances in there that either weren't, or didn't trigger.

    --
    Lost at C:>. Found at C.
    1. Re:Curious how they did that ... by SJHillman · · Score: 4, Funny

      The RIAA will have the money to do that once Napster pays up... and have $3 trillion left over

    2. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      Perhaps someone wanted to sell 6 shares? ;)

    3. Re:Curious how they did that ... by Anonymous Coward · · Score: 1

      It's called a trading algorithm bug. It's not malicious intent since you'd never know how stocks change after a trade like this, so the obvious conclusion is that someone fucked up when coding their algo and as it traded it went into a stack overflow of some sort and we got this trade for -6 units, which became 4 294 967 290 units.

    4. Re:Curious how they did that ... by timeOday · · Score: 2

      It is always painful coding an arbitrary maximum "I don't believe" you value though. Evidently somebody declined to do so :)

    5. Re:Curious how they did that ... by vlm · · Score: 4, Informative

      Since I doubt you can buy -6 shares,

      I'm willing to bet (if only I lived in a free country where I could go on Intrade to place the bet, but I digress) that someone has a UTF-8 input field with input sanitizing that only looks for one of the bazillion "minus/dash like" glyphs and a UTF-8 to int input routine that understands all or at least most of the "minus/dash like" glyphs. Happened to me once. Of course I didn't crash a world wide financial exchange, or you would have heard about it...

      "Similar looking" yet different UTF-8 glyphs are one of the most exciting parts of the standard. "glyph to concept" mapping is not 1:1 any more like the old 7 bit ASCII days.

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    6. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      Some 10 keys have the minus sign and plus sign precariously close to the six (split the middle horizontally). Entirely possible that the bug existed and someone accidentally entered a minus sign at time they struck the six key.

    7. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      Hopefully they start by draining your bank account.

    8. Re:Curious how they did that ... by TheCarp · · Score: 4, Funny

      How about this scenario:
      "I can put in trades for any amount with this terminal"
      "Any amount? What happens if you put in a negative trade?"
      "It should kick out an error like this watch... I will place negative 6."
      "Hey it took it! Lol I bet you just bought 6 shares!"
      "Lets see it looks like it just....oh shit".

      --
      "I opened my eyes, and everything went dark again"
    9. Re:Curious how they did that ... by scared+masked+man · · Score: 0

      That is why, whenever you are parsing user input, you should be doing all the conversions in the UI layer and, once they have entered the value, display what you think they've asked for, before doing anything potentially irreversible. Likewise, your validation should come after you've parsed the data, not before.

      Of course, just because that's something which should have been pointed out in Intro to Computing right after atoi(3) is mentioned doesn't mean that people actually remember to do it, but you would think that people would get that sort of thing right in important software.

    10. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      If you do a blacklist on characters in a number input field instead of a whitelist you're way out in "that's not how it's done" land...

    11. Re:Curious how they did that ... by cheater512 · · Score: 1

      Account balance = $100
      -6 * $16,000 $100
      Transaction approved

    12. Re:Curious how they did that ... by jonadab · · Score: 2

      > It is always painful coding an arbitrary maximum
      > "I don't believe you" value though.

      Don't I know it.

      Once when I was setting up a very small mail server once (think: about a dozen users), I looked at the "max number of recipients per message" variable, thought about how many distinct recipients it might potentially be reasonable to have for a single (non-mailing-list) message, and set the value to five. It was overkill, of course...

      Those of you who have ever run a mail server know what happened next. Within a day of deploying the thing I'd raised the limit at least three times. At that point the new limit lasted for a few months, but then...

      What, seriously? You really have a legitimate work-related need to send exactly the same message word-for-word to more than fifty addresses at once, for real?

      Yeah. More than fifty individually hand-typed addresses, even.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    13. Re:Curious how they did that ... by alexander_686 · · Score: 1

      Since I doubt you can buy -6 shares, .

      It's a future - so yes - For derivatives, for every long trade there has to be a short side. Technically it’s “Selling to Open” but I have seen systems treat it as a buying a negative quantity.

    14. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      > Since I doubt you can buy -6 shares ...

      We're talking about equity index futures, you most certainly can.

    15. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      Indeed. One should always validate values, not representations. It's typical of novice and intermediate programmers in almost all languages to not fully understand the difference between representation and logical value. It's why new C programmers type-pun the hell out of pointers, often with unintended or dire consequences.

    16. Re:Curious how they did that ... by tolkienfan · · Score: 1

      I'd suspect it was triggered by a bug at a trading company with a seat on the exchange.
      Some exchange protocols are in binary. The exchange may have validated only one side, assuming qtys would always be positive.

    17. Re:Curious how they did that ... by tolkienfan · · Score: 1

      Buying and selling are treated as separate cases on the 20 or so exchanges I have experience with.
      The one area where negatives ARE used is in multi-legged instruments such as calendar spreads, but that's in the price not the quantity.

    18. Re:Curious how they did that ... by intoverflow · · Score: 1

      Since I doubt you can buy -6 shares...

      Not literally, but you can sell 6 shares, or you can take the "short" side of a swap, future or other derivative transaction. These are conventionally represented as negative quantities. (The math works the same, so often you actually do write it as buying -6 contracts.) And the trade in question here is futures, not plain stock, where there's both a long and short side. Way more likely this was someone who intended to go short 6 contracts and entered -6, or a bug that dropped a negative "short" quantity into an inappropriate uint variable than some sort of malfeasance. Does sound like some missing sanity checks though. :)

    19. Re:Curious how they did that ... by MattBecker82 · · Score: 2

      They were trading Futures contracts, and so trading -6 contracts is routine (it's called "shorting" or "going short"). Since a Futures contract is a promise to buy/sell at some point in the future you don't have to own the underlying stock/commodity/whatever at the time you go short.

      Also, from the summary: "each valued at approximately 16,000 USD, giving a neat total of almost 69 trillion USD" is misleading. Futures are traded on margin so the total the total amount of cash they would have had to put up is orders of magnitude less. 69 trillion USD is simply the maximum they could lose.

    20. Re:Curious how they did that ... by alexander_686 · · Score: 1

      For exchanges I would hope so.

      Brokerage systems that interface with the exchange – that is a different story. Like I said, I have seen systems which make the sloppy shortcut of coding “Sell to open” as negative buys.

    21. Re:Curious how they did that ... by Anonymous Coward · · Score: 0

      Probably placed an order for 2 shares, then cancelled 8 of them.

    22. Re:Curious how they did that ... by gstoddart · · Score: 1

      Also, from the summary: "each valued at approximately 16,000 USD, giving a neat total of almost 69 trillion USD" is misleading. Futures are traded on margin so the total the total amount of cash they would have had to put up is orders of magnitude less. 69 trillion USD is simply the maximum they could lose.

      I'm sorry, but if the US GDP was 15.09 Trillion dollars in 2011 (according to google) -- there is no meaningful scenario in which a stock trade could have a potential loss (or cost) of 69 Trillion USD.

      You are firmly into the realm on nonsensical numbers at that point -- that's like all the money in the world. Take the US, China, Japan, Germany, France, the UK, Brazil, Italy, India and Canada and add them all up it's not that. 69 trillion was the world GDP in 2011. The NYSE combined market cap in December of 2011 was only about 15 Trillion.

      I think you're trying too hard to explain something here. I'm not convinced there's a plausible explanation for any trade trying to cover 4 billion shares of anything, and for more money than is imaginable.

      This is a trade size which is unbelievably huge, for a dollar value which is equally huge.

      --
      Lost at C:>. Found at C.
    23. Re:Curious how they did that ... by MattBecker82 · · Score: 1

      I don't disagree with you.

      I was trying to point out that this being a trade on a futures contract, not a stock, the summary was wrong in saying the total value of the trade was 69 trillion USD. When I said this is the "maximum they could lose" this is a theoretical upper bound which - as you rightly point out - could never be reached in reality.

      In any case all this is predicated on this being a genuine and intentional order which was filled and honoured by the exchange. I never claimed it was. It seems pretty to clear to me that this is unintentional (either a fat finger or a technical screw-up) and even if the exchange treated it as genuine order for 4 billion odd contracts, then there wouldn't have been any where near enough liquidity to fill the order. So I'm not "trying too hard to explain something" - I was merely picking up on a couple of factual issues around futures trading that most commenters seemed to have missed as they don't realise it's not the same thing as direct trading in stocks.

  13. Stop annulling these trades. by Anonymous Coward · · Score: 5, Insightful

    The way to prevent this kind of mistaken (or even malicious) trade is to stop protecting the trader by canceling the trade as soon as the mistake is realized. If you issue a trade order, you should be liable for paying for it. If you can't, normal bankruptcy laws should apply.

    1. Re:Stop annulling these trades. by tolkienfan · · Score: 2

      Not if the order or quote makes no sense or somehow isn't valid.
      In this case it actually caused ongoing problems with the exchange. Probably caused an overflow in the book handling logic in the matching engine.
      Erroneous trades that result from bad behaviour in the exchange software should be rolled back, as they are not the fault of the trading parties.
      If we were simply talking about the order being overfilled, then I'd agree with you.

    2. Re:Stop annulling these trades. by Idarubicin · · Score: 2

      The way to prevent this kind of mistaken (or even malicious) trade is to stop protecting the trader by canceling the trade as soon as the mistake is realized. If you issue a trade order, you should be liable for paying for it. If you can't, normal bankruptcy laws should apply.

      First of all, it's not clear exactly what the trade order even meant. At worst, an offer to buy -6 futures should have been interpreted as an offer to sell 6 futures at the stated price--not as an (underflow-generated) bid for 4 billion futures. Who, exactly, do you hold liable for failing to sanity-check their inputs--the trader, his company, the exchange, their various software subcontractors who themselves may have been bought, sold, and restructured long since...?

      Second, insisting that the trade happened and then forcing the trader into bankruptcy (and associated bankruptcy protection) is likely to punish the 'innocent' participants in the market more than anyone else.

      --
      ~Idarubicin
    3. Re:Stop annulling these trades. by Anonymous Coward · · Score: 0

      I agree, as long as the software developers are free of all liability.

      Stop validating inputs, and turn off compiler warnings asbout signed/unsigned, and whatever you do, do not use a high-level programming language with bignum integers. Stop short when you have a slightly improved C with garbage collection.

      Nail that damn end-user's ass to the wall for putting in a -6 where a positive value is required!

    4. Re:Stop annulling these trades. by tehcyder · · Score: 1

      The way to prevent this kind of mistaken (or even malicious) trade is to stop protecting the trader by canceling the trade as soon as the mistake is realized. If you issue a trade order, you should be liable for paying for it. If you can't, normal bankruptcy laws should apply.

      "OK, you owe me $69 trillion. I'm prepared to settle at $69 billion, that's my final offer."

      --
      To have a right to do a thing is not at all the same as to be right in doing it
    5. Re:Stop annulling these trades. by raddan · · Score: 1

      In the interest of creating a well-functioning system, I think system designers should try to catch these errors. If errors only affected the one party who made the mistake, your proposal might be worth considering, but in fact, these errors affect people who have nothing to do with it, simply because they participate in the market. Thus, it is better to eliminate errors altogether.

      The most obvious fix is that negative trades should not be allowed. Even better would be a type system which expresses valid order sizes. But even within the range of valid orders, some order sizes are more likely than others. Given the volume of orders, it ought to be pretty easy to characterize the distribution of order sizes-- I think a smarter system should flag outlying order sizes for secondary human review. This is a pretty easy check to implement, and it surprises me that it doesn't already exist in the system.

  14. Re:Just be happy they weren't using 64-bit integer by omnichad · · Score: 2

    Not so unreasonable to copy and paste, though:
    18,446,744,073,709,551,610

  15. New math by girlintraining · · Score: 3, Funny

    Well, at least now we know how RIAA calculates its damages; They must have hired the same developer...

    --
    #fuckbeta #iamslashdot #dicemustdie
    1. Re:New math by swampfriend · · Score: 1

      Is this another way of saying, "They should be paying us to listen to this crap!"

  16. Must be a hoax by mcmonkey · · Score: 2

    According to most of the folks posting in another thread about computer-driven cars, programming errors rarely make it out in to the world.

    Is there was an issue, it must be user error. Programmers aren't supposed to make mistakes!

    <snark/>

    1. Re:Must be a hoax by LateArthurDent · · Score: 2

      According to most of the folks posting in another thread about computer-driven cars, programming errors rarely make it out in to the world.

      Is there was an issue, it must be user error. Programmers aren't supposed to make mistakes!

      <snark/>

      Nobody ever said that. What we do say is that known programming errors get fixed, known human issues do not.

      While coming back from lunch today I saw somebody go through a stop sign at 40 mph and t-boning another car. Luckily everyone walked away (go modern cars and their crumple zones), and while I'm sure that particular driver will be more careful in the future, other human drivers are going to be making the same mistake forever.

      A programming error causes something like this and the fix for it will be on an update for every single other car out there. It will never happen again. Other mistakes will happen, sure, but that one is fixed forever.

    2. Re:Must be a hoax by mcmonkey · · Score: 1

      Nobody ever said that. What we do say is that known programming errors get fixed, known human issues do not.

      While coming back from lunch today I saw somebody go through a stop sign at 40 mph and t-boning another car. Luckily everyone walked away (go modern cars and their crumple zones), and while I'm sure that particular driver will be more careful in the future, other human drivers are going to be making the same mistake forever.

      A programming error causes something like this and the fix for it will be on an update for every single other car out there. It will never happen again. Other mistakes will happen, sure, but that one is fixed forever.

      *facepalm*

      1) Not every known programming error gets fixed prior to release.

      2) Even if 1 were not true, it's the unknown errors that will get you.

      Stock exchanges have been electronic for quite some. And they process quite a large number of transactions. I did some back of envelope googling. The average trading volume of the NYSE is 700 million. Figure they're open 200 days per year, electronic trading been around maybe 20 years, maybe NYSE is 25% of the world trading (yes, I know the volume of trading the amount electronic trading has been increasing over that time, but I'm not counting other forms of electronic trading (e.g. bonds, commodities)), puts us north of 11 quadrillion trading transactions.

      And yet there are still bugs in that system.

    3. Re:Must be a hoax by tolkienfan · · Score: 1

      Er, that's more that 1 trading system. Plus this wasn't a bug in a US equities exchange.
      Also, GP was saying a bug in a piece of software only needs to get fixed once, he never said that was before release.

  17. 64-bit by Citizen+of+Earth · · Score: 1

    Thank goodness they weren't using 64-bit unsigned integers!

  18. Whoa, you can annul transactions? by Anonymous Coward · · Score: 0

    I saw The Dark Knight Rises and I thought that even when armed men with guns break into a stock exchange and do mysterious things with a computer, that it is not possible to annul an obviously stupid transaction done right at that time that takes a millionaire and leaves him penniless.

    Oh well, I guess I'll just have to settle for realistic movies, like Skyfall where they take an unknown computer running unknown software and plug it right in to their secure network, inside their firewall. Some bad stuff does happen but who could have foreseen it?

  19. Re:Just be happy they weren't using 64-bit integer by Anonymous Coward · · Score: 0

    More like 0xFUUUUUUUUUUUUU... amirite?

  20. Was this .... by PPH · · Score: 1

    ... an order to sell short 6 futures that the user inadvertently entered into the 'buy' field?

    --
    Have gnu, will travel.
  21. Monster Orders upholstered Exchange by Minwee · · Score: 1

    I love automated translation.

    1. Re:Monster Orders upholstered Exchange by sootman · · Score: 1

      I just figured "upholstered" was slang over there, like "plastered" in the US. Love it. A great day for words over here -- first escape goat, now this. :-)

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  22. I did something like that once... by Kaenneth · · Score: 0

    Dial up BBS with time limits; but you could gamble an amount of time for a 1 in 3 chance of getting double the time...

    So I gambled -50,000 minutes.

    And lost.

    Which gave me 100,000 minutes.

    Which overflowed the 16 bit counter.

    Which crashed the BBS.

    Which dumped me into a remote shell.

    Which let me read the unencrypted password file.

    1. Re:I did something like that once... by Anonymous Coward · · Score: 0

      "I did something like that once... "

      When you were dreaming you were a cool haxx0r. I call B.S...

    2. Re:I did something like that once... by Anonymous Coward · · Score: 0

      If it overflowed the counter, how did you know how many minutes it gave you?

  23. -6? Not always... by Ichijo · · Score: 1

    (0xfffffffa or -6 if treated as a 32-bit signed integer)

    In two's complement, sure. But this is Slashdot, pedantry is allowed, even encouraged.

    --
    Any sufficiently unpopular but cohesive argument is indistinguishable from trolling.
  24. Are you guys ( and girl ) sure this was a mistake? by vikingpower · · Score: 4, Interesting

    It did, after all, influence trading. What if this stunt was disguised as an - admittedly stupid - mistake, but in fact wasn't one ?

    --
    Religous speak to God. Insane are spoken to by God. When all shut up, one can finally hear Shostakovich in peace
  25. Just wrote a 2500 pg paper on flash trading by GodfatherofSoul · · Score: 1, Interesting

    For an ethics class. The only real solution is to ban it outright. These algorithms can never be fully tested because they interact with algorithms from other institutions which can lead to death spirals as algorithms cause feedback loops; bouncing trades off of one another until someone pulls the plug. And at automated speeds, that can be long after your company goes bankrupt.

    From the sounds of the translated page, this was just a one-shot jacked up algorithm working in isolation which is still a problem in itself.

    --
    I swear to God...I swear to God! That is NOT how you treat your human!
    1. Re:Just wrote a 2500 pg paper on flash trading by girlinatrainingbra · · Score: 4, Funny

      Re:Just wrote a 2500 pg [page?] paper on flash trading
      .
      Dude, you must be tired. 2500 pages? Or did you really mean 2500 words? Or was this a deliberate attempt to add to the humor by using the wrong units with the number? Or an amusing way to show how easily errors can slip by humans? Or just a result of tired-ness after typing and proof-reading that 2500 page essay?
      ;>)

    2. Re:Just wrote a 2500 pg paper on flash trading by GodfatherofSoul · · Score: 1

      lol didn't even see that. 2500 WORD!!!!!

      --
      I swear to God...I swear to God! That is NOT how you treat your human!
    3. Re:Just wrote a 2500 pg paper on flash trading by PhamNguyen · · Score: 1
      How is this an ethical matter? Or more precisely, how are people studying ethics qualified to speak about what is really a matter of finance or economics?

      It's not like in (academic) finance and economics they ignore the overall net benefit of trading rules to society. In fact, this is usually all that is considered.

    4. Re:Just wrote a 2500 pg paper on flash trading by GodfatherofSoul · · Score: 1

      You're assuming that the professor has a doctorate in ethics. Ethical issues of flash trading off the top of my head:

      * Flash trading gives companies with instantaneous access to the market an unfair advantage.
      * Flash trading violates the "spirit" of stock markets by allowing flash traders to exploit price swings not related to market fundamentals. The purpose of stock markets is to place capital in the hands of industry, not game the system.
      * Flash trading favors extremely well funded organizations that have the resources to create these algorithms as well has throw enough cash or credit at trades designed to profit from minute stock price changes.
      * Flash trading can be used nefariously to bring companies down.
      * Flash trading can be used nefariously to prop up overvalued stocks; e.g. the Facebook IPO where the price was held artificially high to allow profit takers to unload their allotments.

      --
      I swear to God...I swear to God! That is NOT how you treat your human!
    5. Re:Just wrote a 2500 pg paper on flash trading by PhamNguyen · · Score: 1
      The professor's degree isn't really what is important, what is important is whether the issues belong to ethics or economics. E.g. would you say that the decision between using drug A and drug B to treat an illness was an ethical issue, because using the wrong one would cause less people to become better?

      Economists are already addressing issues of fairness, maximizing welfare, etc.

      Furthermore, you are making some wrong assumptions. E.g. you say that "The purpose of stock markets is to place capital in the hands of industry, not game the system." but if incorrect prices exist, then the wrong decisions will be made, and so people deserve a reward by trading on market fluctuations, if such trading tends to drive prices towards their correct values (and economics theory states that it does). That is, what you consider gaming the system is actually placing capital in the hands of the right people.

    6. Re:Just wrote a 2500 pg paper on flash trading by tehcyder · · Score: 1

      How is this an ethical matter? Or more precisely, how are people studying ethics qualified to speak about what is really a matter of finance or economics?

      It's not like in (academic) finance and economics they ignore the overall net benefit of trading rules to society. In fact, this is usually all that is considered.

      Finance and economics are not divorced from ethics. And the finance industry's self-policing of its own practices and ethics hasn't worked out too well. Nationalise the lot of the bastards.

      The stock exchange is supposed to be about providing finance for companies, not generating ourobos-like activity for its own sake. If shares in Company A are traded back and forth in their millions over a millisecond and the share value goes up or down by 5%, this has precisely no connection to the actual value of Company A, or any real world event.

      --
      To have a right to do a thing is not at all the same as to be right in doing it
    7. Re:Just wrote a 2500 pg paper on flash trading by raddan · · Score: 1

      This is not true. While complicated software can be difficult to test, and really complicated software can often only be evaluated empirically, straightforward, mathematical software you care deeply about can be reasoned about formally, even in the presence of unusual inputs. Quantifying the behavior of algorithms is, in fact, the purpose of computer science. I don't have a deep knowledge of financial algorithms, but it would surprise me if their analysis was markedly different from other algorithms. Often, best-case, worst-case, and average-case analysis for performance/runtime can be carried out, and even with nondeterministic algorithms, bounds can be put on the likelihood of their error. Good software engineering practices (using types or assertions, which would have eliminated this particular error) can also prevent your formal assumptions from being violated. It sounds to me like the people who wrote this particular algorithm did none of this. But the presence of mistakes like this don't make the idea of algorithmic trading inherently risky.

    8. Re:Just wrote a 2500 pg paper on flash trading by Anonymous Coward · · Score: 0

      No, just used a 2500pt font.

  26. Looking good, Billy Ray! by whovian · · Score: 1

    Ripple effects are pretty scary. Good thing trading can be halted to let problems subside.

    --
    To-do List: Receive telemarketing call during a tornado warning. Check.
  27. Re:Just be happy they weren't using 64-bit integer by NatasRevol · · Score: 4, Funny

    That's a big enough subnet for everybody. /IPv6 humor

    --
    There are two types of people in the world: Those who crave closure
  28. what's a "trade order" ? by Anonymous Coward · · Score: 0

    A trade requires both a buyer and a seller.

    I'm sure if you post an offer (either to buy or to sell) for $69 trillion, there's nobody around who can take you up that offer.

    You might be liable for some sort of misuse of the service, or breaking its rules etc. but obviously you won't owe anybody $69 trillion.

    1. Re:what's a "trade order" ? by Anonymous Coward · · Score: 1

      No, that's not how exchanges work. If you put in a buy order for 0xFFFFFFFA shares, and I put in a sell order for a million shares, your order is partially fulfilled. (Assuming the prices match). It would be far too impractical to match all offers by both price and volume.

      The exception is a take-over bid in which the potential buyer may make a conditional offer for a majority, and decline to buy less.

  29. Wikileaks.... Anonymous by Anonymous Coward · · Score: 0

    ... raped it?

  30. Mismatched types in caller/callee: Re:SNAFU..... by girlinatrainingbra · · Score: 3, Insightful

    SNAFU = Situation Normal: All Fucked Up.
    That seems like the perfect description of what happened, either in terms of bad coding without type checking or input validation or in terms of the stock exchanges so frequently doing stupid things these days.
    .
    I think most likely it's a case of mismatched types between the calling function and how the function itself defines the calling variables. Errors that occured (possibly) (is there a link to the description/report that shows how this really happened?):
    .
    1 -- No Sanity Checking at Broker's end of transaction request: no validation of input at the customer or broker's computer, thus allowing a negative number entry for amount of shares to sell by the broker. aka Trusting the user to not input stupid values into a field.
    2 -- Poor division of actionsactually not spliiting BUY and SELL into two different transaction categories and letting the sign of the number be the indicator as to the intent to buy or sell
    3 -- Allowing wild extrema and outliers to affect trading: it's crazy to allow BID/buy orders at (average sale price)\dividedby(large positive integer) or to allow ASK/sell orders at (average sale price)\times(large positive integer). It's crazy for algorithms or humans to interpret any buy or sell price requests that are more than 50% deviated from the current running average price to be considered as anything other than either an anomaly or a deliberate attempt to fuck things up.
    4 -- No sanity checking at the Stock Exchange board computer:no bounds checking on the board computer that accepts the buy/sell from the brokers. seriously, shouldn't there have been at least two places this poor interpretation could have been caught?
    5 -- Unit Error / Representation Error: like letting a spacecraft go lost or kablooey by thinking the units are Imperial instead of Metric/Systeme_Internationale, maybe the order entry system represents the number X as signed long integer value, and the order-taker system (who knows what it's really called?) at the exchange interprets the number X as unsigned long integer value.
    ;>)
    Now that number (5) error seems likely to me, as I have been learning C programmng and note that since it does not do type checking, it's possible to call a function with a variable that is holding a signed long integer, but the program is written with a
    unsigned int functionname(unsigned long c1) {
    \\... code goes here
    }
    \\... more intervening stuff
    signed long int yabbadabbadoo = -6;
    signed long int resultinganswer = 0;
    resultinganswer=functionname(yabbadabbadoo);
    so the same bit-representation is seen as two things. Akin to using the same words to mean two different things.

  31. Re:Just be happy they weren't using 64-bit integer by SpazmodeusG · · Score: 1

    IPV6 is 128bits. So 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses.

  32. Immutable arbitrary-precision integers by ls671 · · Score: 1

    Nowadays, with the speed of CPUs, any financial application should use immutable arbitrary-precision integers (or floats). I worked for many banks and it was funny how either they found out by themselves before I got there or when I I had to tell them about it. Either way, they had to modify existing applications.

    There is no limit to the number one can express that way, put apart memory constraints. Just restraint input to some number equals to the estimated number of atoms in the universe and you should be fine memory wise ;-)

    In java :

    http://docs.oracle.com/javase/1.4.2/docs/api/java/math/BigInteger.html

    http://docs.oracle.com/javase/1.4.2/docs/api/java/math/BigDecimal.html

    Now, I hope anybody coding financial or accounting apps will get the picture...

    That's all for now.

    --
    Everything I write is lies, read between the lines.
    1. Re:Immutable arbitrary-precision integers by ls671 · · Score: 1

      I would like to add: That's what bc does.

      http://slashdot.org/comments.pl?sid=3229329&cid=41872165

      --
      Everything I write is lies, read between the lines.
  33. Re:Just be happy they weren't using 64-bit integer by SpazmodeusG · · Score: 1

    Oh you were talking about the subnet portion. Fair enough, that is a mere 64bit.

  34. Back in the mists of time... by Kaenneth · · Score: 1

    Dial up BBS with time limits; but you could gamble an amount of time for a 1 in 3 chance of getting double the time...

    So I gambled -50,000 minutes.

    And lost.

    Which gave me 100,000 minutes.

    Which overflowed the 16 bit counter.

    Which crashed the BBS.

    Which dumped me into a remote shell.

    Which let me read the unencrypted password file.

    That kinda thing happens when you write your own BBS software...

    1. Re:Back in the mists of time... by Anonymous Coward · · Score: 0

      You had that same dream again, 5 hours later?

    2. Re:Back in the mists of time... by Kaenneth · · Score: 0

      You can't win, I'm older and have better Karma.

  35. Ah, for the good ol' days... by jandersen · · Score: 1

    It is with some smugness that I think back to the good old days, when this kind of things were always written in COBOL - it's clunky and wonky and not at all funky, but it does have one advantage:

    http://en.wikipedia.org/wiki/Binary-coded_decimal

    In COBOL this is built in at the level of syntax and very, very easy to use, and you don't end up with binary overrun.

    Hah, they don't make 'em like they used to. (I've just become a granddad, so I have the right to say this sort of thing).

  36. Actually you can. And it was futures anyway. by ZmeiGorynych · · Score: 1

    Firstly, it's perfectly possible to buy -6 shares, it's called selling. It's even possible to buy -6 shares if you don't have any, that's called short selling and is more complicated but still possible (though illegal for some shares such as, currently, Spanish ones I believe).

    Here they were talking of futures contracts not shares, you can buy or sell as many as you want, it's totally symmetrical. And that $69T was just referring to the notional, which misleading since you don't pay the notional when you enter a futures contract - you just post margin which is a tiny fraction of that. The margin on that kind of amount would still be monstrous, but not measured in the trillions.

  37. This has happened before by slashmydots · · Score: 1

    Apparently the programmers never played Mordor 1. They had a glitch where you could create a real character and a dump character and then trade the dump character a negative money amount so their balance would be heavily negative while you actually got the positive opposite. I think that game came out like 12 year ago, lol.

  38. Re: does not do type checking by neonsignal · · Score: 2

    C does indeed do type checking; the issue here is that there are a number of implicit conversions (coercions) defined by the language.

    You can enable warnings in many compilers that will flag potential problems caused by such coercions (for example, '-Wconversion' in gcc).

  39. Re: does not do type checking by Anonymous Coward · · Score: 0

    C does indeed do type checking; the issue here is that there are a number of implicit conversions (coercions) defined by the language.

    You can enable warnings in many compilers that will flag potential problems caused by such coercions (for example, '-Wconversion' in gcc).

    it's all about the -Wall -Werror man. I'd rather see a warning and have it stop my compile and deal with it than risk, well...this!