Perpetual Protocol šŸ„Ø

Posted on Mar 09, 2023Read on Mirror.xyz

Hot Tub Strategy Explained

The strategy for Hot Tub is based on arbitrage, a very low risk trading technique that profits from price differences for a particular asset across multiple trading venues. An example of arbitrage is buying ETH on one exchange at a certain price, then selling the same ETH using another exchange quoting a higher price. Essentially, itā€™s ā€œbuy low, sell highā€ but itā€™s done instantly.

Arbitrage is big business. Itā€™s the most frequent type of Maximal Extractable Value (MEV) on Ethereumā€™s mainnet which generated a total revenue of $145 million for searchers in 2022. Usually termed as ā€œpositive MEVā€, arbitraging (or arbā€™ing) facilitates the price discovery process for crypto-assets and improves market efficiency.

While MEV involves front-running and back-running trades on a DEX to generate profit, the Hot Tub strategy differs because we arbitrage across two or more DEXs, capitalizing on the price differences between perpetual futures and spot markets.

Also, MEV doesnā€™t occur on Optimism (and this remains true even after the Bedrock upgrade), as the mempool isnā€™t public, so itā€™s not possible to re-order transactions. That means arbitrage traders do not have to compete with MEV bots on Optimism.

The Arbitrage Strategy Heating Up the Hot Tub

Hot Tub accepts deposits in both WETH and USDC with two different vaults. Each vault pools the deposits together to capitalize on arbitrage opportunities.

https://vaults.perp.com?utm_source=mirror&utm_medium=blog&utm_campaign=mirror

Since this strategy buys ETH at a low price, then immediately sells ETH at a higher price, profits can be achieved with minimal risk by capitalizing on price differences between the ETH-USD market on Perp and ETH-USDC spot markets on decentralized exchanges (such as Uniswap).

šŸ¤«In the future, we may even expand the strategy to include many more assets and other chains.

The strategy takes advantage of profitable arbitrage opportunities as they occur - when the price of ETH diverges significantly between perpetual futures and spot markets.

The more that the markets are volatile during your stay in the Hot Tub, the more this strategy can potentially earn for you. After the strategy executes any arbitrage trades, the vault realizes a return that is the closest thing possible to ā€˜risk-freeā€™ profit.

The Hot Tub whitelist has been removed as of July 19th, 2023. Users can now queue up to join the vaults and earn yield while theyā€™re waiting with the Shower Room. Learn more in the blog post linked below!

https://perpprotocol.mirror.xyz/diTuTxxvEqWDstip5k0v5IJiQCmd0PTRd2JrYcIVMOQ

Hot Tub Strategy Walkthrough

The strategies employed for the two vaults are very similar, but with slight differences to offer yield denominated in either wrapped ETH (WETH) or USDC. Letā€™s look at the USDC vault first, where you can play it safe, earn a yield from your stables and stack more USDC.

USDC Vault

Weā€™ll use an example to illustrate the vaultā€™s strategy. Assume that ETH is priced at 1,000 USD on Perp but only 900 USDC on Uniswap. The list below outlines the sequence of events and how the vault generates a USDC profit for depositors:

  1. Assume a total of 10,000 USDC is deposited into the USDC vault and sent to Perp.

  2. When there is an arb opportunity between the USDC vault and Uniswap/other spot DEXs, the vault buys ETH on Uniswap and sells ETH from the USDC vault. Here the arb profit is denominated in USDC.

  3. The arb bot swaps 900 USDC to 1 ETH on Uniswap.

  4. The arb bot swaps 1 ETH for 1000 USDC from the USDC vault (since ETH equals 1,000 USD on Perp).

  5. The USDC vault then holds 1 ETH spot and an equivalent short position on Perp.

  6. The USDC vault withdraws 1,000 USDC from Perp. As a result, the vaultā€™s value on Perp = collateral + unrealizedPnL = (10,000 - 1,000) + 0 = 9,000 USDC.

  7. The USDC vault then transfers 1,000 USDC to Arb bot.

  8. Finally, the arb bot transfers the profit of 100 USDC to the vault.

