How a Stock Exchange Really Works

A technical-level explanation of the systems and parties involved

Jack O'Grady
The DIFEI Research Project
6 min readJun 12, 2018

--

Pay no attention to that man behind the curtain!

A lot happens behind the scenes for a simple securities trade to take place. If you’re looking to innovate in the space, then it’s important to know what’s really going on at a first principles level. With that, let’s begin.

(Disclaimer: For readers with an in-depth understanding of exchanges, the post-trade phase outlines the complex clearing and settling processes taking place behind the scenes)

Why So Much Goes On in the First Place

All of the different systems, parties, and organizations involved in trading exist primarily for two reasons:

  1. There is no guarantee of fulfillment (credit) between two trading entities. One party exchanges cash, and one party exchanges equity––but how does either know the other will follow through?
  2. There is no single, shared record of financial transactions (ledger). Each system and bank uses their own record and must continually check with all the others’ to make sure they match. As such, there is no proof of credit between institutions since they use their own private ledger.

The Trade Lifecycle

The trading process can be thought of as 3 distinct phases. Each will be described in detail, but a quick overview makes it easier to follow along:

  1. Pre-Trade Phase: the trader researches and chooses a security to buy or sell
  2. Trade Phase: the order is created and routed to an exchange to find the best counterparty and price (semi-simplified explanation)
  3. Post-Trade Phase: the obligations of each party are calculated, and money and securities are actually exchanged (very simplified explanation)

The Pre-Trade Phase

For a trade to occur, there must be a buyer looking to acquire a security, and a seller looking to liquidate their security. Thus, traders want to find a marketplace with large numbers of buyers and sellers, which increases the probability of a successful transaction.

The majority of the pre-trade phase has to do with price discovery. Prices are set in various ways depending on the market type:

  1. In an order driven market (also called a continuous auction market, ex: NYSE) prices are determined transparently by all the orders sent to the market. Buyers and sellers can buy directly from eachother via brokers, and the highest bid price is matched with the lowest asking price. [Investor A → Broker A → Exchange (simplified) → Broker B → Investor B]
  2. In a quote driven market (also called a dealer market, ex: NASDAQ), market makers (aka specialists, dealers) are always available to buy or sell a security at a publicly quoted price, thereby setting the public bid and ask price. Market makers serve as the counterparty in all deals, and investors can’t buy or sell directly to eachother. Unlike a continuous auction market, someone (the dealer) is always standing by to sell or buy a security, which increases the overall liquidity of the market. [Buy: Investor A → Broker A → Exchange (simplified) → Market maker] [Sell: Market maker → Exchange (simplified) → Broker A → Investor A]

The trader wants to minimize transaction costs beyond the price of the security. These are broken up into explicit costs (like brokerage fees, exchange fees, and taxes on the transaction) and implicit costs (the loss of price advantage due to the market impact and timing). Implicit costs from timing occur when the price changes between 1) when the order is placed and 2) when it is executed. If I see Security A at $1.00 and place an order, the price could be $1.05 by the time it is executed––creating an implicit cost of $0.05 on the trade.

Additionally, market impact occurs when a large order to buy or sell negatively affects the price of the market. A large buy order, for example, could drive up the price of the security as the transaction occurs, making each subsequent share more expensive. (This is mainly a concern for large investors, and they employ an algorithm to avoid market impact––read about Volume-Weighted Average Price (VWAP) if you’re interested). Implementation shortfall is the difference between the price of the security and what it ends up costing the buyer due to these additional costs.

The Trade Phase

The trade phase is broken up into order creation and order routing and execution. The name is a bit of a misnomer, as the trade is not actually completed (settled) during this phase. Parties are just matched and details are finalized.

In order creation, the trader chooses a security and specifies the price and quantity. Trade ticket info includes the security identifier (ticker), buy or sell flag, type of price order (limit vs market), quantity to be traded, trade date, and marketplace for the trade. This trade is then sent to the broker for execution.

In order routing and execution, the broker compares various execution options (like an over-the-counter (OTC) trade directly to another party, or an exchange) to find the best price. Once the method of trade is chosen, the broker executes (submits) the trade. To evaluate the quality of broker executions, the execution price (compared to the Nation Best Bid or Offer, NBBO), price improvement (if the price was better than the NBBO), execution speed (time between order received and order executed), and effective spread (how often and by how much the broker improves the price of trade vs price of order) are assessed.

The Post-Trade Phase

This is the most cumbersome phase of the trade lifecycle, and it comprises most of the “behind the curtain” activity. Very basically, trade details are matched between parties, the trade is cleared and settled, and potential post-trade events are processed. Reconciliation betwen the systems of different participants (utility providers, custodian banks, counterparts, etc.) continuously occurs here to find settlement mismatches.

For the sake of simplicity, we’ll just examine a broker-to-broker (versus institution-to-instituion) trade. Here’s what happens after a broker executes a trade order:

  1. The trades between the buying and selling brokers are matched on an exchange.
  2. The trade information between the parties is sent to the National Securities Clearing Corp (NSCC) for clearing, settlement, and information services. Clearing is the calculation of obligations between parties, and settlement is the final handing over of those required obligations.
  3. The NSCC determines each party’s obligations, and passes this information on to the Depository Trust Company (DTC). The DTC acts as NSCC’s clearinghouse, which facilitates the final settlement between parties. A larger company called the Depository Trust & Clearing Corporation (DTCC) owns both the NSCC and DTC.
  4. Because neither party trusts the other, the DTC becomes the central counterparty (CPP) through a process called novation to mitigate the credit risk of the transaction. Instead of Party A dealing directly with Party B, Party A deals with the CCP and Party B deals with the CCP. So, if Party B was buying Party A’s security, Party A would sell the security to the CCP for cash, and the CCP would then sell the security to Party B for cash.
  5. Once these agreements are finalized, the DTC transfers the security ownership between parties. In tandem, the brokers’ settling banks transfer money to/from the DTC using FedWire, which is powered by the Federal Reserve. At this point, the transaction is official/final.

As of 2017, it currently takes 2 days (referred to as T+2) for a trade to settle. At the time of the book’s writing in 2008, trades were settled on a T+3 basis outlined below:

T+0: Trades are executed between brokers

T+1: NSCC (via DTC) becomes the CCP

T+2: NSCC send brokers reports on trades and obligations

T+3: All trades from T+0 are settled

I found the below diagram very helpful to my understanding of the process.

Source: “Straight Through Processing for Financial Services”

Conclusion

There’s a lot going here, especially in the post-trade phase. I don’t see the concept of a trader dealing with a platform (acting as the broker) going away, but I think there’s a huge opportunity to replace the DTCC (and its various subsidiaries) using blockchain. This article was intended to be read as Part 1 of a two part piece on blockchain replacing traditonal exchanges. The purpose of this article was to provide the background information necessary to understand the benefit of a blockchain exchange––with a single, public ledger and no possibility of defaulting on a transaction (guaranteed credit).

Here’s Part 2: How a Stock Exchange Could Work (with Blockchain)

If you have any comments, questions, or insights, we’d love to hear them! Comment below or send us an email | Follow The DIFEI Research Project to get regular updates about renewable energy, blockchain, and our research.

(Source for this material: “Chapter 2: The Trade Lifecyle,” from Straight Through Processing for Financial Services)

--

--

Jack O'Grady
The DIFEI Research Project

Battery Research 🔋 | Grid Tech + Renewables ☀️ | Lowering barriers to entry for the renewable energy ecosystem