I am learning solidity. I want to ask how does the value of the token is calculated. Like how does the value of a coin increase and decrease in a programmatical way? which technology or method is used to calculate the value of a cryptocurrency.
2 Answers
There are some different models for this. Most popular are: Order book and AMM (Automated Market Maker).
Order book method is very likely to Centralized Exchanges.
Uniswap, sushiswap, pancakeswap etc. are AMM. They use a method called constant market formula
. For more info you checkt it this.
This is a general price discovery question: https://en.wikipedia.org/wiki/Price_discovery
Basically, prices are where buyers and sellers meet and with tokens it's no different. AMM's like Uniswap have ways of finding this price, and orderbooks or auctions are another.
If the question is more dev focused and how to read it, you can either read a price directly from a dex (like Sushi or Uni) or you'd need an oracle like Link, Tellor, or similar to pull on CEX prices.