Home Coins 0x (ZRX) Announcing 0x API v1. Announcing a new version of 0x API’s… |...

Announcing 0x API v1. Announcing a new version of 0x API’s… | by Fulvia | Oct, 2020


Fulvia

Announcing a new version of 0x API’s swap endpoint, the best DEX aggregator.

  • 7 out of 10 times 0x API offers better adjusted prices than 1inch, Dex Ag, Paraswap and Uniswap. That is, the price after transaction fees are paid.
  • 0x API v1 delivers market-leading gas efficiency. With a custom, highly-optimized architecture, accessing Uniswap’s liquidity through 0x API is now as cheap and often cheaper than going to Uniswap directly.
  • DeFi developers can find the 0x API docs here. Existing integrators can use this guide to migrate to v1.
  • Traders can go to Matcha — which uses 0x API under the hood — to buy and sell assets at the best price possible across all DEX liquidity sources.

In January 2020 we launched v0 of 0x API, a public tool designed to make it simple for DeFi developers to tap into all DEX liquidity in a fast and reliable way. Since launch, 0x API has processed over 29K trades that in total represent ~$550 million in trading volume.

The version 0 release represented a solid starting point, but it was clear that there was still plenty of room for improving and pushing the DEX aggregation space forward. So, we spent the last eight months gathering feedback and iterating, and today we are proud to launch a revamped 0x API v1: the highest-performing, professional-grade DEX aggregator in the industry. For 7 out of 10 trades, users get a better adjusted price through 0x API than through 1inch, DexAg, Paraswap and Uniswap.

With a simple http request, developers can fetch the best available price across 13 liquidity sources — including exclusive 0x liquidity from professional liquidity providers and proprietary AMMs, as well as 0x Mesh, Uniswap, Oasis, Kyber, Curve, Balancer, Bancor, mStable, Mooniswap, Sushiswap and Swerve. In addition to fetching prices from these liquidity sources, under the hood the /swap/quote endpoint leverages smart order routing algorithms to split orders across sources to reduce slippage and achieve the best price for a given trade.

We built 0x API v1 with one goal in mind: offering the best prices after accounting for transaction costs.

These days it is not uncommon to see screenshots comparing quotes between DEX aggregators for a given trade on Twitter. The problem with this is that comparing aggregators on quoted prices is a bad business for users as often the best quoted price does not result in the best deal once transaction costs are paid. We believe that using adjusted price is a more objective metric and a better way to measure performance between aggregators as it is what the user ultimately gets in their wallet. Wait, but why?

Adjusted price is what a user receives after a transaction is completed on-chain and transaction costs (gas and fees) are paid. It can be calculated using the following formula:

adjusted_price = sold_amount_usd / ( bought_amount_usd — transaction_costs_usd )

Let’s use an example to illustrate this:

A user wants to trade 100 DAI for USDC. Aggregator #1 quotes 100 USDC with a transaction cost of $5. Using the formula above, we can determine that adjusted price = 100 / ( 100–5 ) = $1.05.

The same user checks out a second aggregator. Aggregator #2 quotes 104 USDC for the same 100 DAI, but with a transaction cost of $10. In this case, adjusted price = 100 / (104–10) = $1.06.

In this example, Aggregator 1 wins as it ultimately finds a cheaper rate for the user to convert 100 DAI to 100 USDC. While aggregator #2 initially quoted a better rate and bought more tokens, you can observe how the transaction cost impacted the adjusted price. In conclusion, spending an additional $5 to only receive an additional 4 USDC resulted in a more expensive deal for the user.

The majority of existing aggregators seem to optimize to win quoted prices and attract users, but we often see them failing at delivering the best adjusted price. By optimizing for adjusted prices and accounting for gas costs in 0x API smart order routing, 0x API offers the best adjusted prices 7 out of 10 times.

Reducing gas usage has been a focus for our team for the past eight months. Our initial target was to cut down transaction costs by 50%, however, in 0x API v1 we achieved to cut down transaction costs, on average, by ~76% vs v0. Gas usage is currently around 460K gwei for a $50K trade, down from 1.5M gwei for the same trade in v0. These optimizations have turned 0x API into the most efficient aggregator across all trade sizes.

While, on average, 0x API uses more gas than Uniswap, 0x API offers better adjusted prices than Uniswap 7 out of 10 times. How is this possible? At 0x Labs we built a super optimized contract that allows 0x API to source liquidity that is 100% routed through Uniswap in a more gas efficient way than the default Uniswap contracts. This is particularly beneficial for smaller trades (<$5K), which are typically routed to a single source.

To exemplify this, let’s take a look at the following two transactions:

