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."
Sven: Hey der Ole, check out dis new app I got on my phone here. ... 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.
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
My work here is dung.
..... the word is being abused here.
...someone forgot that putting an int into a function that expects a UINT32 is not a good idea....
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.
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.
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
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.
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
That's a big enough subnet for everybody. /IPv6 humor
There are two types of people in the world: Those who crave closure
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?