When Peterffy was a kid growing up in communist Hungary in the 1950s his buddy went to Austria and brought back a pack of Juicy Fruit gum. Peterffy bought the pack, broke the sticks of gum up into little pieces, and sold them at a profit. The principal at his school was not amused. "Where's your communist conscience?" the principal asked.

Not surprisingly, given story #1, Peterffy moved to the U.S. as a young man.

Story #2:

By the 1970s, Peterffy was working at a company trying to use computers to make money on Wall Street. (This was a novel idea at the time.)

Peterffy figured out how to use computers to calculate when financial instruments called options were overpriced or underpriced. But he had a problem. It was 1977, and people weren't yet using computers to buy and sell options. They were still standing in trading pits, waving their arms and yelling to do trades.

Peterffy tried bringing binders of computer printouts to the trading floor to guide his buying and selling. But this was slow and inefficient. So he and some engineers tried to build an early tablet computer — a proto-iPad — to bring to the trading floor. The tablet worked, though one burst into flames on the trading floor.

Story #3:

It wasn't until 1987 that Peterffy was able to take people out of the loop entirely. With the world's first electronic stock exchange, the NASDAQ terminal, traders could type in orders directly into a computer.

Peterffy didn't want to type in the orders. He and his engineers hacked into the NASDAQ terminal and wired it up to their own computer, which traded automatically based on algorithms.

A senior NASDAQ official saw Peterffy's setup and said Peterffy was breaking the rules: All orders had to be entered through the keyboard. He gave Petterfy's group one week to fix the problem.

Peterffy and his engineers came up with a solution. They built a robot with rubber fingers that typed entries into the keyboard. It satisfied the NASDAQ rules. And on active trading days, the robot typed so fast it sounded like a machine gun.

In the 1990s, over a decade after Peterffy dreamed up computerized trading, exchanges start to let people plug their computers directly into the markets.

'Absolutely No Social Value'

Today, Peterffy is one of the big players. The company he started, Interactive Brokers, does electronic trades on a mind-boggling scale. Forbes estimates his net worth is now over $5 billion.

Peterffy says automation has done some very good things for the world. It's made buying and selling stocks much much cheaper for everyone.

But Peterffy thinks the race for speed is doing more harm than good now. "We are competing at milliseconds," he says. "And whether you can shave three milliseconds of an order, has absolutely no social value."

Peterffy is in favor of more regulation. He'd like to see rules that slow things down.

The challenge of course: People will try to find ways around the rules. There is always someone willing to build a robot that types.

Note: We learned of Peterffy's story from the forthcoming book Automate This.

Copyright 2013 NPR. To see more, visit http://www.npr.org/.

Transcript

AUDIE CORNISH, HOST:

From NPR News this ALL THINGS CONSIDERED. I'm Audie Cornish.

MELISSA BLOCK, HOST:

And I'm Melissa Block. By one estimate half of all stock trades now involve a computer which decides on its own to buy or sell. Computerized trading has helped markets function more efficiently, but it's also led to some spectacular messes. Just this month, one firm suddenly lost $440 million dollars because of a computer glitch. NPR's David Kestenbaum of Planet Money visited one of the fathers of computerized trading to explore how he got to this point.

DAVID KESTENBAUM, BYLINE: Thomas Petterfy grew up in Hungary after World War II. His first experience with trading happened when he was around 12. A friend went across the border to Austria and brought back something truly precious.

KESTENBAUM: Petterfy cut each stick into five small pieces, and sold the pieces to his friends at school for a profit.

PETTERFY: Eventually, the principal found out about this and called me down into his office and he said, well, where is your Communist conscience? And I didn't know what he was talking about.

KESTENBAUM: Was that your first time buying low and selling high?

PETTERFY: That is correct.

KESTENBAUM: Petterfy eventually makes his way to the United States, where he meets his first computer - a big boxy, calculator of a thing - and he falls in love, stays up all night programming it. And eventually, gets a job at a company that is trying to use computers and math to make money on Wall Street. In particular there are these complicated things called options or derivatives. They give you the right to buy, say, a certain stock at a certain price on a specific date. It's hard to calculate what one should cost, but Petterfy, with a computer, he finds a kind of secret formula.

PETTERFY: It took me about nine months to figure this out. But once I figured it out, it was a fantastic feeling.

KESTENBAUM: Because it meant there was a way to price them.

PETTERFY: That's right.

KESTENBAUM: And a way to make money. But this is 1977, and Petterfy has a problem. Trading isn't done on computers. You have to go stand in a pit on a trading floor and wave your hands around and shout. Petterfy can't bring his computer onto the floor, so he prints out mathematical tables on paper and puts the pages in a big binder. He brings this big binder down onto the trading floor.

PETTERFY: People looked at me - what the heck is that? And so I said, well, you know, these are my numbers that will help me trade hopefully. They made funny faces and, you know, many of them didn't understand my accent and it was - I didn't feel very welcome there.

KESTENBAUM: Every time Petterfy tries to use computers to trade, it's like the world just isn't ready for it yet. He hires some engineers who help him build these early tablet computers which work - though one burst into flames on the trading floor. It isn't until 1987 that Petterfy finally is able to take people out of the loop entirely. It happens at NASDAQ, the world's first electronic stock exchange. Meaning, there is no trading floor. You buy and sell by typing orders into a computer - a NASDAQ terminal. Petterfy, of course, doesn't want to have to type in orders. So, he and his engineers hack into the terminal. They wire it up to their computer, which starts trading up a storm; so many trades that a high up official with NASDAQ comes by to see what's going on. And the guy sees just this one terminal attached to a computer.

PETTERFY: He looks and looks and looks and he says, well, so tell me again how you are doing this? So I explained to him what's happening here. And then he says, I don't think you can do this, but I really don't think, but let me go back to my office and let you know.

KESTENBAUM: The man calls back and says I'm sorry. The NASDAQ rule book says you can't go cutting wires. All orders have to be entered through the keyboard. You have one week to fix it.

PETTERFY: So this was a problem.

KESTENBAUM: Petterfy and his engineers come up with a solution. Trades have to be entered on the keyboard? Fine. They build a machine to do that.

PETTERFY: So it was basically they were rubber fingers that were typing.

KESTENBAUM: You built a robot to type in the trades.

PETTERFY: We built a robot that types.

KESTENBAUM: What did that thing sound like when it was running?

PETTERFY: Like a machine gun. Brrrrr. Because it was typing so fast.

KESTENBAUM: Finally, in the 1990s exchanges started to let people just plug their computers directly into the markets. Today, Petterfy is one of the big players. The company he started, Interactive Brokers, does electronic trades on a mind-boggling scale. Forbes estimates his net worth is now over $5 billion dollars. Petterfy says automation has done some very good things for the world. It's made buying and selling stocks much, much cheaper for everyone. But Petterfy thinks this race for speed, it's doing more harm than good now. It's an arms race, like the U.S. had with the Soviets.

PETTERFY: We are competing at milliseconds. And whether you can shave off three milliseconds in the execution of an order has absolutely no social value.

KESTENBAUM: Petterfy is in favor of more regulation. Rules that will build in some safeguards and slow things down. The challenge, of course, people will try to find ways around those rules. There's always somebody willing to build a robot that types. David Kestenbaum, NPR News.