Key Learning Tasks
  • Learn the basics of a dynamic version of the supply and demand model
  • Explore adding buyers and sellers to this model and visualizing their interactions
  • Watch how the market adjusts when buyers increase their demand

1. Introduction to the Dynamic Supply and Demand Model

Let's now consider a setup where the market outcome is simulated rather than predetermined. As in the classic model, a market still consists of a set of buyers that have reservation prices and a set of sellers that have marginal costs. However, in this new setup, market prices are driven not by the requirement that quantities balance but directly by the simulated push and pull between sellers and buyers who have different interests.

Specifically, the dynamic model presented here modifies the classic model in several key ways:

We'll discuss the assumptions of the dynamic model in the next section, but for now let's review how the model functions in more detail. As before, sellers need to sell their product above their marginal cost to avoid negative profits. If we assume that their preference is to sell their product for as much as they can, and if they actually attempt to sell their product for more than their marginal cost, there will be upward pressure on prices.

Conversely, buyers need to buy the product for no more than their reservation price because, above this price, they are either unwilling or unable to make the purchase. If we assume their preference is to buy the product for as little as they can, and if they actually attempt to find the best deal that they can, there will be downward pressure on prices.

In the simulation, it is the interplay of these dynamics that guides prices to some sort of a middle point. But there are two critical questions: what determines how much each seller offers their product for? And what determines whether a particular buyer will purchase from a particular seller?

As a starting point, let's assume that sellers initially attempt to sell their product for exactly their marginal cost, which results in zero profits. If they're successful in selling at least some of their inventory, then they increase their price part of the way towards the highest sales price that they see in the market (under the reasoning that, if another seller is able to sell at that price, then maybe they can too). If at some point they're not able to sell any of their inventory, they decrease their price part of the way back towards their marginal cost. In the simulation, this process repeats over many rounds, where in each round, inventory is restocked and prices are adjusted.

For buyers, let's assume that they simply buy the product at the lowest price that they can find. In the simulation, this is implemented by first making tentative matches between all buyers (who have not yet satisfied their demand) and all sellers (who still have remaining inventory). If a buyer is tentatively matched with a seller who is offering a price that is below the buyer's reservation price—and the price is also the lowest price that the buyer can see across all remaining sellers—then the buyer and seller form a confirmed match. Once a buyer satisfies all of their demand, they are removed from the tentative matching process for the remainder of the round. Similarly, once a seller runs out of inventory, they are also removed from the tentative matching process for the remainder of the round. This tentative/confirmed matching process repeats within each round until it's not possible to make any more matches.

Here we present the matching process in more detail. For simplicity, let's assume that each buyer only has one unit of demand in each round and each seller only has one unit of inventory in each round. Let's also assume that buyers are able to see all sellers (when searching for the lowest price) and sellers are able to see all other sellers (when looking to increase their own price). We'll explore variations on these assumptions later in the module. In pseudocode, the algorithm works like this in each round:

  • Create a list (call it UB) of buyers who are unmatched in the current round. Initialize this list to contain all buyers.
  • Create a list (call it US) of sellers who are unmatched in the current round. Initialize this list to contain all sellers.
  • Set all of the sellers' offer prices to initially be equal to their respective marginal costs.
  • While there is at least one buyer in UB with reservation price above the marginal cost of at least one seller in US, do the following steps repeatedly:
    • Randomly create tentative matches between the buyers in UB and the sellers in US (if there is an uneven number of buyers and sellers in the market, some buyers or some sellers may not be placed in a tentative match).
    • Remove all tentatively matched buyers from UB and all tentatively matched sellers from US.
    • For each tentative match:
      • If the buyer's reservation price is above (or equal to) the seller's current offer price, mark this tentative match as a confirmed match.
      • If the buyer's reservation price is below the seller's current offer price, put the buyer back in UB and put the seller back in US.
  • For each seller in the market:
    • If the seller is still in US, then they did not enter a confirmed match this round, so reduce their offer price downwards towards their marginal cost.
    • Otherwise, increase their offer price upwards towards the highest offer price across all confirmed matches in this round (as long as that price is higher than their own offer price in this round).
  • Repeat from the beginning.

Each time this process repeats, we have a set of confirmed matches within a round, including the exchange price for each match. The visualizations in this module present these matches and prices in various ways.

Let's consider this with a concrete example. Below we create a market with a set of 20 buyers that have random reservation prices and a set of 20 sellers that have random marginal costs. We then simulate 30 rounds given the logic described above. Click on the "Generate Data" button to get the data ready. Once the diagram appears below that, click on the "Run" button to see it in action.

Click "Generate Data" to view results

The larger orange circles represent the sale price for each seller in each round. The circle is connected by a line to the seller below it, which shows that that seller is the one making that particular sale. Note that these larger orange circles start on top of their respective sellers' circles and then move upwards. As described above, this reflects that each seller first sets their price equal to their marginal cost and, if they're able to make a sale, they slowly increase their price towards the highest sale price that they can see in the market.

Note that, in the context of this dynamic model, we're saying average price rather than equilibrium price and total quantity rather than equilibrium quantity. There are two primary reasons for this. One is that there may be more than one exchange price in the market, which is referred to as price dispersion. We'll talk about price dispersion more in later sections. The other reason is that the dynamic model is not built around the concept of equilibrium but instead focuses on the evolution of the market over a series of rounds. Depending on the particular dynamics in each simulated market, it's possible that the average price and total quantity do not come to a stopping place, as both buyers and sellers are continuously reevaluating and reacting.

This behavior results in a dynamic where sellers move their prices towards the price of the seller on the "margin" that is, towards the seller that sits at the point where the buyers' reservation prices go from being above the sellers (on the left) to being below the sellers (on the right; this corresponds to the point where the demand curve and the supply curve cross in the classic model). Over enough rounds, the average price (indicated by the horizontal black line) and the total quantity (indicated by the vertical black line) move to the same intersection that we would expect in the classic model.

Let's explore what happens if we "shift" the demand curve out. One of the ways this can happen is if buyers want more of this good than they did before, perhaps because the price of a good in a competing market has increased (more on this later). For our example here, let's increase the demand for all buyers from one to two. Click on the "Generate Data" button to get the data ready, and then click on the "Run" button to see what happens.

Click "Generate Data" to view results

As the classic model would predict, we see that both the average price and the total quantity have increased. However, unlike the classic model, the dynamic model illustrates how the price change comes about: when the demand curve shifts, it creates space above the sellers so that they're able to raise their prices. Specifically, the seller that was on the margin is no longer on the margin; a new seller (with a higher marginal cost) that previously was unable to participate in the market is now able to participate in the market. This seller now sits on the margin and, as its price is higher than the other sellers' prices, it shows them that they, too, can increase their prices. Over a number of rounds, more sellers participating in the market increases the total quantity, while increases in individual sellers' prices increases the average price.

Note that the dynamic model also suggests a path from the previous average price and total quantity to the new average price and total quantity. Specifically, we see that the quantity increases rapidly, while the average price increases over a number of rounds. This is due to the fact that it only takes buyers at the top of the demand curve a single round to fulfill their additional demand, while it takes multiple rounds for sellers at the bottom of the supply curve to increase their prices. This dynamic depends, of course, on the assumption that buyers can immediately purchase more of the product while sellers only raise their prices incrementally. Although this pattern would change somewhat if we were to adjust the speed with which sellers adjust their prices, we generally expect quantities to adjust more quickly than prices in this situation (in the way the dynamic model is formulated here) because it is new (higher-priced) sellers successfully selling into the market that induces existing sellers to raise their own prices.