Understanding dYdX Automated Market Making Protocol Tools

Anikys3reasure
12 min readDec 31, 2021

Hello readers!!

Here is a one in million kinds of article you’d see in the crypto space. As a professional trader and crypto enthusiast, you need to read this to the end as it is full of trading information you will not easily find in a single article.

Read on!!!

In the crypto space, every crypto user has something in common, and that’s simply the fight for Decentralization. Years back, BITCOIN came to us through a technology called Blockchain Technology, this technology has made it possible for us to have full control of our assets in an easy, censorship-free, and transparent way which is the Decentralization we all wanted. All blockchain networks got their own cryptocurrency which serves as the financial assets (Utility token) used to interact within the blockchain network.

The financial assets of different blockchains are the reason we cannot do away with transactions. Users always want to trade from one thing to the other but there’s a problem of TRUST between users exchanging their assets which is why crypto exchanges are needed.

Crypto Exchanges

These are digital marketplaces where you can buy and sell your crypto assets. Crypto cannot be bought from anywhere, buying/selling requires that you create an account with any crypto trading platform to give them what you have to get whatever coin you need which could be your local currency to buy crypto through a debit/credit card, exchange with another user on the same platform or exchanging from a particular network coin to the other e.g., Bitcoin to Ethereum, Ethereum to Litecoin or any coin to another.

There are two types of exchanges in the entire crypto space;

  • Centralized Exchange
  • Decentralized Exchange

Centralized Exchanges

These are online trading platforms for buying and selling crypto assets. Seeing that cryptocurrencies are decentralized assets, most investors and crypto users find centralized exchanges strange for trading their assets because they take custody of assets from their users.

Centralized exchanges are the third party between buyers and sellers of crypto, traders give custody of their funds in order to find a trading partner to give what they have for what they want. Users of CEXs platforms keep their funds in an exchange owned wallet and this literally means their assets doesn’t belong to them as long as they are on the exchange unless the assets are withdrawn to a non-custodial wallet.

Decentralized Exchanges

Decentralized Exchanges are also known as DEXs are cryptocurrency marketplaces. They operate in decentralized manners with no third party or custodian available between the buyer and the seller, no centralized authority is responsible for how the storage of assets, trading and exchanges works. They make peer-to-peer transactions available to interested users through automated smart contracts (self-executing agreements).

Today in the crypto space, they are so many DEXs and each of them has a different model they operate with. Users that want privacy while carrying out their trading activities should consider using Decentralized Exchanges, all trading on DEXs is completely anonymous, no KYC (Know your customer) is required.
See a few benefits of DEXs below;

In this context, Decentralized Exchanges are our focus. DEXs operate with different models and all Dexs allow users to directly trade with each other using their self-executing agreements known as Smart Contracts.

Types of Decentralized Exchanges

Automated Market Makers

AMM is one popular model used by DEXs. AMM-based DEXs are for solving liquidity problems and all problems relating to human market making. In the traditional order book system, buy and seller orders are matched before exchanges can take place but AMMs replaced this with liquidity pools funded by different users who gets a share of transaction fees charged by the exchange(protocol) for executing trades on the pair in which liquidity was added by them(users).

Dex Aggregators

Dex Aggregator uses several different mechanisms and protocols to solve liquidity problems for their users, any Dexs with aggregators are known for aggregating liquidity from other Dexs to minimize all trading costs (slippage) for their users, optimize token prices and all trading fees. They basically make available to their users, best possible trade prices within a short period and also aim to create a better experience for their users through protection from pricing effects and the possibility of failed transactions.

Order Book Dex

Truly, AMM-based dex solves liquidity problems, enables automated and permissionless process of exchanging crypto assets through liquidity pools but AMM still have limitations like arbitraging, high gas fees for transactions, frontrunning and many more.

These limitations are the reasons we need Order Book Dexs, they simply compile buy and sell orders of each pair of cryptocurrencies in a single place. In the order book system, buy orders are referred to as “Bids” and sell orders are called “Asks”. The buy orders indicate that a trader is willing and ready to buy or bid for the pair of assets involved and the sell order signifies that a trader is willing to sell or ask for the pair of crypto, the order book is organized and matches suitable buyers and sellers with related prices in order.

