Chapter 4 Dollar-Cost Averaging (DCA)

In Quickstart, I had you open a UniV3 LP position with $25 of ETH and $25 of USDC. I also showed you how to measure its performance by

  1. comparing against its initial value at position open time, and
  2. comparing against the hypothetical scenario of holding the coins in wallet.

Let’s formally introduce the metrics:

  1. position Capital Gain or Loss (CGL) = Current Liquidity Value - Initial Liquidity Value.
  2. Impermanent Loss (IL) = Current Liquidity Value - Current Hodl Value.

Mathematically, these can be written as

  1. \(pCGL(t) = LV(t) - LV(t_0)\), where \(LV\) stands for Liquidity Value.
  2. \(IL(t) = LV(t) - HV(t)\), where \(HV\) stands for Hodl Value.

Let’s also throw in the mix a third metric:

  1. hodl Capital Gain or Loss (CGL) = Current Hodl Value - Initial Hodl Value, and its math equation is \(hCGL(t) = HV(t) - HV(t_0)\), where \(HV\) stands for Hodl Value.

Remark:

  • Initial Hodl Value is equal to Initial Liquidity Value by definition, i.e., \(HV(t_0) = LV(t_0)\).
  • \(pCGL(t) - hCGL(t) = LV(t) - HV(t) - (HV(t_0) - LV(t_0)) = LV(t) - HV(t) = IL(t)\).

Let’s understand pCGL, hCGL, and IL better through two fictitious examples where we ignore fees and gas costs.

4.1 One-sided liquidity provision

The simplest concentrated liquidity provision involves a volatile coin1 and a stable coin2 and has either one of the following setups:

  • Open a one-sided position by sending only the volatile coin to the pool and choosing a price range above the price of the volatile coin. So the position starts with 100% volatile coin. When price goes above the lower limit (\(p_0\)) of the price range, the position will start earning fees. As price moves higher, the position will hold less of the volatile coin and more of the stable coin. When it goes above the upper limit (\(p_1\)) of the price range, the position will be 100% stable coin and the effective sell price (or DCA-out price) is \(\sqrt{p_0*p_1}\).

  • Open a one-sided position by sending only the stable coin to the pool and choosing a price range below the price of the volatile coin. So the position starts with 100% stable coin. When price goes below the upper limit (\(p_1\)) of the price range, the position will start earning fees. As price moves lower, the position will hold less of the stable coin and more of the volatile coin. When it goes below the lower limit (\(p_0\)) of the price range, the position will be 100% volatile coin and the effective buy price (or DCA-in price) is \(\sqrt{p_0*p_1}\).

Any two-sided position, whether 50-50, 60-40, 80-20, 90-10, or any other ratios, can be decomposed into 2 one-sided positions. We’ll prove this later in the book. Let’s now look at two fictitious one-sided ETH-USDC positions.

4.1.1 DCA out of ETH via ETH-USDC LP

Initially, ETH price was $3100 and we bought 0.05 ETH; we then sent them (and 0 USDC) to the liquidity pool and set a range between $3100 and $3300, resulting in a DCA price of $3198.44. Ten days later, ETH price jumped to $3800; consequently, the 0.05 ETH was sold to 159.92 USDC, netting us a position capital gain of $4.9. Had we held on to the 0.05 ETH, it would be worth $190, giving us a hodl capital gain of $35. The LP’s impermanent loss was -$30.08, and it’s exactly the difference between position and hodl capital gains.

Provide ETH liquidty from the bottom between $3100 and $3300
Provide ETH liquidty from the bottom between $3100 and $3300

When entering a LP position one-sided from the bottom with volatile coins, the size of IL is often much bigger than that of pCGL:

  • If price pumps, you will have a positive pCGL and a much bigger negative IL. Your default reaction is to kick yourself for having LP’ed, while praying the fees can stack up quickly.
  • If price dumps, you will have a negative pCGL and 0 IL. You will wonder if you are on the path to bag-hold the volatile coin into oblivion.

Of these two scenarios, the second one is objectively worse than the first one, although you may feel worse about the first one. The best scenario is when price pumps and dumps so you get to earn some juicy fees and have the volatile token back with 0 IL, and price moons after and you exit near ATH. It’s easier said than done. I half-successfully did it with the ARB airdrop, which I will go into details in a later chapter.

4.1.2 DCA into ETH via ETH-USDC LP

