2018-05-25

The Mechanics Of How Stock Prices Change

Scope And Purpose Of This Post

I've had a few people ask me, "how do stock prices change?".  They do not mean how to look at a company and try to figure out what the stock price should be; they are wondering what are the little actions going on during a price change that result in a price change.  Unfortunately, if you google "how do stock prices change", you will get a bunch of pages that answer slightly different questions, or pages that stay at the vague level of supply and demand.

This post tries to explain how price changes actually happen, mostly through examples that take place on an exchange.  The most famous exchange-traded-things are stocks, ETFs, and financial derivatives (options, futures, etc), but the underlying concepts apply to more than just things on exchanges.

A related post is Notes On How Modern Financial Markets Work, which has article snippets/paraphrasings that cover exchanges and other workings of modern financial markets.

Following Sections:
  • 2 Background Info sections: will help explain a lot of concepts that I use in my examples (bids, asks, limit orders, market orders).  People familiar with such concepts might want to skip ahead to the example sections.
  • Examples {1, 2a, 2b, 3}: the heart of the post, painting detailed pictures of prices changing, with some general observations as well. 
  • Brief Recap: briefly summarizes of the ways that prices change, restating the lessons learned in the examples.  The section might be too abstractly worded if you haven't gone through the examples, but once you have, I hope the section will help quickly refresh you on how prices change.
  • Appendix A on Price Improvement: a sidenote explaining the mechanics of "price improvement" that your brokerage may boast about after a trade.  This section may be moved in the future if I ever have a post that goes into more detail about how exchanges work.

Background Info On Exchanges And Order Books

Amsterdam Stock Exchange, 1653
An exchange is where buyers and sellers of a fungible thing can come together and offer trades to each other.  An exchange usually has an order book where you can see people's bid and ask offers.

Let's imagine a widget exchange, where people come together to trade widgets and dollars. It is common for stock exchanges to display share quantities in terms of lots of 100 shares, but our widget exchange will display widget quantities as individual widgets.

Alice declares she is willing to buy up to 100 widgets at $80 (or less) per widget, and thus her "bid" is recorded in the order book.  Bertrand declares he is willing to sell up to 200 widgets at $90 (or more) per widget, and thus his "ask" is recorded in the order book. These are basically limit orders.  Memory helper: Alice is bidding $80 for widgets, and Bertrand is asking $90 for his widgets, thus the "bid" and "ask" terminology.

Note that Alice and Bertrand won't execute a trade with each other since each of their offers is unsatisfactory to the other person.  Furthermore, let's pretend that Alice and Bertrand are the top of the book (Alice has the best/highest bid and Bertrand has the best/lowest ask).

These limit orders will remain until canceled or someone takes the other side of these limit orders.  For instance, imagine Clara tells the exchange that she wants to buy 50 widgets at the best available price, and that Clara's market order is matched with the lowest-priced asks until she gets her 50 widgets.  Since Bertrand's $90 ask is the lowest ask in the order book, Clara buys 50 widgets at $90 per widget, and Bertrand sells 50 widgets at $90 per widget, reducing his "ask" to a remaining 150 widgets.

Note that each trade has a buyer of widgets and a seller of widgets.  There is no such thing as someone buying widgets without someone selling widgets.  You can also say that each trade has a buyer of money (they buy money using widgets as payment) and a seller of money (they sell money accepting widgets as payment).

For the sake of giving some history and filling out the table below, let's pretend that before Clara's trade, the most recent trade was a week ago at 40 widgets at $82 per widget. Also, let's pretend no trade will be executed for a week after Clara's trade.

Widget Example original book after Clara's x50 buy market order
Bertrand's ask $90  x200 $90  x150
Alice's bid $80  x100 $80  x100
last trade $82  x40 $90  x50

Background Info On Various Prices

