Posted onOctober 28, 2022
[SPONSORED] Lending protocols margin trading with DeFi Saver
- Margin trading nitty-gritty
- How does margin trading work in DeFi?
- Simplified experience with DeFi Saver
- Automate to stay safe or gain more
- Simulate and try it out
Lending was one of the first essential financial use cases DeFi protocols provided us with back in 2018. In turn, lending and borrowing protocols enabled on-chain margin trading of crypto assets and one of the most popular activities in DeFi – leveraging crypto assets. The appeal lies in the potential to profit greatly from market movement as long as one guesses the right direction.
Practice usually associated with centralised exchanges launched DeFi growth in the following years, with users realising the potential DeFi protocols offer. The simple reason why many opted to go DeFi lies in the famous “not your keys, not your coins” words. These protocols’ trustless and non-custodial nature meant that users never give over their assets to a centralised entity. Whether due to regulation, political activism or other reasons, centralised exchanges and CeFi lending entities can arbitrarily freeze assets or outright ban users, practices we witnessed on one too many occasions this year. In DeFi, each user remains in control of his money, and no one can access their wallet. A premise undoubtedly worth fighting for.
Margin trading nitty-gritty
In traditional finance, margin trading refers to using borrowed funds from a broker to buy a financial asset. Before the loan, you deposit collateral, usually in the form of cash. The concept is simple: increase exposure to a market beyond the level you could do only with funds in possession by using borrowed capital. By borrowing funds, one can invest more than what one has in their account.
Of course, the critical component in margin trading is leverage or the measure of additional buying power gained from borrowing capital to trade. It is usually represented with a multiplier (2x, 3x, 10x, etc.). The higher the multiplier, the narrower the margin, more easily resulting in liquidation. This term everyone in crypto, especially DeFi, is quite familiar with refers to the automatic selling of collateral assets by the broker or a platform once the unrealised value drops below the value of provided collateral.
Overall, margin trading is a highly risky practice, potentially offering significant gains and losses. Market swings, especially in volatile markets such as crypto, can significantly amplify both gains and losses.
How does margin trading work in DeFi?
In DeFi, the process looks pretty much the same, except brokers take the form of protocols. Let’s say you think that ETH will be worth more in the future. Then you would probably want to leverage ETH and create a long position. In DeFi, a long position is essentially created by depositing a volatile asset, taking out a loan in stablecoins, and using the borrowed stable assets to purchase more of the volatile asset, you’re looking to long. If the value of the volatile asset increases, one will have to spend less of the previously purchased volatile asset to repay the amount of borrowed stablecoin assets.
Here’s an example. You have 20 ETH at the price of $1,000, which you supply to a DeFi lending protocol like, let’s say, Aave. You then borrow $10,000 with your ETH as collateral. Then you spend your $10,000 to buy 10 ETH. Now you have 30 ETH in total. But depending on how much risk you want to take, you could continue using your newly acquired 10 ETH as collateral to borrow $5,000 more, spending afterwards that $5,000 on 5 ETH more etc.
Simply put, you’re leveraging your collateral to increase ETH exposure, creating a long position. If ETH reaches $2,000, and you decide to close your position or pay back your loan of $15,000, the protocol will sell 7.5 ETH, leaving you with a hefty amount of 27.5 ETH in your wallet. This way, you now have more of the asset that is also now worth more.
The reverse works as well, resulting in a leveraged short position. Shorting using DeFi lending protocols is done by depositing stablecoin assets to a protocol, borrowing a volatile asset like BTC instead, and selling and acquiring more stablecoins as collateral. In the scenario in which the price of the volatile asset goes down, one will have more stablecoins to purchase the asset at a lower price and return less of the borrowed amount.
Simplified experience with DeFi Saver
To tackle a simple but frequent problem in DeFi – liquidations, DeFi Saver was created in 2019. Helping users stay safe from liquidations when borrowing from DeFi protocols with a sophisticated on-chain automated smart contract system in place was the original idea. And it worked. People relying on the famous dashboard could step away from their computers, knowing their DeFi positions are safe. Nowadays, DeFi Saver has become one of the default interface solutions for creating, managing and tracking DeFi positions across lending and borrowing protocols such as Maker, Liquity, Aave, Compound, and others, while constantly shipping out new advanced features and automated strategies designed to empower users of the most trusted DeFi protocols built on top of Ethereum mainnet.
Early on, DeFi Saver greatly simplified longing or shorting crypto assets using lending protocols by introducing its signature 1-tx leverage and deleverage features, Boost and Repay. The approach was to make complex protocol interaction simple. An example given earlier of longing ETH with lending protocols could be done in a single transaction instead of multiple steps with the Boost feature. The same logic is applied to deleveraging, creating and closing margin trading positions.
Here’s how things look in the background making the process of creating, leveraging and closing DeFi margin trading positions possible in a single transaction. It involves several supply-borrow-sell cycles of multiple protocol actions bundled together. Selling a borrowed asset is done through an on-chain token swap. To provide the best possible rates, DeFi Saver relies on the 0x DEX aggregator to provide the best possible rates, which sources liquidity from all the most popular decentralised exchanges on Ethereum.
Closing a position or creating a fully leveraged one includes an additional step of utilising a flash loan. Depending on the protocol used for creating a margin trading position, DeFi Saver relies on several integrated flash loan providers: Balancer, dYdX, Maker and Aave. Flash loans provide the necessary additional liquidity for these advanced transactions and features.
Using the dashboard, you can trade and, therefore, long or short numerous currently supported crypto assets in protocols DeFi Saver integrated: ETH, BTC, MKR, LINK, YFI, UNI, MATIC, MANA, COMP, AAVE, CRV, ZRX and more. Essentially all assets currently available in MakerDAO, Compound and Aave. Using Reflexer and Liquity protocols, you can only long and leverage ETH.
At this moment, it is essential to point out that DeFi Saver is also available on the two most used optimistic rollup Layer 2 networks – Arbitrum and Optimism, through Aave v3 integration. You can create long or short positions on these networks using the Aave v3 protocol for drastically lower transaction costs, making the process more accessible.
Creating long or short margin trading positions by relying on these famous lending protocols can provide additional benefits or incentives. For example, currently, you can earn additional COMP tokens for borrowing using Compound v3 protocol while creating a margin trading position with Aave v3 on Optimism yields OP token incentives.
Automate to stay safe or gain more
Upping your game further, you can even automate your DeFi management by relying on automated liquidation protection and leverage management features, for which DeFi Saver became famous over the years. Strategies to manage risk, limit losses and even lock in more profits are crucial and form the basis of any successful trading endeavour, especially when leveraging assets.
Automation is an entirely trustless and non-custodial mechanism that helps you manage your DeFi positions by actively monitoring them and making necessary adjustments depending on the market conditions, namely the price of the underlying collateral. Here’s how it works. Let’s say you have an active position in one of the mentioned lending protocols. Each has an Automation dashboard where you input your desired collateral-to-debt ratio, and once enabled, the system will take over:
- If the market moves up, it’ll borrow and increase your leverage to give you more exposure.
- If the market goes down, it’ll sell part of your collateral and deleverage the position to prevent liquidation and loss of funds.
DeFi Saver offers one of the best and most reliable systems for staying protected from the scourge of liquidation in DeFi, with a remarkable track record during market crashes. However, Automation also offers benefits when things are going favourably. How would it work with the previously provided example of leveraging ETH? Depending on user configuration, an automated leveraged position could continuously acquire more collateral as it keeps the collateral-to-debt ratio at a once-set level. That way, it would keep a constant amount of leverage, adding more ETH on the way up at various points.
In expanding automated strategies, DeFi Saver added more options to stay safe or lock in profits when margin trading. Along with conventional Stop Loss and Take Profit strategies, a more efficient and advanced version of a Stop Loss was added for Maker and Liquity protocols – Trailing Stop.
- Stop Loss – Fully closes a position once the collateral asset reaches a configured minimum target price.
- Take Profit – Fully closes a position once the collateral asset reaches a configured maximum target price.
- Trailing Stop – Fully closes a position once the collateral asset price drops by the configured percentage from its previous peak.
Currently available to Maker and Liquity users, Trailing Stop is a dynamic, percentage-based and advanced strategy, while Stop Loss and Take Profit are static strategies. It follows any upward market movement, and each new price peak moves the stop price higher, but as the direction changes, it will close the position at a percentage-based level from the market peak instead of a specific set price. Using it, one can take advantage of the favourable market direction while having a stop that would minimise losses and gradually lock in more profits as long as the market doesn’t move against its position.
For Stop Loss or Take Profit, you only need to input the threshold price below (or above) which you want the position to be closed and the asset to which to be closed (e.g., collateral asset or debt asset). Trailing Stop configuration requires inputting the percentage one would want the stop price to be below the market peak and the asset to which to close the position.
Simulate and try it out
One DeFi Saver feature fans and CT find handy is its Simulation mode. It is a sandbox mode and environment designed to test and try out all DeFi Saver features without worrying about what would happen, making potential mistakes on-chain, and committing real assets. You get a fake 100 ETH and can play around with DeFi Saver features feeling safe and confident in your actions. Simulation mode can also be used when you want to know how a specific action would get executed, ensuring everything goes as intended on a live network.
Although sophisticated and used mainly by advanced DeFi traders, DeFi Saver offers a simplified experience of creating, managing and tracking trading positions using lending protocols. With signature 1-tx (de)leverage, create and close, and unique automation options for risk management, its array of on-chain DeFi margin trading features remains unparalleled among DeFi interface providers.