Skip to main content

Table Description

The dex_solana.trades table captures detailed data on trades executed via decentralized exchanges (DEXs) on the Solana blockchain. This table records all raw trade events that occur across all liquidity pools on Solana DEXs, providing a comprehensive view of the entire trade execution process and detailing the specific paths and liquidity sources utilized.

Functional Overview

The dex_solana.trades table provides an in-depth view of trades on Solana-based decentralized exchanges like Raydium, Orca, or Serum. This table includes entries for each segment of a trade that passes through different liquidity pools, as well as single-step trades. For example, a user may initiate a trade to swap USDC for RAY. If this trade is executed through multiple liquidity pools, such as USDC-SOL and SOL-RAY, the dex_solana.trades table will record each segment of the trade as a separate entry. Conversely, a single-step trade, such as directly swapping USDC for SOL, will be recorded as a single entry. This detailed approach allows for granular analysis of trade execution paths on Solana, enabling users to:
  • Analyze Liquidity Sources: Understand which liquidity pools are used and how they interact in both single-step and multi-step trades on Solana DEXs.
  • Track Trade Execution Paths: Follow the exact route a trade takes across different Solana DEXs and liquidity pools.
  • Assess Slippage and Execution Quality: Evaluate the impact of each step on the overall trade execution, including slippage and price changes in the Solana ecosystem.
  • Monitor Market Dynamics: Gain insights into the behavior and dynamics of different liquidity pools and DEXs over time on the Solana blockchain.
By providing comprehensive trade details, the dex_solana.trades table supports advanced analytics and research into DEX trading behavior and liquidity management specific to the Solana ecosystem.

Coverage

Table Schema

ColumnTypeDescription
blockchainVARCHARBlockchain (always solana)
projectVARCHARName of the DEX protocol
versionINTEGERVersion of the contract
version_nameVARCHARVersion name
block_monthDATEUTC event block month (partition key)
block_dateDATEUTC event block date
block_timeTIMESTAMPUTC event block time
block_slotBIGINTBlock slot number
trade_sourceVARCHARWhether the trade was a direct call or routed through an aggregator like Jupiter
token_bought_symbolVARCHARSymbol of the token bought
token_sold_symbolVARCHARSymbol of the token sold
token_pairVARCHARToken symbol pair
token_bought_amountDOUBLEAmount of the token bought in display units
token_sold_amountDOUBLEAmount of the token sold in display units
token_bought_amount_rawUINT256Raw amount of the token bought
token_sold_amount_rawUINT256Raw amount of the token sold
amount_usdDOUBLEUSD value of the trade at time of execution
fee_tierDOUBLEPool fee tier (fee percentage)
fee_usdDOUBLEFee paid on swap in USD
token_bought_mint_addressVARCHARMint address of the token bought
token_sold_mint_addressVARCHARMint address of the token sold
token_bought_vaultVARCHARToken vault address for the pool, of the token bought
token_sold_vaultVARCHARToken vault address for the pool, of the token sold
project_program_idVARCHARPool program ID of the DEX project
project_main_idVARCHARProject main ID
trader_idVARCHARAddress of the trader who initiated the swap
tx_idVARCHARTransaction ID
outer_instruction_indexINTEGERTop-level instruction index for the transaction
inner_instruction_indexINTEGERInner instruction index for the transaction
tx_indexINTEGERIndex of the transaction in the block slot

Table Sample

Examples

The following query demonstrates how to use the dex_solana.trades table to calculate the total volume of trades on a weekly basis for Solana DEXs.
SELECT
  DATE_TRUNC('week', block_time) AS week,
  SUM(CAST(amount_usd AS DOUBLE)) AS usd_volume
FROM
  dex_solana.trades
WHERE
  block_time > NOW() - INTERVAL '365' day
GROUP BY 1
ORDER BY 1