How does an exchange calculate the price of a coin? How does an exchange calculate the price of a coin? I know it has to do with the amount of sell and buy orders, but what is the formula to do this?

For example, if GDAX says one bitcoin is $10k on their exchange, how did they calculate that?
It's normally all about offer and demand.

A "formula" for an exchange could be something like: BTC price shown on the website = average amound (in $) paid for 1 BTC within the last 2 minutes [- exchange fees]

If there are 2 trades in this time:
person A buys 1 BTC for 10,000$ and person B buys 1 BTC for 10,100$, the average is 10,050$. And if there are 500 trades in the last 2 minutes, you get a more accurate average price.