Skip to content

Get Swaps by Token

This endpoint returns swap data for a given token address. Supported chains: ethereum, polygon, optimism, arbitrum, base, avalanche.

Parameters

Parameter Description Type
chain_id A keyword (i.e. "ethereum") or CAIP-2 identifier specifying the blockchain to query. string
token_address required The address of the token in the swap. string
swap_direction Whether to match swaps that were swapped from that token (from), to that token (to), or all (all). string
from_timestamp The earlier timestamp to retrieve swap data between, inclusive (in seconds since the Unix epoch or ISO-8601 format). date-time
to_timestamp The later timestamp to retrieve swap data between, inclusive (in seconds since the Unix epoch or ISO-8601 format). date-time
order The order in which to retrieve the results (either asc or desc). string
limit The maximum number of results to retrieve (default 100). string

Response

Name Type Description
aggregator_name text The name of the DEX aggregator that facilitated the DEX swap (null if not found).
block_number integer The block number at which the DEX swap occurred.
contract_address text The contract address of the pool that facilitated the DEX swap.
contract_version text The version of the exchange contract (e.g. v1 or v2).
effective_price numeric The price of the to-token denominated by the from-token (i.e. quantity_out / quantity_in).
exchange_name text The name of the exchange that facilitated the DEX swap.
from_token_address text The address of the token that was swapped in.
log_index integer The log index at which the DEX swap occurred.
origin_address text The address that submitted the transaction that contained the swap.
quantity_in numeric The amount of the token that was swapped in.
quantity_out numeric The amount of the token that was swapped out.
sender_address text The address that sent the tokens to the pool in the swap.
timestamp timestamp without time zone The timestamp at which the DEX swap occurred.
to_token_address text The address of the token that was swapped out.
transaction_hash text The transaction hash at which the DEX swap occurred.

curl -X GET \
    'https://api.transpose.io/dex/swaps-by-exchange?chain_id=ethereum&token_address=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&swap_direction=all' \
    -H 'X-API-KEY: BtRVYj7dgnYUcr1gSSfWhmrTShIb8RBG' \

Got questions? Join our Discord

Discord is the primary home of the Transpose developer community. Join us to ask questions, share your work, and get help.