Beginners Guide to Crypto Derivatives, Kwenta Case Study
FTX incident gives on-chain perp exchanges a huge opportunity to absorb all wandering traders who suffered and survived FTX's collapse. Volumes, fees, and users of decentralized perp protocols are booming. On-chain perp market is hotter than ever before.
In December 2022, Synthetix, the most well-known synthetic asset DeFi protocol on Ethereum, launched perpetual v2 updates on its exclusive DEX, Kwenta.
The derivatives landscape becomes more competitive with more new players building better products.
Previously, TokenInsight launched a thorough Crypto Decentralized Derivatives Exchange 2022 Q3 Report. It gives a very solid and detailed discussion about the history and current landscape of the derivative DEX market. Kwenta, of course, is one of the major players.
However, the report refers to lots of trading concepts that are quite hard for beginner traders or new DeFi users.
In this article, you will get an understanding as a beginner of how Kwenta's perp works, what is the difference between Kwenta's perp and other DeFi derivative protocols, and finally how its v2 boosts its scalability, experience, and on-chain liquidity.
What Are Crypto Derivatives?
Well, before we start, we need to know what derivatives in crypto are and how they normally get played currently. If you are already familiar with this section, you can skip directly to the synthetic asset section below.
In tradfi (traditional finance), a derivative refers to a type of financial contract (with its own risks) whose value is dependent on or derived from an underlying asset, group of assets, or benchmark. Futures and options are the most common financial derivatives used for hedging or speculation.
In crypto, derivatives such as perpetual swaps, options, and synthetic assets are also instruments that are derived from underlying crypto assets.
- Perpetual swap is the most common crypto derivative that is now widely adopted in centralized exchanges like Binance and Bitmex, and DEXes like Kwenta, dYdX, GMX, and Perpetual protocol.
- Synthetic assets are another brilliant innovation in the DeFi area boosting the scalability of on-chain trading diversity, mainly available on specific synthetic asset protocols like Synthetix, Linear Finance, and Mirror protocol.
- Crypto options are relatively niche and more face-to-pro traders who want to hedge rather than expose themselves more to the volatile market. We will not cover this topic in a future article.
What Is a Perp? Why Do Traders Love Perps?
For more guide to perps, please go here: the cartoon guide to perps by Dave White
Key takeaway: shorting available; capital leverage tool; mark price, index price, funding fee, and margin as four elements that construct the perp product.
The perp is the short term for perpetual swap, a crypto futures derivative with no expiration date invented in 2016 by Arthur Hayes, founder of derivative crypto exchange Bitmex.
It is mostly like a futures contract in traditional finance, traders deposit a margin to trade futures contracts of the underlying assets but no expiration date, which means traders can get exposed or speculate (long and short) the underlying assets with leverage and never worry about delivery risks or cost of storage/holding of the spot. (This is also the fundamental goal of perp)
Perps implementations vary a lot from centralized exchanges to DEXes but in general, four basic elements are in common for a standard perp product:
- Mark price represents a perp's value at any given time. It is based on the trading price of the perp. It is also used to calculate profit and loss and trigger liquidations.
- Index price represents the spot price that is usually calculated as a proportionally weighted average based on the spot market trading price of the underlying asset on major exchanges.
Ideally, to reach the goal we state above, and ignoring all complicated factors like trading rewards, the perp should be worth about the same as its underlying asset's spot value. Mark price should be roughly equal to the index price.
Unlike tradfi's futures contract with a specific expiration date, where the futures value will converge to spot underlier value as the expiration date comes, perp's value (mark price) may diverge from its underlier value (Index Price) since it will never expire. Hence, we need a mechanism to pull the Mark Price back and keep its value near the index price.
- Funding fee is the tool that helps perps' value converge to the spot value. When the index price and mark price diverge, the system transfers funding fees between longs and shorts. If the Mark Price is higher than the index price, indicating a positive funding fee, then the longs will need to pay the shorts. If the funding fee is negative, the shorts will need to pay the longs.
- Margin is the collateral of traders. When the Mark Price moves against the trader, the resulting losses are deducted from this margin. If the margin balance gets too low, the trader will be liquidated, meaning their position is automatically closed out. Margin ratio often relatives to how high leverage your position is. A $1 cost margin 100x bitcoin perp position behaves like $100 of bitcoin spot. The less margin you collateralize, the higher leverage you have, the higher capital efficiency you have, but the higher risks you bear. If your 100x bitcoin perp's mark price moves against your direction of 1%, and you have not added more collateral in time, your position will get liquidated.
Why do traders love perps even if it has so much risk? Well, there are three main benefits that the perp has:
- Perp allows traders to be exposed to an underlying asset without actually holding it.
- Perp allows traders to borrow assets that they don't actually hold, which results in an increase in their capital efficiency. They can trade big positions for less money (only collateralized margin which is normally much lesser than the position). This, of course, brings liquidation risk as well.
- Traders can short an asset easily without the need to borrow&sell the real asset from external sources.
What Are Synths? Where Are All the Risks Going?
Key takeaway: virtual assets that mimic liquidity from a shared debt pool. A casino offering a stock/crypto market simulator game.
After understanding what perp is, we also need to know the basic mechanism of synthetic assets before we introduce Kwenta. If you are already familiar with this section, you can skip directly to the Kwenta section below.
A synthetic asset is a tokenized derivative that mimics the value of another asset. Generally, wrapped token & stablecoins are also categorized into synthetic assets because they are all pegged to other assets' prices. But usually, a synthetic asset's price is fed by an oracle.
An oracle is a program that can provide external data to a smart contract. Chainlink is a commonly used decentralized oracle in crypto.
It is usually issued by any staking users and through the help of DeFi protocols in form of standardized crypto tokens. Synthetix (formerly known as Havven) was the first DeFi protocol to invent such derivatives in 2018. Theoretically, any asset whose price can be fed by an oracle could be minted into a synthetic tokenized asset.
For better understanding, one can think of a synthetic asset protocol such as Synthetix as a casino where they offer a stock/crypto market simulator game where players speculate on virtual stocks and cryptos using chips as money.
How Does Synthetic Asset Work?
The mechanism of synthetic assets is divided into two parts, asset-backed minting, and trading. For better understanding, we explain each from the perspective of two market participants.
Stakers: Stake to Mint and Bear Debts
Stakers need to overcollateralize some asset into the protocol to mint a synthetic stablecoin asset, e.g. overcollateralizing 750% of $SNX to mint sUSD. This is equivalent to a mortgage, but only synthetic stablecoins such as sUSD can be borrowed. Stakers incur a ‘debt’ when they mint Synths. The system keeps a ledger book for all stakers: recording their initial debts and shares.
What do I get after staking?
- Some stable synthetic assets like sUSD.
- Start to earn a certain amount of synth trading fees (proportionally).
- A certain amount of variable debt.
What else can staker do when getting the above?
- Become a Synth trader, speculate on other synthetic assets, or hedge their own debt exposure (see below for details).
- Become a Synths market maker in the over-the-counter market.
- Sell them directly in over-the-counter.
Stakers are players who get their chips (sUSD) through official casino counters. The way this casino sells the chips is through over-collateralizing the casino's own stock (tokens) to mint chips. The system keeps a ledger for the staker, recording how many chips the staker creates and what share the staker accounts for. Also, the total value of the staked assets must be at least 7.5 times the value of the chips. As an incentive for those players, the casino rewards a proportional share of the transaction fees them.
Example: Alice has $75,000 worth of $SNX, and stakes it into Synthetix and mints 10,000 sUSD, at which point Synthetix will credit Alice with $75,000 $SNX in assets (collaterals), $10,000 sUSD in debt, and 750% in collateral ratio. At this point Alice is already earning a proportional fee, she can then become a synths trader and trade sUSD for other synthetic assets, or she can hold it, or she can choose to sell sUSD in the OTC market like Uniswap or become an LP in the sUSD/$USDC pool, etc.
What Is the Risk of a Staker? Here Is Where All the Risks Going
Stakers share a unit and volatile debt pool as their debt. One staker could possibly encounter the situation that his/her debt is constantly rising and he/she cannot add more collateral in time, then he will suffer a liquidation risk.
All synthetic assets are added up to a large pool of chips, and the value of this pool should be exactly equal to the value of the total debt on the books, hence it is also called a debt pool. It is easy to find that the total debt amount is always changing with the amounts, types, and anchor prices of original assets. The total value of collateral should always remain at or above 7.5 times the total debt pool. The amount of change in the debt pool that increases or decreases is apportioned to each stakers proportionally, and each time the system directly modifies the staker's debt balance.
The truth is the system tracks the debt pool by issuing debt shares (a token) to stakers when they mint or burn sUSD. A staker’s debt percentage would be their balance of tokens divided by the total supply of debt shares.
When one's debt balance decreases and then the collateralization rate increases, the staker can mint new synths to lower the collateralization rate. When one's debt balance increases and the collateral rate decreases, the staker can burn some synths or replenish the collateral to increase the collateral rate. When the collateral rate is too low and stakers failed to operate in time, the collaterals will be forced to be liquidated by the system.
Therefore, Alice's $10,000 debt balance is always floating. Assuming the total debt pool is worth $20,000 when the value of the sBTC (assume the pool consists of sBTC) synthetic asset rises by $5,000, the total debt pool also rises to $25,000. since Alice has 50% of the debt, she is sharing half of the new debt, which is $2,500. therefore, Alice's new debt balance after the increase becomes $12,500. Alice's net loss is -$2,500. At this point, if Alice does not add more $SNX or burn some of the sUSD, the collateral ratio will be less than the required 750% collateral ratio, but still less than the liquidation ratio.
The difference between this and traditional casino is the difference in gamble counterparties: traditional casinos are all about players making players' money and the casino taking a commission. In synths market, on the other hand, is where the staker's assets are acting as counterparty to the total volatility of all synthetic assets, so the dealer paying the gambler in the event of an overall market rise is all stakers too.
Two reasons why most synthetic asset protocols follow the principle of over-collateralizing:
- Collaterals often have high volatility. over-collateralization reduces the risk of under-collateralization. If the collateral value falls too much, the system will liquidate the collateral and sell it early before the minimum requirement is touched.
- The debt pool often has high volatility. Even if the value of collateralized assets is stable, there is a risk that the total debt pool will rise too quickly and be under-collateralized.
Synths Traders
Once you have some synths, you are a synths trader. Stakers can trade synths directly after minting.
For one that doesn't want to acquire synths by staking, which means he/she doesn't want to bear the debt risk, he/she can buy some synths using $ETH or other tokens in OTC directly. Some synthetic assets have some liquidity in external AMM pools (e.g. sUSD/$USDC in Curve, sETH/$ETH in Uniswap, etc.) that can be purchased directly.
What can a synth trader do?
- Trading of synthetic assets to earn spreads.
- Feature 1: Reduce the friction cost of holding a spot. Users can trade sXAG (Synthetic Gold) instead of real spot gold, which behaves like the underlying asset by tracking its price using data oracles such as Chainlink. Because real gold assets always cost more than their price: carrying cost, transportation cost, and security risk. Even with a platform, you need to KYC and deposit money into the account to get exposed to the volatility of Gold.
- Feature 2: No slippage to trade synthetic assets. Since the synthetic asset price is fed from the oracle, the synths holder does not need to worry about illiquidity and slippage when trading.
- Feature 3: Synth transactions are not between two players, but are a process of system tracking, burning, minting, and tracking again. The prices are all fed by external oracles.
Once having some chips (sUSD), the player pays for whichever stock he wants to buy at a good price, and the system calculates the quantity based on the real external stock price (from oracle) and issues the player the correct number of shares/crypto notes token (sBTC, etc.). When the player feels that his stock is rising enough to close his position, he will burn the notes and mint the chips back. The system will update the total debt balance.
Example: Alice with 10,000 sUSD wants to buy all sETH. The system will first burn 10,000 sUSD in Alice's wallet ➡️ update the total sUSD supply balance (-10,000) ➡️ Oracle determines the $ETH price rate (assume $1,000) ➡️ collect the fee ➡️ mint the corresponding number of new sETH (about 10) to Alice's wallet ➡️ update the total sETH supply balance (+10).
- Hedging the risk of debt. (For stakers only)
- The Synthetix protocol has a special synthetic asset that particularly tracks the total debt pool index, and holding this asset can hedge the loss incurred by the stakers' debt increase.
Kwenta, a DEX to Trade Perps and Synths
Finally, here we come to Kwenta, an Ethereum decentralized spot exchange for synthetics + a sUSD-as-margin on-chian perp exchange on Optimism layer 2 network.
Kwenta is the marketplace (or the front UI/UX) for all Synthetix's synths spot swap. Evey synths trader executes sUSD and other synths (sBTC, sETH, etc) swap on Kwenta contracts, while every staker (minter, debtor, or liquidity provider) stakes, redeems, and manages his/her debt share interacting with Synthetix contracts. The spot swap process is like the example we mentioned above. We won't go into details here. Let's focus on Kwenta's perp!
How Does Kwenta's Perp Work? How Is It Different From Centralized Perp and Popular Perp DEX GMX?
Key takeaways:
In Kwenta, the Synthetix debt pool is the counterparty; Kwenta has a funding rate mechanism that GMX doesn't have; Kwenta uses sUSD-margined perp but GMX is multi-crypto as margined support.
Both Kwenta and GMX use oracle fed mark price hard-pegged to index price and retain price impact for Lps.
GMX limits the positions to roughly 1:1 with the collateral in the pool. Kwenta partially offsets the price volatile risk with funding rate and realizes a lot of capital efficiency.
Kwenta also provides perps trading function, but only on Optimism L2. Its mechanism is like GMX, using a pool as the counterparty for all traders. But unlike GMX using the GLP pool (a basket of assets), Kwenta directly uses the same debt pool from Synthetix. That is why we need to describe the mechanism of Synthetix first.
We can treat Synthetix debt pool as the casino chips pool as we mentioned above. While synthetix is more like the casino cash management system, Kwenta is more like the casino lobby providing different games. Spot trading synths asset (or virtual crypto market simulator game) is one of them and perp trading is the other game.
A standard perp product in a centralized exchange should be like the example we mentioned above. It has features like:
- Orderbook model.
- Mark price is determined by perp trading value and keeps close to the index price by transferring the funding fee. But decentralized perp product may be slightly different from standard prep.
In both Kwenta and GMX cases, not like an orderbook model, the counterparties of all positions are against asset pools but not another trader. This means the long side open interest can be unequal to the short side (In tradfi's orderbook model, the long side must equal to the short side). Specifically, Kwenta shared the same liquidity from Synthetix debt pool, which also means all stakers bear the risk when the long & short sides are not in balance.
Alice opens a 100x bitcoin long perp on Kwenta with $1 sUSD as margin (she bought from otc), and her open interest is $100 sUSD. When the bitcoin price rises 50%, her position becomes $150 sUSD, which gives the debt pool a rise of $50 sUSD.
But if Bob also opens an opposite 2x bitcoin short perp with $50 sUSD as margin at the same time, when the bitcoin price rises 50%, Bob will get liquidated and the debt pool remain the same.
Meanwhile, the mark price of the Kwenta perp (perp's value) is directly fed from oracles like Chainlink, which means they are automatically equal to the index price with no need for a funding fee mechanism.
However, even though the mark price is fixed and will never diverge, the net position could be skewed largely when an extreme market happens. If the market becomes too heavily long or short against an asset, the debt pool acts as a counterparty to the net position skew. To reduce the volatility of the debt pool, a funding fee mech is added to Kwenta's perp as well (even though it is not necessary). With a funding fee, positions on the crowded side of the market will be charged funding, while positions on the uncrowded side will receive funding.
On the contrary, GMX does not apply the funding fee mechanism, because its GLP pool can fully bear all risks that come from the skew of net position. GLP pool contains the maximum open interest for different underlying assets. In GMX, traders essentially collateralize margins to borrow real underlying assets. So they only need to pay a borrowing fee for GLP holders.
With this feature, GMX limits the positions to roughly 1:1 with the collateral in the pool.
GMX traders can only trade preps that the underlying assets are in the GLP pool (currently only $BTC, $ETH, $UNI, and $LINK) and with a maximum capacity showing here.
The Difference Between Kwenta's Perp and Others'
Other detailed features that Kwenta supports:
- An isolated margin allows traders to individually manage their risk and collateral made available to individual positions/assets. In particular, isolated margin accounts support the next price order type to prevent front-running trading, which was suffered by Synthetix a long time ago. Details visit here.
- Cross-margin accounts allow users to trade any market by depositing into a single-margin account. In cross-margin mode, Kwenta supports limit orders, takes profit & stops loss orders.
Reduce Skew Risk + Boost the Perp Trading Experience With Its V2 Updates
Key takeaway: Funding rate improvement helps the net position less skew. The more balanced the skew of the market, the higher open interest limits the market has.
On December 21st, 2022, Kwenta announced its perp v2 alpha version go live.
Below we list some major updates of Kwenta perp v2.
- Change oracles from Chainlink to Pyth Network, a pull-based decentralized oracle that allows users to request a price quickly when they place a trade. (Chainlink will provide a backstop in case of price divergence)
- Fees reduction.
- More frequent price updates + granular pricing.
Pull-based means request & response pattern to acquire data from the oracle. When a smart contract needs data, it requests the data from the oracle. After the oracle receives the request, it gathers the information from the off-chain data source and provides it back to the blockchain. This is called a Pull-based inbound oracle. On the contrary, a pull-based outbound oracle requests the data from the on-chain data source when the off-chain resource needs to query data from smart contracts.
Push-based (inbound) means oracle watches for any sort of changes in a particular off-chain data source. When there is a change in the data source, the changes will be transmitted to the blockchain.
For more patterns about oracle, please find them here.
- Funding rate improvement. Perps v2 enables a smooth transition in funding rates. Rather than changing instantly with the skew, funding rates under Perps v2 “drift” from one direction to the other depending on the skew, freezing when the skew is balanced. This model means traders have more incentive to collect funding through advanced trading strategies and are less likely to be surprised by sudden changes in funding.
- The more balanced the skew of the market, the higher open interest limits the market has. Hence the market can support gross open interest several multiples larger than the collateral backing method, helping to bring deeper liquidity to traders.
- With improved funding rate design, perp v2 is suitable for strong directional bias assets in the future.
- But now only for $ETH-sUSD perp.
To Sum up!
The perpetual swap contract is one of the most successful crypto financial innovative products since crypto trading popularizing from native degens to giants on Wall street. As perp dexes got hot and popular after FTX's collapse, we believe it is necessary and practically useful for all-level crypto enthusiasts to get to know about how this amazing trading approach could be adopted on-chain.
Kwenta as a scalable and complex DeFi protocol optimizing better perp trading mechanism with deep liquidity may be a little bit too complicated for newbies to absorb. And now, after reading this article, beginners can understand the basic ideas of how all of those elements combine together and work. It's not only for sophisticated traders but is always friendly with all-level players who only need some hints from us (winks).
The biggest innovative solution that Kwenta's perp had in v1 is the shared debt pool as liquidity + counterparty. By drawing Synthetix liquidity, Kwenta can realize providing more fun casino games like perp trading. Meanwhile, the biggest improvement that Kwenta perp v2 is the better skew balance method gets application which enhances the maximum open Interests limit that other DEXes like GMX are hard to achieve.
Hope you found this content helpful and wish you merry an excellent Christmas.🎄
Bonus! Some Useful Hints for Evaluating a Perp DEX
According to our derivative ecosystem report, when we try to evaluate a derivate DEX, we should consider multiple aspects like liquidity, scalability, fees, mechanisms, etc.
When consider to use an on-chain derivative DEX, we should consider the following facts:
- Which chain was the DEX deployed on?
- How much liquidity does the DEX have?
- How many cryptos can I trade?
- How large the position can I open? What is the max leverage?
- How much it charges for trading? How to charge?
- How fast can I trade?
- Decentralized enough?
We believe you could roughly evaluate how good is that protocol after finding all these answers.
Special thanks to Wayne, WDK Paul, quant Z bra, and Aidan Lan
DeFi
Derivatives
Synthetix
Synthetics