Initially, ETH price was $3800; we sent 200 USDC (and 0 ETH) to the liquidity pool and set a range between $3800 and $3600, resulting in a DCA price of $3698.65. Ten days later, ETH price dropped to $3100; consequently, the 200 USDC got converted to 0.05407 ETH ($167.63), netting us a position capital loss of -$32.37. Had we held on to the 200 USDC, we wouldn’t have lost a penny. The LP’s impermanent loss was also -$32.37, and it’s exactly the difference between position and hodl capital losses.

Provide USDC liquidty from the top between $3800 and $3600
Provide USDC liquidty from the top between $3800 and $3600

When entering a LP position one-sided from the top with stable coins, pCGL and IL are the same. This is because hodl value never changes in this case: it’s always the USD value of the amount of stable coins sent to the pool.

4.2 pCGL vs. IL

Recall that pCGL happens when we compare the value of a LP position against its initial value, and IL happens when we compare its value against the counterfactual scenario of spot-holding. When price of the volatile coin pumps, it’s easy to end up with a positive pCGL and a negative but much bigger IL. This makes people uneasy, even though they made money, because they would’ve made more money by simply holding the coins in wallet. But what are the chances that you could have predicted the pump? And every pump thereafter? You say, “I don’t predict the next pump. I’m playing the ultra-long game. I’ll own BTC and enter in a coma and wake up in 10 years. I bet I will do better than LP.” To that, I say, “It’s easy to be optimistic because crypto market has been booming for the past 15 years. But I wouldn’t rule out the ‘in the long run we are all dead’ possibility.” There is some wisdom in the old saying: “A bird in hand is worth two in the bush.” So set aside some money for LP and monitor both pCGL and IL. When you have a positive pCGL, know that you’ve made money, be content and accept the accompanying IL.

Don’t try to beat IL.

People say your goal as a liquidity provider is to beat impermanent loss with swap fees and token incentives. That’s too lofty. It’s difficult to beat IL! That’s because when price ranges, especially in a depressed environment, swap volume is usually low, which leads to lackluster swap fees and hence low yield. High yield usually occurs while price is going up, but price usually jumps and leaps and moons in days, so LPs don’t get to eat the juicy yield for long before price goes out of range, resulting some humongous IL.

It’s unfortunate that people only use IL for LP but not for trading, when in fact, every time the price reaches a new high and you don’t sell before it comes back down, you also experience another kind of IL3. People are scared of LP because of IL, not realizing that they get it worse in trading where they often don’t even get to experience the “impermanent” phase. Recall how many times after you sell your bag, price mooned another 20% or doubled or tripled! How many times you lamented, “had I held my bag…”

Your goal as an LP is NOT to beat IL, at least not for any one position4. In fact, you will almost surely experience IL as price climbs up. Don’t be a hoarder. When price moves above your price range, let go of the volatile coin and close the position. There’s no perfect profit-taking, so take profit early and take profit again, resolutely and ruthlessly. Do not let IL distract you, for if you do, you can get ruined. Now let me tell you two stories: first, a ruin story, and then, a success story.

The LUNA-UST Debacle

At the time of writing, LUNA (Terra Luna Classic) is trading at $0 and UST (Terra Classic USD) is at 1.5 cents. But back in their glorious days, LUNA was championed the blue chip asset that would hit $1000 by the end of 2022, and UST was the algorithmic stable coin DeFi needed to fulfill its decentralization promise. At the peak, UST had a market cap of 18.7 billion US dollars5 and LUNA had a price of $120. I was one of the suckers that hoarded LUNA and refused to take profit. It was difficult to take profit because price kept going up, community was strong, and there were many opportunities to earn a good yield on LUNA and UST. For example, V2 pools6 of LUNA-UST on Terraswap and Astroport yielded 20%+ pretty much all the time, and sometimes as high as 150%. I provided LUNA and UST to these pools whenever the yield was attractive. The following tables shows some of my record. Let’s go through the top chunk:

  • January 29, 2022: I opened a position with 11.73 LUNA (50%) and 616.95 UST (50%) when LUNA was at $52.59.
  • February 4, 2022: I added 20.22 LUNA and 1039.10 UST at $51.38.
  • February 8, 2022: I added 4.81 LUNA and 284.70 UST at $59.22.
  • February 15, 2022: I removed 2.45 LUNA and 138.11 UST at $56.27.
  • March 9, 2022: Luna price jumped to $92.81. I added 1.98 LUNA and 183.67 UST.
  • March 15, 2022: I pulled 100% liquidity when LUNA price was at $93.05 and got back 29.12 LUNA and 2709.20 UST.