Continuing the trend of Dutch-themed images.
Prices are exchange rates, like the exchange rate of dollars for widgets, but the price of something is surprisingly nebulous, even in the context of the extremely simple example above.  What is "the" price (exchange rate) of widgets after Bertrand and Clara traded 50 widgets?  I don't think we should say there is a single widget price (exchange rate). Here are few types of prices:
  • Last trade price: the price used in the most recent trade.
  • Bid price: the price of the highest remaining bid offer.  If you're looking to sell immediately to people who have offered to buy, this will be the price your trade will happen at.
  • Ask price: the price of the lowest remaining ask offer.  If you're looking to buy immediately from people who have offered to sell, this will be the price your trade will happen at.
  • Mid price: average of the bid price and ask price.
Note that all bid offers and ask offers have offered prices, but "the bid price" and "the ask price" of something refers specifically to the prices offered at the top of the book.

At the very moment that Bertrand and Clara did their trade, I think it's fair to say the exchange rate of dollars for widgets was $90 per widget, because people were in fact exchanging widgets and dollars at $90 per widget at that moment.  But, for a while after the trade, no one is actually exchanging widgets and dollars, so how we can say there is an exchange rate (price)?

It is tempting to think that the last trade price should be considered "the" price.  For instance, we could think "the" price of widgets was $82 before Clara's trade, and "the" price of widgets is $90 from Clara's trade until the next trade.  This line of thinking becomes less tempting once you consider why people care about prices.

People often ask "what is the price of X right now?" because they are wondering what they can get via trade at that moment.  Just before Clara's trade, the last trade price of widgets was $82, but Clara was not able to actually buy any widgets at $82.  It seems silly to say, "the price of widgets is $82 right now but if you want to buy widgets right now, you'll have to pay $90".  The ask price was much more relevant to Clara: "the ask price of widgets is $90 right now, so if you want to buy widgets right now, you'll have to pay $90".

Likewise, for people looking to sell widgets immediately, the bid price tells them what price they'll be able to sell their widgets at: "the bid price of widgets is $80 right now, so if you want to sell widgets right now, you'll have to accept $80".

So, for the question "how do stock prices change?", my answer will focus on forward-looking bid and ask prices rather than merely looking at prices of a historical sequences of past trades.

Sidenote: If you want to summarize the state of the order book with a single price, I think it makes sense to use the mid price.  If stocks (or other exchanged-traded things) are quoted with a single price, that price is usually the mid price.

Price Change Example 1: Market-Buys Eroding Limit-Sells

Can you guess in which country this coastal erosion is happening?
This is an example where people buy widgets at $51 dollars at a rate faster than people are willing to supply/sell new widgets at $51 dollars.  Eventually the quantity of widgets for sale at $51 dollars is exhausted and people who want to buy widgets immediately will have to pay $52 dollars.  These events are a price increase in action.   These events are not "demand exceeding supply", they are "quantity demanded exceeding quantity supplied at the $51 price level".

Timeline of events:
  • T0: there is an existing order book, including an ask entry (limit sell order) of $51 x4.
  • T1: Daphne does a market-buy for 3 widgets, decreasing the number of widgets for sale at $51 to 1 widget.
  • T2: Ethel does a limit-sell for 2 widgets at $51, increasing the number of widgets for sale at $51 to 3 widgets.
  • T3: Frederick does a market-buy for 3 widgets, decreasing the number of widgets for sale at $51 to 0 widgets.  The best ask is now $52.

Example1 T0
original book
T1
Daphne market-buy
T2
Ethel limit-sell
T3
Frederick market-buy
ask $53  x10 $53  x10 $53  x10 $53  x10
ask $52  x6 $52  x6 $52  x6 $52  x6
ask $51  x4 $51  x1 $51 x3
mid price $50.00 $50.00 $50.00 $50.50
bid $49  x1 $49  x1 $49  x1 $49  x1
bid $48  x3 $48  x3 $48  x3 $48  x3
bid $47  x5 $47  x5 $47  x5 $47  x5
last trade ??? $51  x3 (T1) $51  x3 (T1) $51  x3 (T3)

