Perpetual Pools
Always wanted to be a market maker? Deposit into perp pools and earn yield by being an automated market maker for perpetual markets.
Overview
The methodology for the provision of liquidity to perpetual markets resembles that of spot markets, but differs in that it exclusively uses only the Carbon Grouped USD token ($USD), which is used to place limit orders on perpetual markets, providing liquidity to the orderbook.
The perpetual pool is powered by an AMM that takes the supplied liquidity to place quotes on all perp markets that it is linked to. The bid and ask quotes will be placed around the Index Price such that takers can quickly enter or exit a position with virtually zero spread.
Carbon's oracle can refresh the price rapidly, allowing the AMM to always quote at the index price on the orderbook.
The AMM has a special exception such that it is not limited to its available balance for quoting. This allows it to achieve higher capital efficiency as it is able to provide a total value of quotes far exceeding the liquidity that it has, giving more opportunities to earn yield.
Liquidity providers (LPs) will receive a liquidity pool token (CPLT) that allows them to earn from i) Position PnL, ii) Maker Rebates, iii) Borrow Fees, iv) Deposit / Redemption Fees. Learn more about these here. Additionally, external incentive vaults may be used to further incentives the provision of liquidity.
Automated Market Maker (AMM)
In the world of perpetual trading, the market maker plays a pivotal role in quoting prices. On Carbon, we have developed our own Automated Market Maker (AMM) module to quote prices on whitelisted perp markets using the liquidity provided from LPs.
Quoting Strategy
Each whitelisted market has its own quoting configuration.
Configuration Fields
marketId
is the ID of the market where this quoting strategy will be used.mode
represents the current quoting mode (standard
,close-only
, orpaused
).maxLiquidityRatio
represents the maximum fraction of liquidity (out of the total liquidity in the pool) that the AMM can utilize for the specific market.quoteShape
refers to quote structure for the market at any point in time. This is given as an array ofquote
s.Each quote consists of the following attributes:
quotePriceType
: either ratio or priceTicksquotePriceValue
: the amount to adjust from the previous quotequoteAmountRatio
: the fraction of liquidity to use for this quote
Each quote
in the quoteShape
generates a quote on a distinct price level on the order book as follows.
Quote Price
The price for each quote is based on the previousPrice
which is either:
the previous level's price, or
the
Index Price
of the market, if it is the first quote being generated.
The price is adjusted from the previousPrice
based on the side
(1
if it is an ask, and -1
if it is a bid), and the quote
attributes quotePriceType and quotePriceValue
.
If
quotePriceType
isratio
, the price is given by:previousPrice * ( 1 + quotePriceValue) * side
If
quotePriceType
ispriceTicks
the price is given by:previousPrice + (
* quotePriceValue) * side
Quote Quantity
Each quote will have its quantity given by:
(availableBalance
* maxLiquidityRatio
- positionSize) * quoteAmountRatio
,
where positionSize
is the AMM's current position's notional size and the availableBalance
is the LP's available collateral.
Example: BTC and ETH Markets
Consider a LP with a total deposit of $1 million, consisting of BTC (index price: $26,831) and ETH (index price: $1,816).
Configuration
Let's define the market configurations for each:
Whitelisted BTC Market Config:
marketId
: "cmkt/118"maxLiquidityRatio
: 1.0mode
: "active"quoteShape
:Quote 1:
quotePriceType
: "ratio"quotePriceValue
: 0.01quoteAmountRatio
: 0.1
Quote 2:
quotePriceType
: "ratio"quotePriceValue
: 0.02quoteAmountRatio
: 0.2
Whitelisted ETH Market Config:
marketId
: "cmkt/117"maxLiquidityRatio
: 0.5mode
: "active"quoteShape
:Quote 1:
quotePriceType
: "tick_size"quotePriceValue
: 2quoteAmountRatio
: 0.1
Quote 2:
quotePriceType
: "ratio"quotePriceValue
: 0.01quoteAmountRatio
: 0.2
Calculation
Now, let's apply the formulas to calculate the next quantity and price levels for each market:
BTC-PERP
availableToQuote = $1M * 1.0 = $1M
1st Bid Orderbook Level:
Quantity: $1M * 0.1 = $100k
Price: $26,831 - $26,831 * 0.01 = $26,562
2nd Bid Orderbook Level:
Quantity: $1M * 0.2 = $200k
Price: $26,562 - $26,562 * 0.02 = $26,030
1st Ask Orderbook Level:
Quantity: $1M * 0.1 = $100k
Price: $26,831 + $26,831 * 0.01 = $27,100
2nd Ask Orderbook Level:
Quantity: $1M * 0.2 = $200k
Price: $27,100 + $27,100 * 0.02 = $27,642
ETH-PERP
availableToQuote = $1M * 0.5 = $500k
1st Bid Orderbook Level:
Quantity: $500k * 0.1 = $50k
Price: $1,816 - 1 * 2 = $1,814
2nd Bid Orderbook Level:
Quantity: $500k * 0.2 = $100k
Price: $1,814 - $1,814 * 0.01 = $1,796
1st Ask Orderbook Level:
Quantity: $500k * 0.1 = $50k
Price: $1,816 + 1 * 2 = $1,818
2nd Ask Orderbook Level:
Quantity: $500k * 0.2 = $100k
Price: $1,816 + $1,816 * 0.01 = $1,835
Capital and Liquidity Efficiency
As mentioned, the AMM able to provide quotes to multiple markets. This allows it to achieve a higher utilization rate and efficiency on its liquidity, giving more yield opportunities to liquidity providers.
Example:
Let's say $1k of liquidity has been provided to this perp pool that is connected to BTC and ETH perps and has a maxLiquidityRatio
of 1.0 and 0.5 respectively.
This means that the total amount quoted on the order books will be a total of $1k each on BTC's bids and asks, as well as a total of $0.5k each on ETH's bids and asks, for a grand total of $3k of liquidity added onto the order books.
Whenever liquidity gets used up by a trader, that amount will simultaneously be removed from the other markets' order books as well.
Conclusion
By understanding these formulas and applying them to specific market configurations, you can determine the quantity and price levels that will be quoted using liquidity from the LP.
Last updated