Table Description
Thedex_aggregator.trades table captures high-level trade data executed via decentralized exchange (DEX) aggregators. These aggregators aggregate liquidity from multiple DEXs to provide users with the best possible trade execution. Unlike the dex.trades table, which records each intermediary step of a trade, dex_aggregator.trades condenses the trade data to reflect the user’s intended trade, presenting it as a single entry.
Functional Overview
Users can expect thedex_aggregator.trades table to provide a high-level view of DEX trades facilitated by aggregators. This table simplifies trade records by showing a single entry for trades that may involve multiple DEXs and liquidity pools.For instance, a user might initiate a trade to swap USDC for PEPE via a DEX aggregator. The aggregator might route this trade through several liquidity pools such as WETH-USDC and WETH-PEPE, but
dex_aggregator.trades will record it as a single USDC -> PEPE trade.
Complementary to dex_aggregator.trades is the dex.trades table, where detailed trade executions are recorded. This table captures the granular steps of each trade, including interactions with different liquidity pools. The volume routed through aggregators is also recorded in the dex.trades table. One row in dex_aggregator.trades corresponds to one or more rows in dex.trades, providing a comprehensive view of the detailed execution path that aggregated trades take.
Coverage
The table covers the following decentralized exchanges and their versions:Table Schema
| Column | Type | Description |
|---|---|---|
blockchain | VARCHAR | Blockchain on which the DEX is deployed |
project | VARCHAR | Name of the aggregator project |
version | VARCHAR | Version of the contract built and deployed by the project |
block_date | TIMESTAMP | UTC event block date |
block_month | TIMESTAMP | UTC event block month (partition key) |
block_time | TIMESTAMP | UTC event block time |
token_bought_symbol | VARCHAR | Symbol of the token bought |
token_sold_symbol | VARCHAR | Symbol of the token sold |
token_pair | VARCHAR | Token symbol pair for each token involved |
token_bought_amount | DOUBLE | Amount of the token bought in display units |
token_sold_amount | DOUBLE | Amount of the token sold in display units |
token_bought_amount_raw | UINT256 | Raw amount of the token bought |
token_sold_amount_raw | UINT256 | Raw amount of the token sold |
amount_usd | DOUBLE | USD value of the trade at time of execution |
token_bought_address | VARBINARY | Contract address of the token bought |
token_sold_address | VARBINARY | Contract address of the token sold |
taker | VARBINARY | Address of trader who purchased tokens |
maker | VARBINARY | Address of trader who sold tokens |
project_contract_address | VARBINARY | Project contract address which executed the trade |
tx_hash | VARBINARY | Transaction hash |
tx_from | VARBINARY | Address which initiated the trade |
tx_to | VARBINARY | Address which received the trade |
trace_address | ARRAY(BIGINT) | Trace address within the transaction |
evt_index | BIGINT | Index of the corresponding trade event |