UXD Basics (part 2)— Perpetual Futures

UXD Protocol
10 min readJan 1, 2022
UXD solves the “Stablecoin Trilemma”

This is our second post on the essential concepts of UXD Protocol. In our last post, we explained the concepts of Financial Derivatives, Delta, and Delta-Neutrality. The goal of these educational posts is to build a nice intuition for UXD, rather than delve into the dirty technical details and mathematics.

In this article, we will discuss a specific type of derivative in depth, a “Perpetual Future” contract, which is essential to the understanding of UXD as a stablecoin: UXD is a delta-neutral stablecoin on Solana created using Perpetual Futures.

Futures

tl;dr A “Futures” contract is an agreement to buy or sell an asset at a fixed date in the future, for a fixed price determined when the contract is agreed upon.

Before adding the word “perpetual”, let’s discuss Futures contracts. A Futures contract between two parties is an agreement to buy or sell some asset at a pre-determined date at a pre-determined price. For example, I agree to buy a Bitcoin from you in one month at a price of $50,000 (today’s price is $48,000). Our pre-determined date is one month from now and our pre-determined price is $50,000.

Why would we enter into this contract? Futures contracts tend to exist for two main reasons:

  1. Price Speculation- It would make sense to enter this contract if I think the price of Bitcoin is going to go up to $55,000 in a month, because then I would be able to profit $5,000 by buying it for $50,000 from you. On the other hand, it would make sense for you to enter this contract if you think the price of Bitcoin is going to go down to $45,000 in a month, because then you would be able to sell me a Bitcoin for $50,000, keep $5,000 and buy another Bitcoin for $45,000. The futures contract allows two people to make equal and opposite bets.
  2. Locked in Prices- Suppose my nephew’s birthday is in one month, and I know I have to get him one Bitcoin for his birthday, because I promised him way back in 2013 that I would do so when he reached a certain age. Now because I know for a fact I will need it in 1 month, but don’t have the money right this second to actually buy a Bitcoin, I can enter into a futures contract with you in order to guarantee that I will be able to buy a Bitcoin for at most $50,000. On the other hand, you want to sell a Bitcoin to buy a new car, but don’t need the cash for another month. You’re worried about the price going down, so you decide to lock your sale price of $50,000 today with me. The futures contract allows two people to have certainty today about the purchase or sale price of an asset in the future.

In crypto trading, futures contracts tend to be used for Price Speculation as they allow users to take bets on the future value of assets without necessarily having to own the asset today. However, in the above example at the futures’ expiry date in one month, you have to send me a Bitcoin and I have to send you $50,000 for settlement.

Perpetual Futures

tl;dr A “Perpetual Futures” contract is a way to gain exposure to an underlying asset without having to “settle” the asset at any point in time.

Now that we understand Futures contracts we can add the word “Perpetual”. In our above example, we had a contract with an Expiry Date and a Pre-determined Price that required you and I to exchange a Bitcoin and cash on the Expiry Date (settlement). Perpetual Futures are the purest form of price speculation because they (i) remove the Expiry Date (never expires) (ii) replace Pre-determined Price with Market Price and (iii) removes the need for settlement. This pure speculative component explains the immense popularity of these contracts, with their annual volume in the trillions in 2021. How does this work?

I decide to go onto a derivative exchange like mango markets and enter into a “BTC-USD” perpetual futures position. In order to enter into this position I need to provide some collateral in the form of margin. Margin ensures the exchange that if I lose a lot of money on my trade, I will still have enough money to pay the loss I’ve incurred.

A Perpetual Future can be thought of as an “Agreement for Deltas”: if I want to have exposure to “20 Deltas” of Bitcoin using only 1 BTC worth of collateral (also known as “going long BTC with 20x leverage”), and you want to have exposure to “-20 Deltas” of Bitcoin using only 1 BTC worth of collateral (also known as “going short BTC with 20x leverage”), we can agree today to enter a derivatives contract that we will pay the other 20 times the price change of Bitcoin. We both put up 1 BTC as collateral to guarantee we can pay the other in case our losses grow too large. In this case, because we have 20x leverage, a mere 5% change in the price of Bitcoin will cause one of us to take a 1 BTC loss (20 BTC * 5% = 1 BTC), so if BTC moves 5% one of us will have to take the other’s 1 BTC. Any move greater than 5% and we won’t be able to guarantee that the other will pay the money owed.

So to prevent losses greater than 1 BTC, we agree at the start of the contract that the Perpetual Futures contract between you and I will continue “forever”, until one of two things happens:

  1. BTC moves up or down 5%- This means that someone will have to pay their full initial margin of 1 BTC to the other, due to the 20x leverage.
  2. One of us sells the derivative contract to someone else- This means you or I want to exit the trade and sell our position to someone else. Note that in order to do this option, there has to be a settlement transaction. For example, if Bitcoin has gone down 2%, then because I had 20x leverage (a 20 Delta position), I will owe you “2% * 20 BTC = 0.4 BTC. So, I pay you 0.4 BTC and then find someone else to step into the 20 Delta position in my place at this new price.

Perpetual Futures in Practice

In practice, for a derivatives market place like mango markets the easiest way to create a whole market of perpetual futures is to create a “virtual” BTC trading market. In a normal Bitcoin market, a user enters the market and places an order such as “Buy 3 BTC” and then pays for these 3 BTC and receives the 3 BTC in their wallet.