To extend this "market-buys eroding limit-sells" to a more everyday-life context, imagine a bunch of stores offering widgets at various prices (these offers are like limit-sells).  Further, imagine a sudden increase in demand (customers executing lots of market-buys), such that stores with lower widget prices run out, and the stores with higher widget prices are the only stores with widgets in stock.

For a price decrease that is the natural flipside of "market-buys eroding limit-sells", we can imagine another situation where market-sells erode the existing limit-buys, dropping the bid price from $49 to $48 or lower.)


Price Change Example 2a: Limit-Sells Piling Up

A Dutch hotel, not a pile of houses.
This is an example where people offer to limit-sell widgets (ask offers) at the top of the book faster than people are actually buying widgets at the top of the book. As the asks pile up, and widget-sellers undercut other widget-sellers, the ask price goes down.

Timeline of events:
  • T0: there is an existing order book, where the best ask entry (limit-sell order) is $60 x4 and the best bid entry (limit-buy order) is $49 x1.
  • T1: Daphne wants to sell 5 widgets very soon, but wants a higher price than $49, so she puts in an ask (limit-sell order) of $59 x5.
  • T2: Ethel wants to buy 3 widgets immediately, and her market-buy order happens at $59.
  • T3: Frederick wants to sell 6 widgets very soon; much like Daphne, Frederick wants a higher price than $49 and figures he'll just undercut the current best ask, so he puts in an ask (limit-sell order) of $58 x6.

Example2a T0
original book
T1
Daphne limit-sell
T2
Ethel market-buy
T3
Frederick limit-sell
ask $60  x4 $60  x4 $60  x4 $60  x4
ask
$59  x5 $59  x2 $59  x2
ask


$58  x6
mid price $54.50 $54.00 $53.50 $53.00
bid $49  x1 $49  x1 $49  x1 $49  x1
bid $48  x3 $48  x3 $48  x3 $48  x3
bid $47  x5 $47  x5 $47  x5 $47  x5
last trade ??? ??? $59  x3 (T2) $59  x3 (T2)



Price Change Example 2b: No Trade Variant


