Token prices are determined by the amount of each token in a pool.
The liquidity pool contract maintains a constant using the following function:
x = token0
y = token1
k = constant
Liquidity pools on the Uniswap Protocol require that the pool price is a constant K.
During each swap, a certain amount of one token
x is removed from the pool for an amount of the other token
y. To maintain
k, the balances held by the smart contract are adjusted, which changes the price.
Learn more about how Uniswap works here.