Beginner's Guide: Perpetual Trading on dYdX
A step-by-step guide to trading perpetual contracts on dYdX's Layer 2 platform.
- dYdX is a decentralized exchange built on Ethereum. It's powered by the Layer 2 solution StarkWare.
- dYdX allows perpetual trading on a wide variety of crypto assets.
- Our guide details how to open a long position, set limit orders, and place stop losses.
Share this article
Crypto Briefing explains how to use dYdX, one of the fastest-growing platforms for decentralized perpetuals trading on the Ethereum blockchain.
An Introduction to Perpetual Trading on dYdX
Since launching in 2018, dYdX has become the largest perpetual trading platform for crypto assets.
The average daily transaction volume of dYdX surged to almost $10 billion in September 2021, surpassing that of decentralized trading platforms and centralized exchanges like Coinbase.
Introduced by the centralized exchange BitMex, perpetuals, otherwise known as “perps”, are a type of derivative that allow traders to gain long or short exposure to a certain crypto asset. Perpetuals function similar to futures contracts, only they never expire according to a schedule.
dYdX is powered by the Ethereum Layer 2 solution StarkWare. Although it also offers derivatives trading on Layer 1, it will move to exclusively Layer 2 from November 2021.
Since dYdX is a decentralized exchange, users are not required to complete Know Your Customer (KYC) procedures like they are with most centralized exchanges. All you need is a funded crypto wallet and you can start trading in a matter of minutes.
dYdX uses the same order book system found on centralized exchanges. It also enables advanced order types. It is non-custodial, which means that traders retain access to their funds at all times via an Ethereum wallet.
This beginner’s guide details the step-by-step process for traders looking to start trading on-chain perpetuals.
Connect MetaMask Wallet and Generate Stark Key
Start by transferring funds from Ethereum mainnet to StarkWare.
Go to the official dYdX website and click on “Connect Wallet” on the top left-hand side of the page. A pop-up will then appear asking you to connect with an Ethereum wallet, such as MetaMask, Ledger, Wallet Connect, or imToken.
For this tutorial, Crypto Briefing used the most popular Ethereum wallet, MetaMask.
After connecting your wallet, a pop-up will invite you to generate a Stark Key (see the screenshot above). The Stark Key helps identify a user’s account and creates a secure interaction between Layer 1 and Layer 2.
There is no backup of the Stark Key—it gets saved on the Web browser. Click on “Generate Stark Key” to generate a Signature Request. Sign the transaction—there is no gas fee to sign.
After successfully creating a Stark Key, dYdX will ask you to acknowledge the legal terms. Click on “I agree” to proceed. Note that dYdX restricts access to U.S users.
After agreeing to the terms, dYdX asks you to create an account with an optional username and email address. To sign up without adding a username or email address, skip and click on “Create account.” A popup will then appear in your wallet to request a wallet signature. Signing this request gives access to enter dYdX.
To begin trading on dYdX, you must deposit funds from Ethereum mainnet. Currently, the platform only accepts the stablecoin USD Coin (USDC) as trading collateral. Top up your wallet with USDC if you do not have any funds.
When you add USDC to dYdX for the first time, you must enable spending through your wallet. This allows dYdX to spend USDC from the wallet with the project’s smart contract. Approving the transaction requires paying a gas fee in ETH.
After enabling USDC for spending, deposit the amount of USDC you would like to trade with. This transaction also requires paying a gas fee. USDC should then appear on your trading account. At that point, you can start trading.
Start Perpetual Trading
To start trading, head to the “Trade” tab and select a crypto asset that you want to trade. Besides Bitcoin and Ethereum, dYdX allows perpetual trading for several major crypto assets. In this guide, Crypto Briefing demonstrates how to take a long position on Polygon’s MATIC token. Click on the asset, in this case MATIC, to open the trading window.
The funds you deposited show up as “Equity” in the trading interface. In the screenshot above, the Equity deposited from Ethereum mainnet is $9.92.
Deciding how much leverage to use is one of the most important steps of perpetual trading. Leverage is the amount of funds you borrow from the platform to make a trade. It serves as a multiplier on gains or losses.
dYdX allows up to 10x leverage trading. With $9.92 as Equity, the platform gives a maximum Buying Power of $99.20. Note that using 10x leverage can result in liquidation if the asset makes a 10% move in the opposite direction of your trade.
To avoid considerable losses of borrowed capital, dYdX liquidates your position after a certain threshold. Before you enter the trade, the platform automatically calculates the liquidation price of a position.
Going Leveraged Long
Scroll on the leverage slider according to your preferred risk level. Crypto Briefing picked just under 2.5x leverage to mitigate the risk of liquidation.
Select “Place market order.” In the example pictured, the amount of leverage and equity amounts to an allocation of $24.66 after accounting for a taker fee.
$24.66 buying power equates to a position size of 19 MATIC tokens at an index price of $1.30 per MATIC.
The Liquidation Price shows on the bottom right-hand side of the page. In this example, the price is $0.82 per MATIC.
As the trade was a market order, it was immediately filled. The “Portfolio” tab shows all open positions, in this case long 19 MATIC with 2.49x leverage.
Note: You can also place a limit order to buy or sell a given asset at a specified price. You can learn more about the various Perpetual order types on dYdX here.
Closing a Position With Limit Orders
To close a position, you can create a limit order that sells the tokens at a specified limit price.
To do this, go to the “Trade” tab and place a limit order to sell the asset, in this case 19 MATIC. Select a Limit Price. In the example above, Crypto Briefing selects a price of $1.80 per MATIC.
The platform will automatically enter the same leverage used in the prior buy order.
In the example above, the trade will execute if the price reaches $1.80. This would mean the position is sold at $34.20, leaving a profit of $9.54.
As the trade is only executed if the price crosses the limit price of $1.80, the MATIC position will remain open. You can also exit an open position at any time by manually clicking on “Close Position” at the bottom of the Trade tab.
Placing a Stop Loss
Risk management is crucial in crypto trading, especially when using leverage. If you are holding a long position, placing a stop loss order above the liquidation price is an effective way to manage risk.
dYdX also lets you create stop loss orders to minimize capital loss from market volatility. This means that if the price of the asset falls, the position will close before the platform can liquidate it.
You can place a short sell after selecting “Stop” under the Trade tab. In the example above, Crypto Briefing selects a stop price of $1.20, 7.6% below the original entry price.
Click on “Place stop order.” If the price drops to $1.20, the position will be sold and the trade will close.
Derivatives trading is considered very risky and is not recommended for beginners. However, for those looking to trade perpetuals on crypto assets in a trustless manner, dYdX’s Layer 2 exchange might be the best place to get started. With deep liquidity, a range of supported assets, and low gas fees thanks to StarkWare’s technology, dYdX has created a derivatives platform that rivals the most established centralized exchanges.
Disclosure: At the time of writing, the author of this feature owned DYDX, ETH, and MATIC.