Every section gets a picture.
Example 2a contains some actual trades going on (Ethel's market-buy), but let's re-imagine how things would go without Ethel's market-buy.  In this alternate scenario, the ask price would decrease from $60 to $58 even without any actual trades happening.  Price changes do not require trades to actually take place; you can just have a change of what people are offering.

Price Change Example 3: Dividends

Sometimes the pictures are relevant.
This example is a very specific "no trade" price change: the price decrease that happens to stocks when an ex-dividend date arrives.  I think this example is important because many people are caught unaware by the price-dropping consequence of dividends.

Wikipedia has a section on dividend dates that explains a few important dates related to dividends.  I will focus on just the following dates though:
  • in-dividend date: "the last day, which is one trading day before the ex-dividend date, where the stock is said to be ['with dividend']. In other words, existing holders of the stock and anyone who buys it on this day will receive the dividend, whereas any holders selling the stock lose their right to the dividend. After this date the stock becomes ex dividend ['without dividend'].
  • ex-dividend date: "the day on which shares bought and sold no longer come attached with the right to be paid the most recently declared dividend. In the United States, it is typically 2 trading days before the record date.... Existing holders of the stock will receive the dividend even if they sell the stock on or after that date, whereas anyone who bought the stock will not receive the dividend. It is relatively common for a stock's price to decrease on the ex-dividend date by an amount roughly equal to the dividend paid. This reflects the decrease in the company's assets resulting from the declaration of the dividend.
Here is Wikipedia explaining a bit more about how and why the ex-dividend date causes a change to offers in the order book:
After the close of business on the day before the ex-dividend date and before the market opens on the ex-dividend date, all open good-until-canceled limit, stop, and stop limit orders are automatically reduced by the amount of the dividend, except for orders that the customer indicated "do not reduce." This is done because the dividend payout will decrease the value of the company, as it comes directly from the company's reserves. At the market opening on the ex-dividend date, the stock will trade at a lower price, adjusted for the amount of the dividend paid.

Timeline of events:
  • T0: it's the end of trading hours on the in-dividend date.  If you have a buy order that gets filled this day, you'll get the upcoming $1 dividend.
  • T1: it's the beginning of trading hours on the next trading day, the ex-dividend date.  If you have a buy order that gets filled this day, you won't get the upcoming dividend.  The exchange has automatically reduced the price of all orders by the $1 dividend amount.

Example3 at close/end of
in-dividend date
at open/beginning of
ex-dividend date
ask $53  x6 $52  x6
ask $52  x4 $51  x4
ask $51  x2 $50  x2
mid price $50 $49
bid $49  x1 $48  x1
bid $48  x3 $47  x3
bid $47  x5 $46  x5
last trade ??? ???

Brief Recap On How Prices Change

Cap wearer can't hide his rich cultural heritage.
Example 1 illustrated people buying widgets at $51 faster than people are putting up new widgets for sale at $51.  Eventually, there are no more widgets for sale at $51 and widget-buyers will have to start buying the widgets that are for sale at $52.  This example shows how trades being executed can remove sell-offers at one price level, leaving future buyers with only sell-offers at a higher price level.  We can also imagine a similar scenario where trades being executed can remove buy-offers, leaving future sellers with only buy-offers at a lower price.

Example 2 illustrated people offering to sell widgets at lower and lower prices, because each seller is willing to sell below existing sell offers and these new sell offers are happening faster than people are taking up these sell offers (buying widgets).  Also, if no one is buying widgets at all while sellers keep on offering lower prices, this shows that prices can change even if no one is actually trading widgets and dollars.  We can also imagine things happening in the reverse direction, where people make increasing buy offers at a rate greater than people taking up these buy offers (selling their widgets).

Example 3 illustrates a special case of prices changing without any trades: a dividend causing everyone to lower their buy offers and sell offers by $1.  Remember: "This is done because the dividend payout will decrease the value of the company, as it comes directly from the company's reserves".

Appendix A: Mechanics of Price Improvement

After a trade is executed, sometimes your brokerage will boast that they provided "price improvement" on your trade.  Fidelity makes a big deal about their price improvement, but their explanations (one, two) don't actually explain the mechanism of how they get you a price better than the "national best bid or offer".  Seems weird to say something is the best, but you can do better than the best.

This Investopedia article on price improvement has some good stuff though.

Here is the explanation of NBBO and the conventional practice of looking at prices posted on multiple exchanges (this is not price improvement yet):
Understanding the National Best Bid and Offer (NBBO) is essential to understanding the nature of price improvement...the NBBO consists of the highest displayed buy and lowest sell prices among the various exchanges trading a security. Exchanges and liquidity providers can route orders to the exchange with the best quote represented in the NBBO.
The price improvement part happens because not everyone is willing to publicly post offers.  Some people/organizations might post offers in a non-public way (also, I suspect, they might respond to an order as the order is being routed):
In equity markets, various liquidity providers may choose not to display their orders to avoid revealing their trading strategy. In such a case, all available liquidity may not be displayed in the NBBO. To accommodate those traders, exchanges may allow them to post their orders anonymously, away from the publicly displayed quotes. Accessing this better-priced, non-displayed liquidity creates opportunities for liquidity providers to provide better value at execution.
So, if your brokerage reports that they gave you a price improvement on your recent trade, that means you traded with someone who had posted a non-public offer (or, I suspect, someone who responded to your order without previously posting an offer).

My suspicion about responses to orders in real-time comes from my readings about High Frequency Trading.

No comments:

Post a Comment