Imagine instead we set up a “virtual” BTC trading market in which people could submit orders for BTC and rather than paying for these BTC directly (or receiving funds if selling) we could have the “virtual” trading market track everyone’s “bought” and “sold” BTC. In order to exit the virtual trading market, users have to settle their gains/losses from the BTC they bought or sold, without ever actually receiving or sending BTC. The market therefore only settles profits and losses from a user’s virtual position, rather than having user’s exchange BTC directly. A “virtual” market can be thought of as a fictional ledger that keeps tracks of everyone’s BTC exposure.

In the context of our previous example where you and I want 20x and -20x leverage, respectively, I can do so as follows:

  1. I enter the “virtual” BTC market and deposit 1 BTC as margin collateral.
  2. Even though I don’t have 20 BTC worth of cash to buy 20 BTC with, I ask the “virtual” BTC market to “buy” me 20 BTC at whatever the price of BTC is on this virtual market at that time.
  3. My gains/losses will move 20x the change in BTC price. Every $1 of BTC price movement will change the value of my position by $20.
  4. I am required to “leave” the virtual trading market if one of two things happens: (i) BTC goes down by 5%, I will lose (20 BTC * 5%) = 1 BTC and lose my margin collateral, or (ii) I decide to “sell” the 20 BTC I own to someone else on the virtual market.

To summarize, this is exactly what we described above in the “Agreement for Deltas”! I was able to gain 20x exposure to BTC through this virtual market, with the exact same conditions for ending the contract as above: either I get wiped out or decide to sell to someone else. This is how Perpetual Futures contracts are done in practice.

Funding Rates

There is, however, a slight issue with the above “virtual” market construction. Each time someone buys or sells on this virtual market, the price of BTC on this virtual market will change. If too many people want to buy or sell, this could cause the virtual price of BTC on this virtual market to deviate from the actual market price (since it’s a market like any other and relies on supply and demand to determine the market price). That’s no good, because we want the Perpetual Futures to track the exact price of the underlying BTC. So, we need a mechanism in order to make sure the price doesn’t deviate too far from the actual market price of BTC.

This mechanism for keeping the virtual price close to the market price is called the funding rate. To understand the funding rate, it’s helpful to understand how the virtual price would deviate from the market price in the first place.

If the virtual price is above the market price, this implies that many people on the virtual market want to buy BTC, therefore pushing the price up. If enough people want to buy BTC on this virtual market (for example, because they all think the price is going to go up), then the virtual price might go above the real market price. On the other hand, if enough people want to sell BTC on this virtual market, this may cause the virtual price to go below the market price.

The funding rate for a virtual market like this one is a periodic payment from the more popular position (buying, for example) to the less popular position (selling). The frequency of this payment varies by derivatives exchange, but let’s suppose that it’s every 8 hours. Then every 8 hours, if the virtual price is above the market price, people who have “bought” BTC perpetual futures pay people who have “sold” perpetual futures an amount:

For example, if the virtual price of BTC is $48,200 and the market price is $48,000, then anyone who “bought” bitcoin on this virtual market will pay anyone who sold a sum of $200 for this 8 hour payment. If instead the virtual price was $50,000 and the market price was $48,000, then the funding rate payment would be $2,000. As the prices move, so does the funding rate. Note, actual funding rate formulas are a bit more complex, but for illustrative purposes, the above idea is correct and good intuition.

The idea of the funding rate is to incentivize people to take the opposite position on the exchange and bring the virtual price in order with the market price. For example, if I think BTC likely will not move much over the next few hours, it may make sense for me to “sell” 1 BTC on the exchange in order to collect the $200 payment. My sale of the BTC on the virtual market will bring the price down, and people will likely continue to do so until the “arbitrage” from the funding rate disappears.

So, the funding rate serves the essential purpose of making sure the price of our perpetual future’s contract stays in line with the price of the underlying asset.

Perpetual Futures Example

Bob decides he wants to gain 5x leverage exposure to the price of BTC on mango markets.

He goes to the derivatives exchange, clicks on the “BTC-PERP”. First, he deposits some collateral as margin, say 0.5 BTC.

Then, he “buys” 2.5 BTC (5x his margin) on the virtual perpetual futures market. This represents ~$120,000 of exposure to BTC at a price of ~$48k.

Because he bought BTC and the virtual price of BTC is above the current market price (at the time of writing, the perpetual futures price is $48,383.9 whereas the market price is $48,355.3.)

Mango markets has an hourly funding rate frequency, so every hour the virtual price is above the market price, Bob will owe a payment. Today, the average funding rate payment has been .0003%, meaning every hour Bob will owe:

per hour, or $8.64 per day, or $3,153.6 per year if funding rates stay at the exact same level.

Suppose funding rates stay constant for 30 days, and BTC has gone up 5%. At the end of the 30 day period, what is Bob’s total profit?

On his initial deposit of .5 BTC ($24,000), this is a ~24% return in 30 days! Compare that to the 5% he would have made by just holding his .5 BTC over this time period.

Hope you’ve enjoyed the second part in this educational series. Any feedback or requests for future topics can be directed to our Discord.

--

--

UXD Protocol

Fully collateralized decentralized stablecoin backed by Asset Liability Management Module.