This example above is just a simple example and the price differences are unlikely to be as large in practice. Itā€™s also important to note that all of these steps and trades take place almost instantly in a single transaction, making it much more feasible for anyone to access arbitrage alpha!

Now you know how the strategy works at a high level, letā€™s look at what happens from a userā€™s perspective after they deposit USDC to the vault.

Withdrawing Profits from the USDC Vault

After the arb from the example above is executed, assume after a period of trading, the prices on Perp and Uniswap for ETH then converge to $950. After deposit into the USDC vault, youā€™ll receive a token that represents your share of the pool. The share price tracks the vaultā€™s performance and must be burned to claim your initial deposit and any profits in USDC.

To make this clearer, letā€™s assume the USDC vault has three depositors: Alice, Bob and Carol. Of the $10,000 deposited into the vault, Alice deposited $4,000, while Bob and Carol deposited $3,500 and $2,500, respectively. The share price started with a value of $1 and its value is equal to the total assets in the pool (according to Perpā€™s index price) divided by the total share supply.

Following the example above, Alice would receive 4,000 shares to represent her holdings, while Bob and Carol receive 3,500 and 2,500 LP tokens, respectively. After realizing profits from the arb opportunity, the total assets held by the vault increased in value. Initially, the total value of assets equaled 10,000 USDC. However, with the profits from the arbitrage trade of 100 USDC, the total assets amount is now equal to 10,100 USDC.

As a result, the share price is now 1.01 USD following the arbitrage trade. Multiplying the share price by the amount of shares held by Alice (4,000) gives us 4,040 USD.

But what happens after the arb profit is realized and someone wants to withdraw their capital from the vault?

Letā€™s say Alice wants to withdraw her funds. The USDC vault will first calculate the arb profit, in this case itā€™s 100 USDC, so Aliceā€™s share is 40% of this amount = 40 USDC.

Because she is withdrawing her share, the ETH spot and perpetual futures position must also be reduced by 40% to maintain delta neutrality. That means 0.4 ETH is sold on Uniswap in exchange for USDC to reduce the spot holdings to 0.6 ETH. The short perpetual swap position is also reduced to 0.6 ETH.

Then 40% of the vaultā€™s value on Perp, where at this stage is equal to 9,050 USDC (= [collateralValue + realizedPnL] + UnrealizedPnL), will be withdrawn. Aliceā€™s share of the vaultā€™s value held in Perp is 40% of 9050 = 3,620 USDC. And then with the sale of the spot ETH on Uniswap (0.4 ETH x 950 USDC) = 380 USDC, this sums to Aā€™s initial deposit of 4,000 USDC.

Then 40% of the arb profit, 40 USDC, is added to Aliceā€™s amount, and she withdraws a total of 4,040 USDC. Also, whenever you withdraw your funds, your pool shares are burned. Since the total assets and total shares decline in proportion after Aliceā€™s withdrawal (both drop 40%), the share price remains the same. But Bob and Carol now earn a higher percentage of the profits from any further arbitrage opportunities now Alice has left the pool.

Whenever a withdrawal occurs, the USDC vault sells spot ETH and reduces the size of the perpetual position to ensure delta neutrality by balancing the spot and perp positions.

ETH Vault

What does the process look like for the ETH Hot Tub vault? Itā€™s a similar outline to the USDC vault, but the arbitrage bot in this case does one of two things:

  1. When the Perp price < spot DEX price, sell ETH on the spot DEX, then buy ETH on ETH vault to generate a profit in ETH.

  2. When spot DEX price < Perp price, sell ETH on ETH vault, then buy ETH on spot DEX to profit in ETH.

Letā€™s say that ETH is priced at 900 USD on Perp but is 1000 USDC on Uniswap.

