How Does an Automated Market Maker (AMM) Calculate the Price of a Token Pair in a Liquidity Pool?
An AMM typically uses a constant product formula, $x y = k$, where $x$ and $y$ are the quantities of the two tokens in the pool, and $k$ is a constant. When a trade occurs, the ratio between $x$ and $y$ must change to maintain the constant $k$.
This change in ratio dictates the new price of the tokens relative to each other. The larger the trade relative to the pool size, the greater the price change.