DEX Liquidity and Trading

Back

Loading concept...

🏊 The Swimming Pool of Money: Understanding DEX Liquidity & Trading

Imagine a magical swimming pool where, instead of water, there’s money—and anyone can jump in to trade or help fill it up!


🎯 What You’ll Learn

Today, we’re going on an adventure to understand how people trade crypto without a middleman. Think of it like a lemonade stand, but way cooler—and run by math instead of a person!


🌊 Liquidity Pools: The Magic Money Pools

What is a Liquidity Pool?

Picture a giant swimming pool at a water park. But instead of water, this pool has two types of coins inside it—let’s say apples and oranges (or in crypto: ETH and USDC).

A liquidity pool is just a big digital piggy bank with two different coins inside.

Anyone can come and swap one coin for another from this pool. Want oranges? Put in some apples. Want apples? Put in some oranges!

graph TD A["🏊 Liquidity Pool"] --> B["💰 Token A - ETH"] A --> C["💵 Token B - USDC"] D["👤 Trader"] -->|Puts in ETH| A A -->|Gets USDC| D

Simple Example

Imagine a pool with:

  • 10 ETH (worth $20,000)
  • 20,000 USDC

You want to trade 1 ETH for USDC. You drop your ETH into the pool, and the pool gives you USDC back. Magic! ✨


🦸 Liquidity Providers: The Pool Fillers

Who Are They?

Remember our swimming pool? Someone has to fill it with coins, right? Liquidity Providers (LPs) are like the helpful neighbors who bring buckets of water to fill the pool.

In exchange for filling the pool, they earn a small reward every time someone uses it!

How Does It Work?

  1. You pick a pool (like ETH/USDC)
  2. You add BOTH coins in equal value (like $100 of ETH + $100 of USDC)
  3. You get LP tokens (like a receipt showing you own part of the pool)
  4. Every trade pays a tiny fee (usually 0.3%)
  5. You earn your share of those fees!
graph TD LP["🦸 Liquidity Provider"] -->|Adds $100 ETH| Pool["🏊 Pool"] LP -->|Adds $100 USDC| Pool Pool -->|Gives LP Token| LP Trader["👤 Traders"] -->|Pay 0.3% fees| Pool Pool -->|Share of fees| LP

Simple Example

Sarah adds $1,000 of ETH and $1,000 of USDC to a pool. If the pool earns $10 in fees and Sarah owns 1% of the pool, she gets $0.10! It adds up over time.


😱 Impermanent Loss: The Sneaky Price Trap

What Is It?

Here’s the tricky part. Sometimes, holding your coins in a pool can give you LESS money than if you just kept them in your wallet!

It’s called “impermanent” because it only becomes real when you take your coins out.

The Lemonade Stand Story

Imagine you and your friend start a lemonade stand together:

  • You bring 10 lemons
  • Your friend brings $10

Next day, lemons become super popular! Each lemon is now worth $2.

If you had kept your lemons: 10 lemons × $2 = $20

In the stand: The math changes because people bought lemons. You might only have 7 lemons + $14 = $14 + $14 = $28… but wait, you COULD have had 10 lemons × $2 + $10 = $30!

You “lost” $2 because of how the pool works. That’s impermanent loss!

graph TD A["😊 You deposit"] --> B["5 ETH + $5,000 USDC"] B --> C["ETH price doubles!"] C --> D["😰 Pool rebalances"] D --> E["Now: ~3.5 ETH + $7,000 USDC"] F["If you just HODL"] --> G["5 ETH + $5,000 = $15,000"] E --> H["Pool value: ~$14,000"] H --> I["😱 $1,000 less!"]

When Is It Worst?

  • When prices move A LOT in one direction
  • The more the price changes, the bigger the loss

Good News!

  • If prices go back to where they started, the loss disappears!
  • Trading fees can make up for small impermanent losses

🔄 DEX Swap Mechanics: How Trades Actually Happen

The Magic Formula

DEXes (Decentralized Exchanges) use a simple math rule:

x × y = k (constant product formula)

Don’t worry! Let’s explain with cookies and milk:

  • Pool has 100 cookies (x) and 100 glasses of milk (y)
  • k = 100 × 100 = 10,000 (this number must NEVER change!)

You want 10 cookies. After you take them:

  • Cookies left: 90
  • To keep k = 10,000: milk needed = 10,000 ÷ 90 = 111.11
  • You must add: 111.11 - 100 = 11.11 glasses of milk for just 10 cookies!

The more you take, the more expensive it gets!

graph TD A["Pool: 100 ETH × 100 USDC"] --> B["k = 10,000"] C["You want 10 ETH"] --> D["New ETH: 90"] B --> E["90 × new USDC = 10,000"] E --> F["New USDC needed: 111.11"] F --> G["You pay: 11.11 USDC for 10 ETH"]

Why This Matters

  • Small trades = better prices
  • Big trades = worse prices
  • The pool automatically adjusts prices based on supply and demand!

