Sort:  

People put in buy and sell orders for certain prices. When they match up, an order completes. The listed price is basically an average of what prices orders are matching and completing.

I know that is how it works for CEX. I thought DEXs where instant trading if there was enough liquidity in the pool. This is where I am confused.

Can't help you there, though it seems safe to assume the mechanism is similar.

Automated Market Makers (AMMs): One popular type of DEX is the Automated Market Maker (AMM). Uniswap, for instance, relies on an AMM model. Here’s how it works:
Instead of using an order book to match buy and sell orders, AMMs use liquidity pools.
Liquidity providers (LPs) deposit funds into these pools, which consist of pairs of tokens (e.g., ETH/USDT).
When a user wants to trade, they interact with the liquidity pool directly.
The price is determined algorithmically based on the ratio of tokens in the pool.
As more users trade, the pool’s token balances change, affecting the price.
Impermanent loss can occur for LPs due to changes in token prices while providing liquidity

That's quite a bit more economic voodoo than I typically dabble in. I thought you seemed like too sharp of a guy to be asking such a simple question! 😂

lol. I had to educate myself.! !BBH

@paradoxtma! Your Content Is Awesome so I just sent 1 $BBH (Bitcoin Backed Hive) to your account on behalf of @bradleyarrow. (6/50)

AMMs rely on mathematical formulas to determine prices. For example, Uniswap uses the constant product formula:x⋅y=k
where:

(x) and (y) represent the quantities of two tokens in the liquidity pool.
(k) is a constant.

When a trade occurs, the product of the token quantities remains constant.
The price of one token in terms of the other can be calculated from this equation.