It was a network of human beings, like branches on a tree or blood vessels.
An individual investor would call (or write, or telegraph) their local stock broker to place a trade. The broker would first collect all the trades in-house from all their local branches to a central location (usually New York). For big brokers (and this is still true today), many of these trades could be canceled out in-house as well (if one customer wanted to sell 1000 shares, and another one wanted to buy 500, then the net amount the broker had to go buy was only 500 shares, because they’d just swap off between their customers).
Then the brokers themselves would do the same thing feeding into the stock exchange floor (such as the most famous New York Stock Exchange). The brokers would place their orders by phone or by wire (telegram-ish) to someone with a seat on the exchange. Those guys would likewise first trade in-house and then contact their agents on the floor regarding any net sales remaining.
The guys inside the exchange house getting the call and wire instructions would then communicate via hand signals (and also by shouting). Guys on the balconies would send signals to the traders on the floor.
Then, finally the guys on the floor who were agents of the different brokers would group together in little circles divided up by industry, and trade with each other, bidding up or bidding down stocks in order to complete their sales. For example one guy might say (using special verbal codes and hand signals) “I offer to buy 10,000 shares of US Steel for $3 per share” and someone else would say “I offer to sell 50,000 shares of Alcoa for $1.45 per share”. The largest companies might even have their very own “pit” with a group of guys just for that one stock.
If someone else was ready to sell (or buy) at the named price, they would signal back and each broker would write down on a card who they bought or sold what to, and hand it to a “runner” who would take the cards back to accountants who would double-check and then record the trades back up the chain, to the traders, and the brokers and then the stockholders.
Before any computers, the time needed to transmit all these communications and double-check all the records was enormous. This is why banks and the stock markets used to be open only for limited hours each day (e.g. from 10 a.m. to 4 p.m. “banker’s hours”) because the rest of the day and night was often spent sorting out what happened the previous day and getting ready for the next day.
This is also part of the reason why the stock markets still operate in units of “trading days” because it was often impractical for anyone except the largest, most sophisticated brokers to try to make money by trading on within-day fluctuations in price.
[Here](https://www.youtube.com/watch?v=JeowCPwpRxM) is a video from the 1950s showing the system at that time.
[Here](https://www.youtube.com/watch?v=73k4cADaiO8) is a video of trading in the 1970s when they started to transition to using computers for parts of the operation. You can still see hand signals and cards being used for the floor actions.
Latest Answers