This is part of an ongoing series of blog posts about financially engineering derivatives to be secure in DeFi. Derivatives have had decades (centuries?) to grow on their own, finding their relevant niche within the jungle of the traditional financial services industry. But in the adversarial blockchain environment, we need to ensure that counterparties can transact and margin in a secure and incentives compatible way.

Open question to all the financial engineers out there – how do you create securely margined on-chain interest rate swaps?

What’s the use case? Who would want an interest rate swap? 

  • Interest rate swaps allow people to convert floating, variable interest rate risk into a fixed rate. Here are 2 examples:
    • Alice could own a Maker CDP and borrow DAI from it. The Stability Fee she pays might change every week and rapidly move against her. Alice could use an interest rate swap to lock in a fixed 12m borrow rate.
    • Bob could be a DAI holder looking to earn yield by lending his DAI on Compound. The rate he earns changes every time someone interacts with the DAI liquidity pool. Bob could use an interest rate swap to lock in a fixed 12m lending rate.
Alice and Bob are two examples of interest rate swap counterparties who want different types of exposure.

We’ll walk through an example below of someone like Alice who wants to turn the variable interest rate on her CDP (i.e. Stability Fee) into a fixed rate. She’d enter a “classic” interest rate swap where for [5y], she makes fixed payments every [1y] and receives payments = accrued Stability Fee every [1y].

How could we do this? 

On-chain, have the payer (Alice) lock up collateral equal to 5% * $100mm * 5, and have the receiver (your counterparty) lock up collateral that you think will be sufficient to cover the 5 variable annual payments.

This has 3 problems.

  1. This requires both sides to fully fund their positions, when your motivation for paying fixed is, in part, the ability to plan to fund fixed cashflows in the future, rather than holding extra money on hand in case the Stability Fee goes up in the future.
  2. If interest rates go up (e.g. Alice could refinance her swap and lock in a different rate for the rest of the 5 years), the NPV (net present value) of the swap will change. This means that Alice could make or lose money on her swap. Calculating this number is very difficult in an illiquid market. The spreadsheet below shows how the NPV of the trade could change.
Problem 2: Let’s say you’re the receiver on a 5y $100mm interest rate swap where the fixed rate is 5% and the floating rate is Maker’s Stability Fee, paid annually. The present value (PV) of the cash flows you will receive from the payer is ~$21.6mm. If (generally) rates go from 5% to 15%, the PV of those cash flows decreases to ~$16.8mm, representing a ~$4.9mm decrease.

3. Below is a diagram of the cash flows each year and the present value (PV) of those cash flows, discounted to today. The red bars indicate the PV if rates stay at 5%, while the yellow bars indicate the PV if rates move to 15%.

The (sum of the red bars) – (sum of the yellow bars) tells us how much the value of the interest rate swap changes if rates change. If this amount is > the amount of margin that the receiver has locked in the contract, the receiver is incentivized to default and walk away from the trade. This is because the trade has lost more money for them than there is margin in the trade.

If Sum(Red bars) – Sum(Yellow bars) > margin the receiver has locked up, they should default.

How do we solve these problems?

  1. Problem 1 looks like it’s an inherent problem with traditional interest rate swaps.
  2. Problem 2, where the NPV is hard to calculate, can be “solved” by having an oracle tell us the NPV. But until the market is liquid enough, any oracle will be stuck conducting LIBOR-style panel interviews to figure out the “market price” for this rate. Not a great solution.
  3. Problem 3 is quite similar to Problem 1, where we’re trying to set margin requirements correctly. But it’s hard to know how much the NPV of such a trade might fluctuate and set standardized margin terms for interest rate swaps. What if people have different maturities and different rates?
    1. Or what if instead, we had a product where we could set margin requirements just on the interest rates themselves?

Let’s try to use a different type of product…

  • Another type of interest rate derivative that gets us close to solving the CDP owner’s problem is a CFD (contract for difference) on interest rates. In this kind of swap, for every 0.01% the interest rate moves, you make [$1]. 
  • In traditional finance, this would be called a “constant DV01” interest rate swap, since the “[D]ollar [V]alue of [01] basis point” is constant at $1. (1 basis point = 1 bp = 0.01%.) This is fairly easy to hedge on the blockchain as a levered margin trade where both the long and short side post collateral that gets moved between them as the reference rate increases or decreases.
    • See UMA’s first white paper on total return swaps here.
  • Let’s go back to the scenario from before. If you were a CDP owner and interest rates moved from 5% to 15%, the classic interest rate swap would have marked ~$4.9mm in your favor, representing a 23% increase in the PV. But if you run the same calculations when rates move from 5% to 6%, the classic interest rate swap marks ~$0.58mm in your favor, or about 2.7%.
  • Note that when the rates moved 10 percentage points (pp), the PV increased by ~$4.9mm (equal to a DV01 of ~$4.9mm/1000 = $4886). But when rates moved by 1pp, the PV increased by ~$0.58mm (equal to a DV01 of ~$0.58mm/100 = $5855).
  • In a “constant DV01” swap, you would have had to set the DV01 of the swap yourself at the beginning of the swap. What should you have set it to? $5855? $4886? Something else? 
    • This is interest rate swap convexity as we see it in traditional interest rate swaps, and shows why even though “constant DV01” can be implemented securely on the blockchain, they don’t necessarily provide a solution to the CDP owner’s problem. 

But sometimes, one solution’s good enough.

  • If you don’t expect interest rates to move a ton, you might be ok with having a little bit of mismatch as interest rates move. The diagram below shows how different the DV01 can be, depending on how big the move in interest rates is. 
  • Most interest rates in the real world don’t move that much, or at least not very quickly, so a constant DV01 interest rate swap might be acceptable. But in the crypto world, where the Stability Fee can move >200 bps in one vote, it might not be so acceptable. 
Interest rate swaps have convexity – their DV01 changes depending on how large the move in interest rates is.

What’s next? Who else could use these derivatives?

  • We showed how a CDP owner might use an interest rate swap (whether “classic” or “constant DV01”) to hedge his interest rate risk. 
  • Here, he’s turning a floating rate loan (e.g. CDP owner who is borrowing Dai) into a fixed rate loan (e.g. Dharma borrower).
  • Interest rate swaps can typically be used to do the following as well: 
    • Turn a floating rate deposit (e.g. Maker’s DAI Savings Rate or Compound’s cDAI interest rate) into fixed rate deposit (e.g. Dharma lender)
      • The person with the floating rate deposit can enter into an interest rate swap where he pays a floating rate and receives a fixed rate. 
      • This person can then wrap together his principal (the original amount of the deposit) with the cash flows from the interest rate swap and sell this to someone as a bond (e.g. traditional fiat Certificate of Deposit). 

The purpose of all of this – interest rate swaps, lending and borrowing, and derivatives as a whole – is to enable customized risk exposure and effectively allocate it to those who want it. Enabling all of these parties to transfer risk, unencumbered by the constraints of the traditional banking system, is one of the ultimate goals of the DeFi movement.