The net result was that I sold 7.17 LUNA at $100.82, accounting for swap fees.

LUNA-UST V2 pool LP record In the second and third chunk, I net bought 1.91 and 1.96 LUNA at $71.46 and $58.01 respectively. Notice that the pools sold LUNA for UST while LUNA price went up and bought LUNA with UST while price went down. This means we can use liquidity pools to DCA out of or into a coin, while earning a yield. And we should. But I was naive and influenced and biased and believed LUNA would hit at least $200, so when price jumped from $50 to $93, I pulled liquidity to avoid losing more of my “precious” LUNA and used the UST portion to buy more LUNA to put up as collateral to borrow more UST to buy more LUNA. Four months later, UST depegged and LUNA went to zero and I lost it all. In hindsight, even if I took profit, I would’ve taken profit in UST and repeated the same fate. So the lesson here is to take profit often and into safe coins.

DCA out of ZRO via ZRO-ETH LP

On 22 June 2024 at 14:59 UTC, I sent 246 of my LayerZero airdrop to the 0.3% fee ZRO-ETH pool on Arbitrum, praying ZROETH ratio to grind up. I wanted to sell my airdrop and earn a yield at the same time. Airdrop tokens, by and large, dump very hard upon Token Generation Events (TGE) and never recover. Luckily, ZRO was different. Its price actually ranged for 3 months after TGE.

ZRO Price chart 3 months after TGE Because I set a wide range, my LP position passively earned 25.3687 ZRO and 0.0319 ETH in fees over 81.3 days. The fees (less gas) were worth $166.93 when I closed the position, which was composed of 0.2822 ETH (worth $659.88) and 0 ZRO. The 246 ZRO tokens were worth $772.69 at position open time. So pCGL was -$112.81 upon closure and I made $54.11 (-$112.81 + $166.93). Fast-forward to the present, at the time of writing, the fees (less gas) are worth $189.83 and pCGL is -$22.43 and their sum is $167.39.

Had I sold the 246 ZRO on on 22 June 2024, I would’ve only gotten 0.2205 ETH or $772.69. The LP position got me 0.2822 ETH plus 25.3687 ZRO and 0.0319 ETH in fees, which in total was worth $826.81 on closing day and $940.08 today.

What about impermanent loss? Well, IL was -$235.85 at closing time, bigger than the fees earned ($166.93); under current prices, IL is -$268.51, still bigger than the fees earned ($189.83). Had I held on to the 246 ZRO tokens, I would’ve made $70 or $80 more. Do I regret it? Absolutely not. When IL is red but pCGL is green, I will take it 8 out of 10 times.

Summary

Every time price goes above your cost basis, market is giving you an opportunity to take profit. Ignore it at your own peril. If you try to catch the top, you will almost surely7 get ruined. At any moment, price may dump and it may dump hard, and when it does, loss aversion will hold you hostage, making you reluctant to cut losses.

The sensible approach is to take some chips off the table as price goes up and stack some as price goes down. LP does that automatically and generates a juicy yield at the same time. So the next time you want to sell a coin, consider a one-sided LP position from the bottom; embrace IL and take profit. If you want to accumulate a coin, enter a one-sided LP position with stables from the top. We will discuss strategies involving one-sided positions later in the book, but before we get there, I need to show you several more metrics and walk you through a Google sheet that you can use to track things. See you in the next chapter.


  1. Volatile coins have prices not pegged to $1. Some examples are BTC, ETH, and SOL.↩︎

  2. Stable coins, or stables for short, are designed to be dollar-pegged. Some examples are USDC and USDT.↩︎

  3. Had you sold at the recent top, you would’ve made more money than holding. This loss will be erased if the price reaches a new high in the future, so it’s impermanent.↩︎

  4. It’s possible and often not hard to beat IL in a sequence of positions. I’ll describe such a strategy in a later chapter.↩︎

  5. UST was the third largest stable coin and the largest decentralized one. Today, the largest decentralized stable coin is DAI, and its market cap is 5.3 billion US dollars.↩︎

  6. V2 pools require 50-50 balanced entry, i.e., you need to split your capital 50% in coin 1 and 50% in coin 2 and send both coins to the pool. V3 pools allow any split, for example, 0-100, 20-80, 25.8-74.2, 40-60, 50-50, 60-40, 74.2-25.8, 80-20, or 100-0.↩︎

  7. Definition of “almost surely”: https://en.wikipedia.org/wiki/Almost_surely.↩︎