Order Book Dexs clear the limitations of the AMM Model as it combines the features of a centralized and decentralized exchange to provide the best trading experience for users, cryptocurrencies are traded through order book but in a trustless environment and non-custodial manner.

There’s no doubt that Order Book Dexs are extremely useful for users who want high liquidity exchange, privacy for their trades(anonymous), transaction speed likened to that of centralized exchanges, low gas fees and full trade security.

dYdX is one decentralized exchange that offers extensive trading tools for all traders in the crypto space easily used by professionals, amateurs and newbies. Their Market Making Protocols are Automated with features of both centralized and decentralized exchange to give traders the best trading experience.

Have you been searching around or thinking of the possibility of an exchange that operates exactly like a Centralized Exchange in a Decentralized Automated manner operating an Order Book Model?

Here is the best so far

dYdX

The Fastest and Most Powerful Decentralized Exchange Ever

Having said a lot about DEXs and how they operate in previous paragraphs

Read on to learn about dYdX

DYDX is a hybrid decentralized exchange that operates an order book model common to centralized exchanges but in a decentralized way with Order Book and Matching Engine as the main Centralized Exchange attribute and Smart Contracts as the Decentralized Exchange Component.

dYdX Order Books are off-chain with On-chain settlement combining the transparency and security of decentralized exchange with the usability and speed of a centralized exchange. The UI is likened to that of a traditional trading platform even though fully decentralized and they charge a small fee on all trades carried out on their interface.

dYdX had chosen the order book model because they are more efficient than AMMs and fewer funds are required to achieve the same goal as AMMs in terms of liquidity provision and transaction fees.

Before a user can do anything on dYdX exchange or use any of the products/services they offer, you must be ready to connect your personal crypto-wallet. dYdX doesn’t take custody of your assets when you do trade with them. Therefore, you must be the owner of the wallet to successfully connect to the platform.

A few steps below will help you connect successfully.

  • Step 1
  • Step 2
  • Step 3

From here, you have successfully connected and can now see your address at the top right corner

DyDx Products/Services

dYdX offers useful service/trading tools in Decentralized Finance (Defi) and all are built on Ethereum’s Layer 1 main chain except for Perpetual contract trading moved from Ethereum Layer 1 to Layer 2 scaling solution in February 2021 to speed up transactions and reduce the gas fee on Defi at the time. dYdX Layer 2 was built with and operated jointly with StarkWare using ZK(Zero-Knowledge)-Rollups to boost scalability.

dYdX uses crowdsourced liquidity, every trader depositing collateral to open a position is borrowing from a decentralized liquidity pool funded by other traders. The dYdX Layer 1 got enough liquidity for Margin and Spot trades while the dYdX Layer 2 offers Perpetual Contract trading of different crypto assets to traders, very affordable and easy to use.

Below are the trading tools for Automated Market Making by dYdX:

  • Spot Trading
  • Margin Trading — Cross Margin Trading & Isolated Margin Trading
  • Perpetuals Contract Trading
  • Lending and Borrowing

Spot Trading:

As the name implies is executing trades at a point or immediately, like in every centralized exchange, we have spot trading where you can create buy, sell and stop-limit orders and have these orders filled in a timely manner. dYdX have spot trading supporting only three asset pairs and they are ETH-DAI, ETH-USDC, and DAI to USDC.

See what the interface looks like;

To deposit, click on Deposit and follow the prompts, quite easy.

Before moving on to talking about all other Trading tools available on dYdX Exchange, it is important to talk about* “LIQUIDATIONS”* because Liquidation is supported on the 2 major trading tools on dYdX Exchange, Margin Trading and Perpetual Contract Trading. dYdX uses the over-collateralization protocol to protect lenders and as an assurance for loan repayment.

LIQUIDATION

Traders must maintain a minimum amount of supported assets (USDC, DAI, ETH) for borrowing assets on both Margin and Perpetual contract trading as collateral managed by a smart contract, when this minimum amount is not maintained, leveraged positions will be liquidated.

Traders on dYdX are required to maintain a minimum collateralization ratio of at least 115%, under-collateralization automatically means Liquidation. It is automatically repaying another user borrowed asset plus interest.

The close price (For Liquidation) of a position is calculated with the formula below, either short or long trade.

  • Short — P × (1 + (M × V / W))
  • Long — P × (1 − (M × V / W))

