Skip to main content

๐Ÿ“Š How to Get 0x and Matcha Data

* updated as of Apr 12, 2023

This guide introduces the dashboards and tools available to explore 0x data, for different needs. In this piece, we are mainly focusing on ready-made analytics solutions that donโ€™t require advanced data scraping. The following solutions are ideal for teams working on analytics product or data information sites, looking to integrate 0x data with minimum effort; or for DeFi researchers/analysts looking for ready made, reliable sources about the 0x ecosystem. At the end of the document we provide links to resources for advanced use cases.

๐Ÿ—บ๏ธ Scope and Concepts โœ๏ธโ€‹

The following resources cover active versions of 0x exchange contracts (v2, v3, v4) and API endpoints (v1 /swap). Based on the most common use cases, we will introduce how to get data on different layers of the 0x ecosystem, which are defined as follows:

1. The DEX Layer - 0x Nativeโ€‹

0x Native volume covers orders conforming to one of the 0x Native Order formats (currently two: Limit Order and Rfq Order) and are settled by 0x smart contracts. Orders generated from 0x open order book and RFQ system are settled on them. Besides that, as itโ€™s an open-source onchain infrastructure that any aggregator can use, 1inch exchange and Tokenlon have actively been using the 0x exchange contracts to settle trades. Thus this portion of volume has an overlap with other aggregatorsโ€™ volume, but no overlap with other AMM DEXes.

2. The Aggregator Layer - 0x API (/swap endpoint)โ€‹

0x API is the endpoint that allows any integrator or individual to fetch available quotes from "makers" to match their own "taker" order.

It is an off-chain order matching system that compares prices across:

  • On-chain bridge liquidity (30+ AMM pools across chain like Uniswap, PancakeSwap, etc.)
  • Off-chain native liquidity from RFQ system with Professional Market Makersโ€™ quotes
  • Off-chain native liquidity from 0xโ€™s Open Order Book network (known as mesh, accessed via 0x API /orderbook endpoint)

It returns the best price source (or sources) to users and prepares the routing information to be settled on chain โ€” by 0x exchange contracts (native liquidity) or other DEXes' contracts (bridge liquidity).

This portion has an overlap with other DEXes' volume as the bridge liquidity will be settled on their origin DEXes, but thereโ€™s no overlap with other aggregators.

For a list of all sources, see: What exchange networks does Matcha aggregate liquidity from?

3. The Application Layer - Matcha and other 0x API Integratorsโ€‹

Matcha is a user-facing product sitting on top of 0x API /swap and /orderbook endpoints. It fetches "maker" order via /swap endpoints for consumersโ€™ market orders; and submit "maker" order via /orderbook endpoints for consumersโ€™ limit orders which can later be sourced and potentially filled via /swap endpoint. Other integrators work in a similar way, but may include additional sources.

4. The Global Total - 0x Protocolโ€‹

The term 0x Protocol is used to describe the total combined volume covering both 0x DEX layer (0x Native) and aggregator layer (0x API). As we mentioned above, 0x Native liquidity can potentially be "fetched" by 0x API as well, thus there is an overlap between these 2 attributions. We make sure to de-duplicate that part to avoid double counting.


Below is a summary table for different attributions:

AttributionAvailability on chainsLayerTagOverlap with DEXes?Notes
0x NativeEthereumSettlement LayerDEXNonative volume settled on 0x exchange contracts with fired events including Fill(), rfqOrderFilled() and limitOrderFilled()
0x APIEthereum, BSC, Polygon, Avalanche, Fantom, Celo, OptimismAggregator LayerAggregatorYesnative + bridge volume going thru 0x API /swap endpoint
0x API Integrator (e.g. Matcha)Ethereum, BSC, Polygon, Avalanche, Fantom, Celo, OptimismApplication LayerAggregator (Integrator)Yesvolume Integrator affiliated on top of 0x API /swap and /orderbook endpoints
0x ProtocolEthereum, BSC, Polygon, Avalanche, Fantom, Celo, OptimismGlobalDEX + AggregatorYescombined total 0x volume with de-duplication of overlap

๐Ÿงฎ Available Data Tools ๐Ÿ“Žโ€‹

0x Data Attribution Map Existing & Coming Atttributions

๐Ÿ” 0x Explorerโ€‹

Data info site built by 0x team, for multichain stats & charts on 0x ecosystem.

0x Explorer offers an easy way to explore all 0x Protocol data across applications and liquidity sources. It gives users a comprehensive view in terms of key metrics like total trade volume, and total users.

All application are tagged here. If you see your application missing on the list, please Contact Support via the Intercom messenger in the bottom-right of your 0x Dashboard.

๐Ÿง™ Dune Analyticsโ€‹

For those looking for retrospective data, charts and stats.

0x Dashboards (planned multichain version updates coming)

Also comparison with other DEXes & Aggregators on:

If you are looking for stats on specific dates or attribution, you can click into the queries in the above dashboards, to simply fork the queries and change filter for dates or affiliate/relayer in SQL.

๐Ÿ”‘ 0x Data API (beta)โ€‹

For those looking for an GraphQL API to query 0x Protocol Data.

0x Explorer provides an API to access all the data available under a public beta, and the document is available here. If you want to get access to this data, please reach out to us through this contact form and select Data API (beta) as your interest.

๐Ÿ”Ž Decode it from Scratch (Advanced) โ›“๏ธโ€‹

Do you believe that the truth can only be found in the blockchain?

  • If you don't have a data pipeline yet - our event scraper is open source and only requires an RPC endpoint and a Postgres DB (Contributions are also welcome).
  • If you already have a blockchain data ETL already, with the full copy of data processed into relational databases - our folder under DuneAnalytics' collaborative repo will be the best reference.

Affiliate Trackingโ€‹

Being able to attribute a trade to a specifec integrator is simple if you have access to the calldata of calls made to the 0x Exchange Proxy.

  1. Find the string 869584cd in the calldata.
  2. Skip the following 32 0s
  3. The next 40 characters are the affiliate address (it is useful to prefix it with 0x so they can be later used as addresses)


  • Not all calls made to the 0x Exchange proxy have an affliate tag (869584cd) as it is optional component of the 0x Protocol
  • 0x API always adds an affiliate address to the calldata, but not all integrators have enabled tagging, in those cases the affiliate address will be 0x10000000000000000000000000000000000000011
  • Since the 0x Protocol is permissionles anybody can "spoof" tags
  • The affiliate tag is a random, or custom, address it does not contain encoded name of an integrator

Feel free to reach out to (@ktl_xv) for any questions!

The data must flow. ๐Ÿง™โ€โ™€๏ธ๐Ÿ”ฎ