How to margin trade without a brokerage
Learn how to margin trade using DeFi and the risks involved
Level up your open finance game three times a week. Subscribe to the Bankless program below.
Dear Crypto Natives,
Borrow + Trade = Margin Trading
Those two money verbs allow you to amplify your gains and your losses on trades. We’re going to cover how to margin trade in DeFi today’s tactic.
But this is an advanced skill. I’m cautious of this power tool in the hands of beginners. Many reading this shouldn’t be margin trading crypto at all. If your strategy is to grow your crypto money it’s hard to beat a buy, hold, & stake strategy.
But we’re on Tactic #35 now.
You who’ve been kept up with the program already know the fundamentals of dollar cost averaging, you have a portfolio strategy, you’ve determined your time horizon—you know all the dangers and how to hedge potential losses.
This tactic is for you—the advanced traders in the bankless community.
Because if you’re going to allocate a portion of your portfolio to trading why not do it in the most bankless way possible—from an Ethereum walllet?
Cause once you learn how to margin trade in DeFi you may never go back to your centralized exchange.
Bye bye BitMex.
P.S. Look for the special discount for Bankless readers in today’s tactic 🥳
Tactic #35: How to margin trade without a brokerage
We’re going to learn how to margin trade using DeFi and the risks involved. We’ll focus on dYdX, the largest and most established non-custodial margin trading tool.
Goal: Learn how to open and manage a margin trade on dYdX
Skill: Intermediate DeFi skills but Advanced trading skills
Effort: 30 minutes
ROI: Positive ROI if margin trade (long / short) directionally follows market movement
Guest post: Sid Ramesh, DeFi Consultant & Advisor
Using dYdX to margin trade
This tactic is focused on dYdX because it’s the leading decentralized platform for advanced financial products including margin trading and nothing is close—they’ve recently expanded to perpetual BTC contracts too.
dYdX gives users the ability to borrow, lend, and margin trade across any supported asset. dYdX is powered by smart contracts on Ethereum eliminating the need to trust a centralized exchange to custody your assets while trading.
The growth of dYdX has been incredible. Despite only launching in May 2019, dYdX has now originated more DeFi loans than any other money protocol ( >$1 billion USD) and processed over $550M+ in total trading volume across ETH, DAI, and USDC markets in the last 7 months.
Get 10% off dYdX fees…
👉Get 10% off DyDx this link: https://trade.dydx.exchange/r/bankless
Margin and Leverage 101
Margin and leverage are extremely important concepts to any trader actively participating in the market. The underlying principles and how they’re applied are the same for DeFi as they are in traditional markets.
Margin is the collateral amount being deposited by the trader. Borrowed funds are usually collateralized by other assets and must be repaid with interest.
Leverage is created through margin—leverage increases the buying power available to allow a trader to place a higher value trade than they otherwise could.
Should you margin trade crypto?
Trading crypto on margin (or leverage) allows you to amplify gains or losses on your trades, including access to short exposure on investments.
Designed for advanced traders, margin doesn’t just allow you to have increased upside potential on trades, but can also help diversify your portfolio, allowing you to hedge or arbitrage across multiple positions without depositing additional capital.
Margin is considered much riskier than normal trading and may not be suitable for everyone because the crypto markets typically experience high levels of volatility.
Bankless readers should be cognizant of the risks when margin trading crypto. Here are some tips if you’re new to margin trading:
Start small. Avoid using margin on long-term crypto investments. As the classic saying goes, never trade more than you can afford to lose.
Pay attention to your liquidation price. It is important especially when trading during periods of extreme volatility as the liquidation price can come in an instant and force close your positions.
Never trade under pressure. Don’t fall victim to wild speculation.
Learn risk management. For example, consider using stop losses. This may help you in preventing major losses when trades go the wrong way.
dYdX Margin Guide
Now that we’ve covered the basics, let’s focus on how to margin trade crypto on dYdX.
dYdX currently offers three margin trading pairs:
Before you’re able to start trading on dYdX, you’ll need to first deposit assets into the platform that you want to margin trade with. Using an Ethereum Wallet, you can deposit funds (ETH, USDC, and DAI) on the Balances page. dYdX supports all of the popular Ethereum wallets such as MetaMask, Coinbase Wallet, Ledger, and Trezor.
Note that by default, your funds will automatically begin earning interest immediately after you deposit to dYdX.
Let’s dive into opening and managing a margin position on dYdX.
Opening a Position
The “Margin” tab on dYdX allows you to input the preferences on your position. The different fields are as follows:
(Above) Entering trade preferences on the “Margin” tab
Position Type (Long/Short)—choosing your position side is the first step to opening any margin position. Long positions gain value if the underlying asset increases in value, short positions gain value if the underlying asset decreases in value.
Position Size—This is your total position size, or the total amount you are long/short.
Leverage—Leverage controls how much of your margin position is borrowed. It is a multiple that you can choose up to 5x. The higher the leverage is, the smaller your margin deposit is and the more funds you borrow to open your position.
Once you have selected the above parameters for your position, more fields will appear to provide additional details about your position. All the fields here are important, but you’ll want to pay special attention to these:
Margin Deposit/Trade Amount—When placing trades on the “Margin” tab, there are two parts to your position: the margin deposit and the borrow/trade amount. The margin deposit is your own personal stake (equity) in the position. The borrow/trade amount is the remaining portion of your position, consisting of borrowed funds to execute the margin position.
To open your margin position, you’ll need to have enough funds in your dYdX account to cover the margin deposit. For example, let’s say you want to open a 5X LONG position on ETH-DAI with a position size of 1.0000 ETH. The margin deposit for this position is 0.2 ETH, so you’ll need to have at least 0.2 ETH deposited in your account to open this position.
⚠️Important—when opening a position on the “Margin” tab, you can lose no more than your margin deposit amount.
Liquidation Price — When margin trading, you are borrowing funds to gain added exposure to the market then you normally would be able to.
Each of your positions have a certain collateral (positive balances) to debt (negative balances) ratio. This ratio is called collateralization and you can read more about it in dYdX’s guide to borrowing.
⚠️Important—If your collateralization ratio gets dangerously low and crosses dYdX’s liquidation threshold, your position will get liquidated. Upon liquidation, collateral in your position will be sold until all your negative balances are zero, and a 5% liquidation fee will be taken.
Liquidations on dYdX are onchain and transparent, meaning anyone can participate in liquidations to earn the liquidation fee.
Interest Rate — This is the average interest rate your position will pay/earn depending on the market rates: you will earn interest on the collateral locked in your position, and pay interest on the amount borrowed. Sometimes you may be earning more than you pay, or vice versa.
These interest rates change based on supply and demand, so you can always track each individual assets’ interest rate on the dYdX markets page.
Fee & Fee Amount — You can read about dYdX’s fee structure here. Fees enable dYdX to continue building a powerful and open product for users, while also helping to cover gas costs. (RSA note—you can use this link to get 10% off these fees)
What about gas fees? On dYdX, all trades are resolved on-chain, and dYdX covers 100% of the gas fees for each trade.
Expiration — For US persons, regulations require all margin trades to have a 28 day expiration. If this applies to you, make sure you close your position before your position expires. You can learn more about expirations here.
Once you have verified all the fields related to the position you are opening, simply click the “Open Position” button, sign the order that pops up in your wallet (no gas fees), and you should see a notification telling you that your position has successfully been filled.
Once the “fill” transaction for your position is mined and your balances update on dYdX, the spinner on your position will disappear and you’ll see live numbers appear in your position.
Congratulations! If you’ve completed the steps until this point, you would have opened your margin trade on dYdX.
Understanding open positions
You can view your open positions on the “Positions” tab on the bottom part of the trade page.
You can click on any position to expand the row and see more information about the position.
You’ll be able to view details about your open position such as:
PNL—This is the total profit/loss you would earn by closing the position. On dYdX, PNL is calculated based on value, not amount.
For example, let’s say you open a long on ETH-DAI with 1 ETH as your margin deposit, and when you close your position, you end up with exactly 2 ETH. Let’s also assume the price of ETH increases from 100 DAI to 200 DAI between the time you opened and closed the position.
In this case, your PNL will actually be 300% since the value of the ETH was 100 DAI when the position was opened, and 400 DAI when the position was closed.
Stop / Index—dYdX supports stop loss orders on your positions. A stop loss order will automatically close your position at a certain price if the market prices move unfavorably for your position. This allows you to prevent further losses without having to be present to close your position manually.
The index price is the on-chain oracle price, and is slightly different from the mid market price you may see in the orderbook or near the price chart. All liquidations and stop order triggers are based off of the index price. The index price is aggregated from multiple different sources, which protects you from things like flash crashes on a single exchange.
Closing your position
To close a position, hover over to the margin position you would like to close. You’ll see the “Close” button appear on the right side of the position row. Clicking this button will open up a modal, where you can specify exactly how much of your position you would like to close.
Clicking the “MAX” button will pre-fill the amount to fully close your position.
Once you have entered the amount you want to close, simply click “Close position”, sign the order (signing costs no gas, same as when you open a position), and you should see a notification indicating the trade to close your position has been filled!
Once the transaction gets mined, you’ll see your position disappear from the “Positions” section.
When you close your position manually, the remaining equity in the position is automatically transferred to your main account. However, if your position is closed via liquidation, expiration, or stop loss order, you’ll need to withdraw your funds from the position.
Awesome, that’s the end of the tactic. You’ve now know how to margin trade without a centralized brokerage!
[Credit: Thanks to Zhuoxun Yin and Everett Hu]
Sid Ramesh is a consultant and advisor to early stage teams in crypto that’re building financial products on Bitcoin and Ethereum. He’s currently involved with a number of projects such as dYdX. Learn more about Sid’s background.
Open a margin trade on dYdX with a small amount to try it
Consider: are you comfortable with risks involved in margin trading?
Bonus Action (Advanced users):
dYdX recently released a BTC/USDC perpetual contract market w/ up to 10x leverage, a bankless alternative to leverage BTC trading on BitMEX. We’ll be covering the BTC/USDC perpetual in-depth in a future tactic. In the meantime, advanced non-US users can sign up for early access to their alpha here.
🙏Thanks to our sponsor: Aave Protocol
Aave protocol is a decentralized, open-source, and non-custodial money market protocol to earn interest on deposits and borrow assets. It also features access to Flash Loans, an innovative DeFi building block for developers to build self liquidations, collateral swaps, and more! Check it out here.
Not financial or tax advice. This newsletter is strictly educational and is not investment advice or a solicitation to buy or sell any assets or to make any financial decisions. This newsletter is not tax advice. Talk to your accountant. Do your own research.
Disclosure. From time-to-time I may add links in this newsletter to products I use. I may receive commission if you make a purchase through one of these links. I’ll always disclose when this is the case.