What are swaps and do we index them ?

Swaps are trades between two assets on a decentralized exchange (DEX). Currently, most decentralized exchanges are automated market makers (AMMs). When a user wants to trade one asset for another on an AMM, they can initiate a swap and the AMM's algorithm will automatically determine the price and execute the trade. The user will then receive the other asset in exchange for their original assets.

Swaps on AMMs are typically facilitated by liquidity pools, which are pools of assets that provide liquidity for the DEX. You can get more information on pools in the corresponding section.

To gather swap data, we listen to every transaction on the supported networks and parse uniswap V2 and uniswap V3 swap function signatures. This general approach ensures a very high coverage and allows us to record not only swaps, but pools, tokens and other events for every contract and exchange that matches the uniswap V2 and V3 interfaces.

The recorded swaps amounts to the large majority of the trading activity on each network. And support for additional types of exchanges such as Curve, Balancer, etc. is currently being added.

Response format

timestringThe date and time at which the swap was executed, in ISO 8601 format
pairstringAddress of the pool used to perform the swap
networknumberThe swap's network ID
token0stringAddress of the pool's first token
token1stringAddress of the pool's second token
amount0numberAmount of token0 being swapped
amount1stringAmount of token1 being swapped
amount_usdnumberEstimated USD value of the swap
slippagenumberSwap slippage
receiverstringAddress that performed the swap (in general receiver address = sender address in the case of AMMs)
txstringThe swap's transaction hash
price0numberThe price of token0 in USD at the time of the swap
price1numberThe price of token1 in USD at the time of the swap
token0_symbolstringtoken0 ERC20 symbol
token1_symbolstringtoken1 ERC20 symbol
balance0number (optional)balance0 ERC20 symbol
balance1number (optional)balance1 ERC20 symbol

Example Response:

    "statusCode": 200,
    "status": true,
    "data": [
            "time": "2022-12-06T15:50:47.000Z",
            "pair": "0x5777d92f208679db4b9778590fa3cab3ac9e2168",
            "token0": "0x6b175474e89094c44da98b954eedeac495271d0f",
            "token1": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "amount0": -19861544.80018241,
            "amount1": 19864157.672041,
            "amountusd": "19860921.346291132",
            "slippage": 25.929202244234713,
            "receiver": "0x2417b973754fd3b91fe9d5916f3d70d0d0171a39",
            "tx": "0xd3f11da2800e69c42dfbf60452b4df48cb27501860727ad4719cc72f4864fb08",
            "price0": 0.99996861,
            "price1": 0.99996915,
            "network": 1,
            "token0_symbol": "DAI",
            "token1_symbol": "USDC",
            "trade_id": "309-0xd3f11da2800e69c42dfbf60452b4df48cb27501860727ad4719cc72f4864fb08",
            "balance0": null,
            "balance1": null,
            "exchange": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
            "amount_usd": 19860921.346291132
      "cursor": "MTY3MDA1MzAxOSwxMS0weDI3Mjc4Y2EyZjgwMWY1NDE1ODU2ZjE0N2I1Yzg1OGViODY2OTBjNzEyNjVmNDg3YzEwODQxMDNiYzAzODVkMmQ="