# How are crypto prices calculated by an exchange? Example game in a spreadsheet to illustrate [closed]

I find the mechanisms behind crypto fascinating, so I wanted to do the thought exercise of creating my own coin, and seeing how it evolves in a simplistic spreadsheet-based example such as this one:

The idea is that each month, in turn, each person (that would be me, here, every time) decides whether to buy, or sell, "Crypto" coins, and how any of them. Each person is different in the amount they already own (the creator of the coin) or the amount of money they have at their disposal.

I know that when creating a coin, the creator determines: a) how many coins it mints, b) how many coins the creator keeps, c) how many coins are injected as liquidity in the exchange, and d) for how much money when adding in the liquidity to set the initial price. The table is here populated with arbitrary data. I'm assuming here that this coin has a fixed supply and no more can be minted, to simplify things.

... Happy as a clam, I tried to run "month 2" - then I realised, that someone who believes in this coin would buy a lot of it because it's cheap, effectively all that's available as a liquidity seeing how cheap it is. What now? If nobody sells, does the exchange automatically increase the price until holders are incentivised to sell? Second, if for some obscure reason here I would not buy all the liquidity, would the price increase because someone bought it? By how much?

This made me realise that I have absolutely no clue about how exchanges calculate the price of a coin in their system. Is it always the same formula (and just the liquidity + members change) or does each exchange have their own algorithm? How could I simulate an exchange here?

This would help me tremendously if someone could actually try to "play" this example in their answer to illustrate. I'm sure this will be of interest to many as well, because I found this question around quite a lot in my research, but never has how been answered.

• This is a question on how markets price assets, and not really about bitcoin. Just imagine if you are in a room with 100 people and you wanted to sell some bitcoin, you could "ask" for \$1 million per coin, but out of the other 99 people none of them want to pay \$1 million per coin, so they put in their "bid". Eventually someone will offer to sell at a price that a buyer agrees to and you have the asset price. Some markets with low volume have very wide bid/ask spreads because there aren't enough people to provide a fair price, so many times larger exchanges have the "fairest" price. Sep 16, 2022 at 4:30
• Thanks, this is insightful. First, is there a stackexchange which is better suited to this question? I thought this was it because it applies to bitcoin as well (just replace coin with bitcoin in my text). Second, in my very limited experience of using exchanges (Binance), I don't really have a say in the ask/bid, the price is given to me. Assuming even I can set my own ask/bid prices, how is this price tag calculated? Sep 16, 2022 at 4:37
• Also, unless I'm mistaken, I still can't compute what would happen in the "what now?" case explained above. Would you care to give a possible solution? Sep 16, 2022 at 5:58
• I'd say the effect of liquidity is indirect, just as general market mood has indirect effects. Neither of them are used directly or explicitly to set a market price but both of them affect prices in one way or another. You can measure actual prices paid without needing to measure liquidity or mood. Sep 16, 2022 at 20:51

Exchanges don't calculate prices, they report them. They aggregate people who want to sell and people who want to buy and report the prices they are willing to buy and sell for. When one person is willing to sell at a price that another person is willing to buy, they facilitate that exchange and report the price.

Say you look at what's going on at a particular exchange with a particular asset. There cannot exist a person who is willing to buy that asset at a price another person is willing to sell it for. Why? Because if that were the case, they would have already transacted.

So there must be a highest price anyone is willing to buy the asset for and a lowest price anyone is wiling to sell the asset for. And the highest buy price must be lower than the highest sell price.

So may there are people willing to buy ABC for \$100 or less and people willing to sell ABC for \$101 or more. At this exchange, you can now buy ABC for \$101 or sell ABC for \$100.

This can happen for some time, with people buying ABC at \$101 and selling ABC at \$100. The trades take place at different prices (buys at \$101, sells at \$100) but the price isn't actually changing. (This is why even though every transaction is both a buy and a sell since someone is selling and someone is buying, a "buy" is still a logically different transaction from a "sell" at an exchange.)

If someone buys all the ABC that people are willing to sell for \$100, then anyone who wants to buy ABC will have to pay more than \$100 for it. That's how prices go up.

Similarly, if sells exhaust all the willing buyers at \$100 by selling more ABC than that, the next sales will have to go to buyers willing to pay less than \$100. That's how prices go down.

• Well put, thank you (+1). A couple of clarifications before I accept the answer: 1/ Does that mean that when Binance or other exchanges force le to buy a certain amount of coins for the inputted value of exchanged currency, it's really a snapshot at a given time of the lowest price I can buy this amount of coins in the exchange at this time? 2/ Can you confirm this means the buy and sell prices shown on exchanges can be very different and only depend on respectively the sellers' and buyers' offers in the exchange? 3/ What's the point of liquidity in the exchange's pool then? Sep 16, 2022 at 21:02
• 1. Yes. If you buy more than is available at the stated price, you will pay more. 2. Yes, but in practice they will be very close in efficient markets. 3. Those people willing to buy and sell are liquidity in the exchange's pool. They're what lets you go to the exchange and buy and sell because there are people already willing to sell and buy. Sep 16, 2022 at 21:20
• Excellent, thanks. I had it all wrong. I accepted the answer, thanks. As a bonus: when you create a new coin, does that mean that you basically first give some for free to the exchange itself, and buy it back for a price which is automatically accepted by the exchange in order to set the initial price reported? Sep 16, 2022 at 21:43
• Update: again, I was wrong. Looks like when adding liquidity, we're actually staking a pair, so both the token and its exchange currency - the ratio sets the price of the token. I wonder if the exchange automatically accepts a buy request up to the number staked at the reported price? I assume that if we can, as soon as we siphon the exchange, the price will go up if someone else wants to buy and offers a buy request for a higher price. Sep 16, 2022 at 22:19
• @MisterMystère Exchanges don't own tokens, they just bring buyers and sellers together and hold tokens owner by others to facilitate staking and trading. When a token changes hands between someone who wants to buy it and someone who wants to sell it, exchanges report the transaction, including the price. Someone placing a buy request for a higher price will not change the price unless nobody was willing to sell at less than that price. Sep 17, 2022 at 5:55