The first transaction (left) shows an ETH<>UNI trade made by going directly to Uniswap. The second transaction (right) shows an equivalent ETH<>UNI trade being 100% routed to Uniswap via 0x API. As shown in the “gas used by transaction” field, the Uniswap transaction cost ~114K gas and the 0x API transaction cost ~110K gas, that is 3.7% cheaper. Certain on-chain state and conditions can change the results (for example, if the user needs to set new allowances), but in general, using 0x API to trade on Uniswap is now as cheap and often cheaper than going to Uniswap directly.

  • Nine new liquidity sources for a total of 13, with new ones being added frequently.
  • Two 0x API exclusive liquidity sources: 0x RFQT and 0x private AMM.
  • The 0x protocol fee is no longer incurred for external liquidity sources, lowering transaction costs further.
  • Last-minute, on-chain routing to adjust (and often improve) quotes for market movements that can occur between submission and on-chain confirmation.
  • A new settlement contract that allows us have more accurate fills and gas usage lower than any other aggregator.
  • Multi-hop, a new piece of logic in our smart order routing that allows us to bridge liquidity to illiquid markets.
  • A super optimized contract that allows 0x API to source Uniswap in a more gas efficient way than the default Uniswap contracts.
  • Support for ERC20>ETH trades.
  • Support for affiliateFee, a percentage based fee integrators can add to monetize their product.
  • excludedSources, a parameter that allows integrators to exclude specific sources from the routing.
  • New /meta_transaction endpoints that allow integrators to remove or defer the requirement that the user must pay for gas and protocol fees with ETH. It provides a superset of the liquidity available via the /swap/quote endpoint.

Join our existing integrators like Matcha and offer your users the very best prices across all DEXs.

If you are a developer looking to integrate with the best DEX aggregator you can find our updated docs here.

If you are an existing integrator using v0, the migration process to v1 is quite simple. We wrote this guide just in case.

Read more about how v1 outperforms 1inch, Dex Ag, Paraswap and Uniswap here.

Questions or feedback about 0x API? Join the conversation in our dedicated Discord channel #0x_API-help.

Twitter⠀Discord⠀Telegram⠀Reddit⠀YouTube ⠀LinkedIn

Get started with our dev docs⠀Contribute on GitHub

Join us in our mission⠀Check out our open positions





Source link

- Advertisement -
Mr Bitcointe
Mr Bitcointehttps://www.bitcointe.com/
“Fact You Need To Know About Cryptocurrency - The first Bitcoin purchase was for pizza.” ― Mohsin Jameel
474FansLike
76FollowersFollow
4,567FollowersFollow
5,261FollowersFollow
1,549FollowersFollow
2,230SubscribersSubscribe
USD - United States Dollar
EUR
1.18
GBP
1.29
CHF
1.10
NOK
0.11
JPY
0.01
CAD
0.76
AUD
0.70

Most Popular

Cryptographers Are Always Going to Be ‘One Step Ahead’ of Regulators: Monero’s Spagni

While regulators are trying to restrict privacy in crypto, their efforts may be futile, according to privacy-centric protocol Monero’s maintainer, Riccardo “Fluffypony” Spagni. “The U.S....

Filecoin creator denies strike allegations

Juan Benet, the creator of blockchain-based data storage platform Filecoin, has called allegations that miners of its token have been on strike since last...
bitcoin
Bitcoin (BTC) $ 11,786.80
ethereum
Ethereum (ETH) $ 377.74
ripple
XRP (XRP) $ 0.247803
tether
Tether (USDT) $ 1.00
bitcoin-cash
Bitcoin Cash (BCH) $ 247.29
bitcoin-cash-sv
Bitcoin SV (BSV) $ 159.71
litecoin
Litecoin (LTC) $ 48.11
eos
EOS (EOS) $ 2.57
binancecoin
Binance Coin (BNB) $ 29.94
okb
OKB (OKB) $ 4.62
tezos
Tezos (XTZ) $ 2.17
leo-token
LEO Token (LEO) $ 1.22
cardano
Cardano (ADA) $ 0.107546
monero
Monero (XMR) $ 126.20
stellar
Stellar (XLM) $ 0.085254
chainlink
Chainlink (LINK) $ 10.79
huobi-token
Huobi Token (HT) $ 4.37
tron
TRON (TRX) $ 0.025702
usd-coin
USD Coin (USDC) $ 1.00
dash
Dash (DASH) $ 74.51
neo
NEO (NEO) $ 17.63
iota
IOTA (MIOTA) $ 0.271000
nem
NEM (XEM) $ 0.113003
zcash
Zcash (ZEC) $ 64.30
maker
Maker (MKR) $ 572.81
paxos-standard
Paxos Standard (PAX) $ 1.00
ethereum-classic
Ethereum Classic (ETC) $ 5.24
vechain
VeChain (VET) $ 0.011219
true-usd
TrueUSD (TUSD) $ 1.00
ftx-token
FTX Token (FTT) $ 3.63
kucoin-shares
KuCoin Shares (KCS) $ 0.925075
waves
Waves (WAVES) $ 2.85