📉 Slippage: The Sneaky Price Change

What Is Slippage?

Imagine you’re at a store. The sign says “Apples: $1 each.” You go to buy 100 apples, but by the time you reach the counter, someone else bought some, and now they cost $1.05 each!

Slippage is the difference between the price you expected and the price you actually get.

Why Does It Happen?

  1. Pool size changes while you’re confirming your trade
  2. Other people trade before your transaction goes through
  3. Network delays mean prices shift

Simple Example

  • You want to swap 1 ETH for USDC
  • Expected price: $2,000 USDC
  • Someone trades before you
  • You get: $1,980 USDC
  • Slippage: $20 (1%)

Slippage Tolerance

Most DEXes let you set a “slippage tolerance”—like saying “I’m okay if the price changes up to 1%, but no more!”

Tolerance Risk Level When to Use
0.1% Very Low Stable coins
0.5% Low Normal trades
1-3% Medium Volatile coins
5%+ High Very fast trades

💥 Price Impact: Your Trade Changes the Price!

What Is Price Impact?

Here’s something cool (and sometimes scary): YOUR trade actually changes the price!

Remember the cookie/milk example? When you took cookies, the remaining cookies became more valuable. That’s price impact!

Small Fish vs. Big Whale

graph TD A["🐟 Small Trade"] --> B["Price moves a tiny bit"] B --> C["✅ Low price impact: 0.1%"] D["🐋 Big Trade"] --> E["Price moves A LOT"] E --> F["❌ High price impact: 5%+"]

Simple Example

Pool: 100 ETH + $200,000 USDC

Trade Size Price Impact You Get Per ETH
1 ETH ~1% $1,980
10 ETH ~10% $1,800
50 ETH ~50% $1,000

The bigger your trade compared to the pool, the worse your price!

Pro Tip 🚀

If you need to make a big trade, split it into smaller ones! Or find pools with more liquidity.


🎭 Trading Pairs: The Dance Partners

What Are Trading Pairs?

A trading pair is just two tokens that can be swapped for each other. Like dance partners—they always come in twos!

ETH/USDC means you can:

  • Trade ETH → USDC, OR
  • Trade USDC → ETH

Common Trading Pairs

Pair What It Means
ETH/USDC Swap Ethereum for US Dollar Coin
BTC/ETH Swap Bitcoin for Ethereum
LINK/ETH Swap Chainlink for Ethereum

Base Token vs. Quote Token

In ETH/USDC:

  • ETH = Base token (what you’re pricing)
  • USDC = Quote token (what you’re pricing it IN)

So “ETH/USDC = 2000” means 1 ETH costs 2000 USDC.

graph LR A["Base Token: ETH"] <-->|Trading Pair| B["Quote Token: USDC"] C["You have ETH"] -->|Swap| D["Get USDC"] E["You have USDC"] -->|Swap| F["Get ETH"]

Direct vs. Routed Trades

Sometimes you want to trade TOKEN_A for TOKEN_C, but there’s no direct pool!

Example: You have LINK, want DAI, but only these pools exist:

  • LINK/ETH ✅
  • ETH/DAI ✅

The DEX automatically does: LINK → ETH → DAI (two swaps!)

This is called routing, and it might cost a bit more in fees.


🎉 Putting It All Together

Let’s trace a complete trade!

You want to swap 1 ETH for USDC on a DEX:

  1. 🏊 Liquidity Pool exists with ETH + USDC
  2. 🦸 LPs filled this pool and earn 0.3% on every trade
  3. 🔄 DEX calculates how much USDC you get using x × y = k
  4. 💥 Price Impact makes you get slightly less (pool is smaller now)
  5. 📉 Slippage might change your final amount (network delays)
  6. Trade completes! The pool now has 1 more ETH and less USDC
  7. 😱 LPs might experience impermanent loss if ETH price keeps changing

🧠 Quick Recap

Concept One-Liner
Liquidity Pool A digital piggy bank with two tokens
Liquidity Provider Someone who fills the pool and earns fees
Impermanent Loss Losing money because prices changed while in pool
DEX Swap Using x × y = k math to trade tokens
Slippage Price changing between clicking and confirming
Price Impact Your trade moving the price
Trading Pair Two tokens you can swap (ETH/USDC)

🎯 You Did It!

You now understand how DEX trading works! You know:

  • Where the money comes from (liquidity pools)
  • Who provides it (LPs) and what they risk (impermanent loss)
  • How prices are calculated (AMM formula)
  • Why big trades get worse prices (price impact)
  • Why your actual price might differ (slippage)
  • How pairs work (base/quote tokens)

Next time you trade on Uniswap, SushiSwap, or any DEX, you’ll understand exactly what’s happening behind the scenes! 🚀

Loading story...

Story - Premium Content

Please sign in to view this story and start learning.

Upgrade to Premium to unlock full access to all stories.

Stay Tuned!

Story is coming soon.

Story Preview

Story - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.