Hereā€™s how the strategy generates a return in ETH for depositors:

  1. Assume a total of 10 WETH is deposited to the ETH vault. The ETH vault currently doesnā€™t deposit WETH into Perp, because the ETH vault always opens positions with 1x leverage, so itā€™s unlikely to be liquidated. Holding ETH spot in the vault instead of Perp will also save on gas fees.

  2. When there is an arb opportunity between the ETH vault and Uniswap/other spot DEXs. Since the price is higher on Uniswap, the strategy sells ETH on this spot DEX and buys ETH from the ETH vault. Here the arb profit is denominated in ETH.

  3. The arb bot swaps 1 ETH to 1000 USDC on Uniswap.

  4. The arb bot swaps 1000 USDC to 1.1111 ETH on the ETH vault (since ETH equals 900 USD on Perp). The vault then deposits 1000 USDC to Perp and opens a long position of 1.1111 ETH.

  5. The vault transfers 1.1111ETH from the vault to the arb bot.

  6. As a result, the vaultā€™s value on Perp = collateral + unrealizedPnL = 1000 + 0 = 1000 USDC. The vaultā€™s total assets (in the notional ETH terms instead of USDC) = vaultā€™s spot ETH balance + (vaultā€™s value on Perp / Perp index price) = (10 - 1.1111) + (1000 / 900) = 10 ETH

  7. The arb bot transfers the profit of 0.1111 ETH to the vault.

It's worth noting that the ETH vault is unlikely to be liquidated by price change, unless it is paying a lot in funding fees.

For example, if we assume the price of ETH is $1000 on Perp, then the ETH vault's collateral = 1000 USDC. When the ETH vault opens a 1 ETH long position with 1000 USDC, the positionValue = 1000.

The vaultā€™s margin ratio is calculated as the account value divided by position value, which gives us 100%. Even if the price of ETH drops to $1, the vaultā€™s collateral will be worth 1000 USDC, the unrealized PnL will be -$999 while the position value is 1. Therefore, the margin ratio remains 100% = (1000 - 999) / 1.

Withdrawing Profits from the ETH Vault

When you want to withdraw, your share of the arb profit is calculated, the long perpetual swap position is reduced, while the USDC held by the vault is used to buy ETH to maintain a delta neutral position. Whenever a withdrawal occurs, the vault will adjust the spot and perp positions so that they are always balanced.

As an example, letā€™s say that the ETH vault has three depositors: Alice (4 WETH), Bob (3.5 WETH) and Carol (2.5 WETH), with a total of 10 WETH. Assuming the price of ETH converges to $950 across Perp and Uniswap, then the vaultā€™s value on Perp increases to 950 USD. If Alice withdraws all her shares, then the vault will calculate the arb profit as 40% of 0.1111 WETH = 0.04444 WETH.

The ETH spot balance of the vault is reduced by 3.55556 WETH (40% of 8.8889 ETH) while the long position on Perp is also reduced by 40%, from 1.1111 ETH to 0.66666 ETH. Alice also gets her share of realized PnL from the partial close of the long perpetual position, equal to 22.22 USDC.

The vault now holds a long position of 0.66666 ETH and the account value on Perp is now equal to 1055.555 USD, since 1000 USDC was deposited and 55.555 USDC in PnL was earned from the long position as the price of ETH increased from 900 to 950.

Since Alice deposited 40% of all assets, 40% of the account value is withdrawn from Perp = 422.222 USDC, which is used to buy spot ETH on an Optimism DEX to get 0.4444442105 WETH.

A total of 0.04444 + 3.55556 + 0.4444442105 = 4.0444442105 WETH is transferred to Alice and her shares are burned. Following Aliceā€™s withdrawal, Bob and Carol will earn a greater share of the arbitrage profits (unless someone else deposits) as more opportunities are found.

Arbitrage Alpha Made Accessible to All

Hot Tub will continually find and execute arbitrage opportunities to generate a low risk but steady yield over time for depositors. While using the same strategy, the process slightly differs between the ETH and USDC vaults to ensure that depositors earn profits in the asset of their choice.

After testing in a live trading environment, both vaults have generated returns exceeding 6% APR. After the launch of Hot Tub, weā€™ll release a dashboard on Dune Analytics that will track all the important metrics such as the APR and total value locked.

Have any other questions? Check out the Hot Tub FAQs or ask us on Discord!

Links