The law of supply and demand affects the stock market by determining prices of the individual stocks that make up the market.

The major factors that affect demand for stocks are economic data, interest rates and corporate results. Economic data reveals information about the state of the economy. If the economy is doing better than expectations, it creates more demand for stocks in anticipation of better earnings.

Interest rate increases tend to lead to decreased demand for stocks as the risk-free rate of return rises. Of course, rates tend to rise when the economy is improving, which boosts demand for stocks, so these forces moderate each other. Corporations' profits, sales, margins and outlook have massive impact on demand for individual shares, accounting for the volatility that emerges before and after they release their results for the quarter or year.

While demand for a stock can gyrate based on market dynamics, economic conditions, changes to central bank policy and better-than-expected (or worse-than-expected) corporate results, the supply of stocks tends to change at a glacial pace.

Companies can decrease their own supply of shares via stock buybacks or delisting. This is when the companies purchase their own shares at market prices, retire these shares and so decrease the number of existing shares overall. This leads to higher prices as long as demand does not decrease. Delisting often occurs when a company declares bankruptcy or goes private.

Some ways that supply can increase include initial public offerings, spinoffs or issuing of new shares. Private companies become publicly listed in initial public offerings, giving them access to public markets. Each time a new company lists, it increases the quantity of stocks that compete for investors' capital.

Spinoffs are similar to initial public offerings. Existing companies divest themselves of units, which become their own stand-alone companies.

Finally, companies in financial distress or in need of capital may issue more shares of stock. This leads to drops in stock prices as the overall supply of shares increases.