What does the "best price" in DeFi really mean?
Are your users really getting the best prices, all-in? In DeFi, the hidden costs of DEX trading can lead to drastic differences in the quoted price you’re showing users and the actual value they receive.
![What does the "best price" in DeFi really mean?](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/669aa0e21ab1212d61497ca8_0x-v2-Pricing-Header.png)
Are your users getting the best prices, all-in?
We all know the frustration of getting to the checkout page of a vacation rental or ticketing platform only to find that you’re paying much more than the advertised price after factoring in every fee under the sun. When expectations don’t meet reality, users are left feeling shortchanged.
In DeFi, the hidden costs of DEX trading can lead to drastic differences in the quoted price you’re showing users and the actual value they receive - creating a poor trading experience for users.
![](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/66bd0aa1a737dfbcd71e2cfc_669fc7f232bb8c3ed0982b2a_Trade%2520Module%2520Pricing.png)
Many applications in DeFi today still only show the quoted price, which doesn’t take into account the range of variables that can alter the final price of a trade, such as gas fees and slippage. Providing the best all-in price across every token pair, trade size, and chain is a multi-dimensional problem that requires a holistic understanding of tokens and their liquidity.
In this article, we’ll peel back the curtain on execution quality in DeFi and take a look at how 0x’s next-gen pricing engine delivers the best all-in prices.
Looking beyond the “quoted price”
Order execution quality is a measure of how effectively a trading platform fulfills buy or sell orders. In other words, how closely the quoted price reflects the final value that a user receives. In DeFi, there are essentially three different prices that are important throughout a trade: quoted, executed, and all-in price.
When trading through an app, users are often attracted to using one over the other because of the quoted price of the token they’re looking to trade. As a result, this metric is often used to measure the performance of aggregators.
The importance placed on quoted prices creates a perverse incentive for aggregators to quote the best price and thus win the trade, regardless of whether users can actually trade at that price.
So, which price really matters?
Quoted price: The quoted price is the “sticker price” of the token, the price that users are advertised and see for a given trade on an app. This price should be taken as an estimate that can vary in accuracy.
Executed price: The executed price is the price at which a trade was completed, after accounting for factors that impacted the price or completion of the trade during the time it takes to settle.
All-in (settled) price: The all-in price is the final amount a user receives after completing a trade that accounts for the cost of executing it and any variability that happens on-chain, including gas fees. This is the Golden Metric that we optimize for.
Why execution quality matters
Our next-generation pricing engine, 0x v2, was built to optimize for execution quality - identifying the route expected to deliver the best all-in price. To understand how, we need to look at the factors that impact the settled price of a trade.
![](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/66bd0aa1a737dfbcd71e2cde_669aa39f84fb5958220ae3fd_0x-v2-Pricing-Quoted-Price.png)
Liquidity, liquidity, liquidity
Liquidity and price impact can drastically affect trading outcomes. Price impact is the influence that an order can have on the market price of the token being traded. It is directly correlated to a token’s liquidity, but is also dependent on a variety of other factors, including the size of the trade and the volatility of the token.
For trading pairs with limited liquidity, like long tail pairs, price impact can be particularly high. But even pairs with significant volume can suffer from thin liquidity between the buy and sell token. In these cases, the ability to hop across multiple intermediate tokens, going from Token A to B to C to D, enables the optimal use of on-chain liquidity.
For example, let’s say a user is trying to trade a large amount of WBTC to DAI. Both are large market cap tokens with lots of liquidity, but there is very little direct liquidity between these two tokens. To get the best price for this swap, the trade needs to be routed through a multitude of liquidity sources and intermediate tokens along the way.
Deep liquidity and advanced routing are key to getting the best prices and avoiding significant price impact. 0x’s new Argon Router utilizes a state-of-the-art algorithm to deliver the optimal execution path for a trade, optimizing on two dimensions:
1. Multiplex: Splitting a trade across multiple liquidity sources.
2. Multihop: Identifying intermediate token steps which open up deeper liquidity.
![](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/66bd09a5b716bf4c932ed8e2_6695379c5419f560d8b87811_0x-v2-Advanced-Routing.png)
Alongside aggregating liquidity from 120+ AMMs, 0x v2 also features a revamped RFQ (request for quote) system, unlocking exclusive CEX-like liquidity from sophisticated market makers and opening up additional avenues for trade route optimization. 0x RFQ outperforms AMMs on price 46% of the time where available.
Gas (un)aware
All trades on decentralized exchanges require gas for token approvals and to submit transactions onchain. Often, DEX aggregators will be over-optimistic when it comes to estimating how much gas a trade will cost. Inaccurate gas estimation can impact the all-in price or lead to the trade failing - resulting in poor prices and high revert rates, both of which can lead to user churn.
With 0x v2, advanced gas awareness ensures real-world gas costs are factored into the quoted price. v2’s gas estimation is 1.5 times more accurate than v1, resulting in more accurate quoted prices and near-zero revert rates.
![](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/66bd0aa1a737dfbcd71e2cdb_669aa18977752e670559409c_0x-v2-Pricing-Sankey-Route.png)
For small trade sizes, this becomes particularly important. And if a user is swapping frequently, the cost can become significant. You want your users to get the best price even when the trade is small and gas is high. 0x can do both, complex or simple depending on what a user needs (trade pair and size) and when they need it (gas price).
Slippage
DEX trades also suffer from slippage. Price slippage refers to the change in the price of an asset caused by external market factors and not the trader’s individual trade, often by MEV attacks.
After a price is quoted and the trade is confirmed, it enters the public mempool among other transactions that are awaiting to be settled upon the mining of a new block.
While the average user isn’t aware of the trades others are making, there are others that are actively watching the sequencing of transactions and use bots to reorder transactions prior to the block mining in order to skim value off of trades.
In just the past month, MEV bots have extracted over $72 million from traders. Slippage also increases as trade size increases. For large trades, slippage can be the difference in tens of thousands of dollars. Slippage is only visible after trade settlement and typically goes unreported to the end user.
Enter 0x RFQ yet again. RFQ provides a quote that is “custom” for the trader and the rate of exchange defined by the quote is enforced at the smart contract level. Meaning, quoted price equals executed price, period. RFQ opens up slippage-free trade routes to help shield users from MEV attacks.
Failed trades
What good is the best quoted price if trades constantly fail? When a trade fails, it costs users time, money, and opportunity. Trades can fail for a variety of reasons, including lack of liquidity sources and insufficient gas.
0x v2 puts an end to failed transactions with the lowest revert rates in the industry, up to 10x lower than 1inch. Lower revert rates mean more successful trades and a better trading experience for your users.
![](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/66bd0aa1a737dfbcd71e2cd5_669aa1c0c3887a44d39df224_0x-v2-Pricing-Revert-Rteas.png)
Optimal trade execution at the best all-in prices
It’s clear that the “best price” in DeFi is not just about the “quoted price”. We need to optimize for the best all-in price - accounting for gas, slippage, and other factors that impact the actual value users receive when they complete a swap.
Along with optimizing for the best all-in price, swaps also need to be fast and reliable. What good is the best price if users are constantly wasting gas on failed trades or missing out on the latest opportunity?
0x v2 utilizes a brand new state-of-the-art pricing engine to identify the route expected to yield the best all-in price, all at lightning fast speed and with the lowest revert rate in the industry. 0x v2 beats 1inch ~90% of the time across all trade sizes, with up to 10x lower reverts.
![](https://cdn.prod.website-files.com/641b3189771d28b3a1d81347/66bd0aa0a737dfbcd71e2cba_669aa1d87599d65cbe60e2b0_0x-v2-Pricing-Trade-Comparison.png)
Deliver the execution quality and trading experience your users deserve with 0x v2.
Ready to get serious?
0x v2 is currently in open beta. Book a v2 onboarding call to get started.
We’ll be sharing more details about our redesigned router, aggregation capabilities, and smart contracts over the next few weeks.