With a few clicks of a mouse (or taps on your smartphone), you can easily buy or sell stock. What happens next depends on whether the transaction is an agency vs. principal trade. In a nutshell, the distinction between the two is whether your stockbroker or brokerage firm uses its own inventory of securities (principal transactions) or trades with another investor (agent transactions).
Principal Trading Transactions
Your transaction is considered principal trading when your broker accesses its own securities to fund the transaction. When a brokerage holds purchased securities before selling them at an appreciated price, this generates income for their portfolio. Brokerages make money on these transactions (in addition to the commissions they charge) by profiting from the bid-ask spread. Investopedia distills the basics of a bid-ask spread as the indicator of the price at which buyers will buy and sellers will sell.
As an example, if you want to buy 200 shares of a certain stock, your brokerage acting as the principal first confirms that its inventory can support this transaction, both for the specific security and the total amount for the number of shares you want to purchase. If the principal can fulfill this transaction, it funds you from its own inventory and then reports this transaction to the proper exchange. But the Securities and Exchange Commission (SEC) mandates that brokers must complete the transaction at market-comparable rates.
Agency Trading Transactions
Investopedia notes that agency transactions are a bit more complicated than principal transactions, comprising a two-part transaction. Whereas a principal transaction stays within the confines of a single brokerage, an agency transaction extends outside the brokerage to a counterparty investor. For the first part of an agency transaction, a brokerage must find a suitable counterparty among scores of potential investors, maintain exact bookkeeping and settle funds for a successful and legal transaction.
After a successful trade is completed and documented on the proper exchange, the agency transaction must then go through the clearing process, which ensures the timely and successful transfer of securities (to the buyer) and funds (to the seller). Even though individual brokers record their own transactions, a larger institution called a clearinghouse is responsible for clearing these transactions. The Depository Trust and Clearing Corporation (DTCC) handles most of the clearing for transactions in North America.
Instead of individual brokers reconciling each transaction, the National Securities Clearing Corporation (NSCC), which is a subsidiary of the DTCC, matches the actual buys and sells of traded securities to ensure their accuracy. If everything matches, the transactions are recorded and the NSCC gives settlement instructions to the DTCC. The DTCC then notifies all parties of their obligations and then facilitates the funds and securities transfers to brokers who made the sales. It's then the responsibility of the brokers to adjust their clients' records to reflect the transfers.
After an average two-business-day completion time, the clearing process is complete. Investopedia points out that the DTCC serves another important function. It not only facilitates agency trading transactions, but also guarantees delivery of securities and funds. If either party to a transaction fails to deliver, the DTCC still delivers the securities to the buyer and the funds to the seller. This settlement process and guarantee of delivery fosters investor confidence and minimizes investor risk.