P represents the market Oracle Price
M represent the market maintenance Margin Fraction
V represents Total Account Value
W represents Total Maintenance Margin Requirements.

See detailed information on the Formula and how funding is calculated Here

Margin Trading

dYdX is the first crypto derivative decentralized exchange giving its users the option of different kinds of trades including Margin Trading. In Margin trading, traders can trade by borrowing crypto from a third party using their assets/funds (Supported by the platform) in crypto as collateral.

Crypto Margin Trading has two positions you can subscribe to while trading, Buy/Long and Sell/Short. When a trader “Long” an asset, it means you think the asset will go up and when you “Short”, you think it will go down. Margin simply allow you to borrow and trade with a bigger stack of the asset. The asset available as collateral and the leverage used will determine what you can borrow /risk & gains involved.

The leverages are always in 2x, 5x, 10x, 15x, 20x and so on, this is the determinant of your trade multiplier, it determines how much gains/losses you can make from the trade if the trade goes exactly as speculated (i.e., you “Long” that it should go up or you “Short” that it should come down).

The leverage looks good, but it is advisable to always think in both ways because the higher the leverage, the higher the risk if your prediction happens to be wrong. Therefore, it is mostly advisable for only professional traders that understand TA, to avoid getting Liquidated.

There are two types of Margin Trades on the dYdX exchange.

Isolated and Cross Margin Trading

  • Isolated Margin Trade — Traders can leverage only on a single position allowing them to manage their risk by restricting the amount of margin allocated to a trade. In any possible liquidation, the total margin will not be affected instead the Isolated margin balance will be liquidated.
  • Cross Margin Trade: In Cross Margin, users have their entire margin shared across all open positions, this is a cool kind of margin trading as realized PnL (profit and loss) from one open position can help sustain another position from getting liquidated. The risk involved is that traders can lose their entire margin balance to a liquidation.

To trade on dYdX, Users must first deposit their asset (USDC). You have a perpetual account, and they currently offer cross-margining across your Perpetual account. This means that an account can open multiple positions that share the same collateral. Isolated margin can be achieved by creating separate accounts (sub-accounts) under the same user.

Perpetuals Contract Trading

This trading has a mixture of futures trading and margin-based spot trading. Traders speculate on a future increase or decrease in the price of a crypto asset, just like in cross margin, Buy/Long stands for rising in price while Sell/Short stands for fall in price, the good news here, it doesn’t have an expiry date and users can have their long or short positions opened indefinitely. On dYdX, traders have access to perpetual contract trading of 22 different crypto assets with leverage up to 25x including BTC, ETH and Cardano.

dYdX is currently focused more on derivative trading seeing the strong interest from Defi users both retail and institutional. Perpetual is a perfect cost-effective trading with leverages and dYdX model is focused on seamless trading experience across many perpetuals.

Here are trading keywords you must understand.

Prices are available on the trading page of each Perpetuals.

You can read about dYdX Perpetual L2 specs Here, FAQs on trading Perpetuals Here and Perpetual Trade Fee Information can be seen Here

Lending and Borrowing

dYdX also offers Lending and Borrowing for their users, if you think you’re not a professional trader and you want to earn from dYdX Defi offerings then you can go for Lending. Once you deposit your assets into the platform, your assets automatically accrue interest and as a borrower on dYdX, you must deposit your collateral first and it must be overcollateralized at 115% of the borrowed asset value.

dYdX Exchange has numerous advantages because of the model they operate currently with StarkWare Layer 2 Network aside from taking out high gas fee cost users, they’ve brought significant improvement to trading experience more than any other platform in DeFi so far.

See the advantages of trading on dYdX Layer 2 in the diagram below.

Conclusion

dYdX has provided everything needed for a good DeFi experience and have simplified Decentralization to the best. So many crypto users today still stick to using Centralized Exchanges because of the features they got, and less gas fee required to perform transactions but leaving the entirety of their asset in centralized custody.

dYdX is ensuring Decentralization for everyone including YOU.

To start trading on dYdX Exchange

GO Here.

Follow on Twitter, Reddit, See Github and Join the Discord Community to get more updates on dYdX.

Thanks for Reading

All Images Created by Me and Screenshots are from dYdX

--

--

Anikys3reasure

Blockchain/Crypto Content Developer, Graphics Designer