Image caption Trading places: The frantic dealer floors of the 1980s have been replaced by vast ranks of computer servers

"Humans cannot compete on speed, it's as simple as that."

Ten years ago, John Coates was a trader in Wall Street.

Today, he is a neuroscientist at Cambridge University, and spends his days monitoring traders' hormones to see what makes them tick.

"There are simple tests you can do. When you see a green light... you click a mouse. The fastest you can do that is 100 to 120 milliseconds. Any basic cognitive processing, figuring things out, then maybe 200 to 300 milliseconds.

"The trouble is, the boxes - last time I looked - they were processing a trade in 10 milliseconds, and today I think... we're talking about millionths of a second."

Those "boxes" are the robot traders - computers that make their own decisions about when to buy and sell, but a thousand times faster than any human can.

They operate algos that effectively are mimicking what traders used to do Remco Lenterman, Director of trading firm IMC

When you think of a trading floor in London or New York, perhaps you imagine a gaggle of sweaty men elbowing each other out of the way as they use elaborate finger movements to convey their frantic orders.

It's an image popularised by the 1980s comedy Trading Places. But it's also 30 years out of date.

For the fact is that financial trading has undergone a computerised revolution akin to Amazon's takeover of the High Street. All the real action has moved to cyberspace.

Take the New York Stock Exchange. These days, most trading does not take place behind its famous neoclassical facade just off Wall Street, but in far less glamorous New Jersey.

That is where the NYSE has set up a vast electronic trading facility covering 10 acres (four hectares), housing row upon row of computer servers.

And many more acres are occupied by the servers of the robot trading firms hooked up to it.

Nerdy brainboxes

Computerised trading is an inherently secretive world.

The trading firms keep a tight hold of their trading strategies, people and computer code (or "algorithms").

Otherwise a rival might figure out their complex-yet-fully-automated trading patterns, and then copy them, or worse still, dupe their computers into handing over millions.

Image caption The loadsamoney traders of the 1980s have been consigned to the dustbin of history

Remco Lenterman, a director at one such firm, IMC in the Netherlands, is trying to demystify his business.

He says: "In the old days, 10 years ago, a desk of equity traders would have between 80 and 100 of human traders at an investment bank. Today there's maybe eight of them left.

"What they do is operate algos that effectively are mimicking what traders used to do, and they're tweaking constantly these algos and monitoring the risk of what goes on in the market."

In other words, the iconic high-testosterone Loadsamoney traders of the past - the "Masters of the Universe" derided by the American author Tom Wolfe in the Bonfire of the Vanities - have been ousted by "quants", the nerdy brainboxes who design and run the computer programs.

In a recent post-script to his novel written for the Daily Beast, Tom Wolfe lamented the emasculation of his anti-heroes, renaming them "Eunuchs of the Universe".

Closer servers, straighter cables

Firms such as Lenterman's make their money by scraping a tiny profit margin on an unthinkably huge volume of rapid-fire buying and selling.

Different algo traders use very different strategies. But they all share the need to identify trading opportunities - fleeting discrepancies between the available market price and where the computer deems the price ought to be - and then react to them faster than anyone else.

Race to zero The options available late last year for anyone wanting to send an electronic trade order between New York and Chicago: *time required for a complete round-trip Source: Wired Magazine

It is called the "race to zero". And it has led to the investment of billions of dollars in faster, smarter computers, and in the fastest possible connections.

At stock exchanges across the planet, traders pay hefty fees to "co-locate" their servers directly next to the exchanges.

And hundreds of millions have been spent on building straighter cables to shave a few fractions of a second off the time it takes to transmit orders between the world's big trading centres: London, New York, Chicago and Tokyo.

All this can seem a little irrational when the UK and US governments are struggling to scrape together enough money to upgrade the infrastructure needed to ferry humans from one place to another.

Flash Crash

There is, however, a darker side to this rush to computerise.

For example, accidents can happen.

Last August, the hi-tech financial firm Knight Capital was brought to the verge of bankruptcy by an algorithm that went haywire, racking up more than $440m of losses in just 45 minutes before it was switched off.

Perhaps the most famous mishap was the now legendary Flash Crash, at 2.45pm in New York on 6 May 2010.

In a few minutes the New York Stock Exchange plunged, and then just as suddenly recovered again. Share prices in some firms, such as the consultancy Accenture, plummeted to a fraction above zero, while Apple soared to $100,000.

For months afterwards, nobody could explain what had gone wrong.

The official US regulatory investigation said it had been triggered by a single order, placed by a large institution, using an algorithmic trading strategy.

But, what made things far worse was a "hot potato" effect: amid the confusion, one by one the robot traders tried to cut and run, and the stock exchange's computers got swamped.

'Outright manipulation'

The new algorithmic traders have also been accused of some fairly old-school nefarious behaviour.

Eric Hunsader, of the US data analysis firm Nanex, says miniature versions of the Flash Crash happen in individual stocks many times a day, and he alleges that a lot of it is outright manipulation.

He has produced charts depicting the weird and wonderful behaviour of markets, as computers seek to outfox one another by rapidly generating and then cancelling thousands of orders a second.

Image caption A Nanex chart illustrating the Google mini-flash crash of 22 April this year

"We allow people with faster connections to place and remove offers or bids faster than the speed of light can deliver that information to the other market participants."

And he is not the only one concerned that some computerised traders might be up to no good.

"Unfortunately the nature of markets is that there always is potential for abusive activity, and with very, very fast trading, these things can happen very, very fast," says Martin Wheatley, head of the UK's newly created Financial Conduct Authority.

"Frankly, for the regulator, it creates a problem trying to pick out from the vast amount of data trades that potentially might be abusive."

A Dark Magic, presented by BBC Business Editor Robert Peston, will be broadcast on Radio 4 at 0900 on 8 July 2013, and will be available on the BBC iPlayer afterwards.