DeFi Series | Lending, Spot and Margin Trading: The Syllogism of Decentralized Finance (中)
Author: Scott Winges
Translation: Flash Chan
Source: Encrypted Valley
In 2019, the term “DeFi” (decentralized finance) became more and more popular among crypto asset enthusiasts and developers.
Encryption Valley has long been concerned about the development of decentralized financial markets. It has previously published feature articles to introduce and discuss them.
Despite the scope of DeFi, the field currently consists of three main components:
These functions are the cornerstone of a prosperous economy, so they dominate most of DeFi's markets.
In this "Trilogy" series, we will detail how these functions work in a decentralized world, how they relate to each other, and why they are so powerful.
In the first part, we discussed how decentralized lending works. To sum up briefly: decentralized lending is guaranteed by the collateral deposited by the borrower. As long as a loan is over-collateralized (the value of the collateral exceeds the borrowed asset), the loan will remain open. If the loan guarantee is insufficient, the loan platform can liquidate the collateral (sell to repay the loan).
Currently, the primary use of borrowed crypto assets is margin trading. If there is no credit loan, the decentralized margin trading will not succeed.
On the basis of the first part, we will delve into how margin trading can use loans to create positions: amplify gains/losses and create the ability to “short” the market.
Disclaimer: This series of articles is intended to provide educational information and does not constitute investment advice. The purpose is not to direct the reader to trade in margins, we do not assume any responsibility for your transactions. All transactions, especially margin trading, are inherently risky. Please be careful and do your own research and due diligence!
- Spot Trading;
- Margin trading;
What is a margin trading?
Decentralized lending can enable traders to borrow assets, and margin trading is the process of borrowing assets.
When you trade margins, you “hold positions” in a particular market.
Why do people want to trade in margin?
Margin trading can amplify your gains or losses. By borrowing funds and then trading, you can leverage leverage in the market: 2x leverage will double your gains or losses, 3x leverage will triple your gains or losses, and more. The ability to trade margins allows traders to achieve higher returns without investing additional funds in specific assets.
Margin trading has also opened up a whole new way of trading that is not possible with spot exchanges: the ability to bet on the fall in asset prices (called “short”).
In a decentralized world, this can be achieved by clever use of smart contracts, collateral management and liquidation.
Your margin position is what you think will happen in a particular market: either long or short. If I do more ETH-DAI, I believe that the price of ETH will rise relative to the price of DAI. If I short ETH – DAI, I think the price of ETH will drop relative to the price of DAI.
Understanding margin trading
Let's take a look at Bob's example.
Bob believes that the price of ETH will rise relative to the price of DAI. The current price of ETH is 180 DAI. Bob has only 2 ETHs and he decides to use his position to get more revenue!
So Bob took his 2 ETHs as a mortgage and borrowed a 180 DAI loan. Bob now holds 3 ETHs (borrowing 180 DAI) – he now holds a leveraged long position of 1.5 times ETH – DAI.
A few months later, the price of ETH soared to 300 DAI and Bob decided to close the position. To do this, Bob needs to repay his 180 DAI, plus 5 DAI interest. Therefore, Bob sold ETH (about 0.617 ETH) worth 185 DAI, repaid the loan, and closed the position. Bob now has 2.383 ETH, worth 715 DAI!
- Doing more means that you think the price will rise;
- Shorting means you think the price will fall;
This makes sense for all parties involved: the lenders are happy because they profit from interest, Bob is happy because he can leverage, and the exchange is happy because they get extra trading volume.
While the above example illustrates how margin trading works, it does not address potential risks.
In the first part, we discussed how the loan is liquidated if the mortgage rate is too low. This still applies to margin trading, but with some additional nuances.
When you open a margin position, your position will show a strong price based on the collateral interest rate (usually called the clearing price in a decentralized exchange). At this price, the value of your collateral is no longer enough to pay off your loan.
In the above example of Bob, if the price of ETH falls below 105 DAI, then Bob's 2 ETH collateral can no longer be used to repay his 180 DAI loan. Recall that in practice, the collateral interest rate (and the corresponding bullish price) is actually built on a margin of safety to reliably repay the loan. Therefore, with a safety margin of 15%, Bob's 2 ETH collateral will be sold to close the position at a price of 103.5 DAI. At the time of liquidation, Bob will still hold his 1 ETH (from the 180 DAI he borrowed and traded), but he will lose his original 2 ETH collateral.
The liquidation process of these loans varies from platform to platform and is very different. It is a very subtle area. Some platforms host so-called “dutch auctions” in which external participants, like eager vultures, wait for an opportunity to enter an attractive liquidation opportunity (this security margin brings a unique Others arbitrage opportunities, while others sell assets in a self-contained manner and use the accumulated liquidation costs to repay the loan. Regardless of the mechanism, liquidation is a huge risk to margin traders – magnifying losses is doomed to pain.
In the third part, we will discuss the pros and cons of different liquidation methods and the price oracles they rely on.
The power of margin trading
Bob's 48% gain is pretty good, but margin trading is usually much higher. Sometimes it can achieve more than 500% profit (or loss).
Platforms that allow lending and trading in a single interface (many centralized exchanges and some recently decentralized projects) can achieve much greater leverage than 1.5 times. If your loan and collateral are on the same platform, a highly leveraged position is possible.
Let's analyze why a platform needs to get both your collateral and the assets you borrow to get a higher leverage.
- In the beginning, Bob held 2 ETHs worth 360 DAI;
- In the end, Bob holds 2.383 ETHs, valued at 715 DAI, and earns 355 DAI;
- If there is no margin position, he will still hold 2 ETHs, worth 600 DAI, and earn 240 DAI;
- Bob received an additional 115 DAI, or an additional 48%, which is 1.5 times the original;
Note: There are some smart solutions that involve specialized tokens, but for the sake of simplicity, we ignore them for the time being.
- On platforms without built-in transactions, you are free to take your borrowed assets from their platform. If they do not have any control over these borrowed assets, your collateral must be able to fully cover the loan at any time. Therefore, the maximum leverage of these platforms cannot exceed 2 times (the margin of safety is usually only a maximum of 1.5 times).
In the above Bob example, if he can open a 4x leverage position, he will be able to borrow 1080 DAI instead of 180 DAI, and also 2 ETH, the end result is 930 DAI profit, not 240 DAI, yes The original profit was 387.5%.
Higher leverage is associated with higher risks: when you use borrowed assets as additional collateral, liquidation occurs faster and at a much higher cost.
In Bob's 1.5x leverage case, he uses a platform that does not use his borrowed assets as collateral: even if ETH falls, his collateral is liquidated and he retains at least the assets he borrows. However, in the case of 4x leverage, the clearing erases all assets owned by Bob: including the assets and collateral he borrowed. In addition, his position will be 155.25, rather than 103.5 – the price difference required for liquidation will be much smaller.
Next is spot trading, price oracles and clearing.
The only way for a loan, a loan, and a margin transaction to thrive is to have the ability to trade borrowed assets on the open market. This is called spot trading. In the context of DeFi, this is done at the Decentralized Exchange (DEX).
The third part will discuss in depth the different types of decentralized exchanges and their relationship to DeFi. In addition, it will cover some of the key details we have overlooked in Parts 1 and 2, which are critical to supporting loan, lending and margin trading. (To be continued)
- On the platform of built-in trading, the assets you borrow are left in their system and can be effectively counted as part of your collateral. These platforms know your account value (collateral + loan amount) at any time. As long as the platform can use all of this to cover the initial loan, your loans and positions can remain open. With this, they can achieve leverage much higher than 2 times.