A DEX is a platform that allows users to buy and sell cryptocurrencies directly without the need for a centralized exchange. This allows for more secure and private transactions. Traditional exchanges maintain an order book mechanism. This means whenever you need to sell an asset, you place a sell order with your desired price and quantity. It comes along a buyer, and when this quantity and price are agreed upon, the trade executes.   But since blockchains operate in a decentralized fashion, no central authority maintains this order book. Therefore, decentralized exchanges that run on automatic market makers came into existence.