hessTotal Pairs
    Updated 2023-10-10
    with dex as ( select date(a.block_timestamp) as date, 'Avalanche' as chain, 'WAVAX' as token,
    case when amount_in_usd is null then amount_out_usd
    when amount_out_usd is null then amount_in_usd
    when amount_in_usd>=amount_out_usd then amount_in_usd
    when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
    , a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
    from avalanche.core.fact_transactions a join avalanche.core.ez_dex_swaps b on a.tx_hash = b.tx_hash
    where a.block_timestamp::date >= '2023-08-03'
    and platform ilike '%trader-joe%'
    UNION
    select date(a.block_timestamp) as date, 'Arbitrum' as chain, 'WETH' as token,
    case when amount_in_usd is null then amount_out_usd
    when amount_out_usd is null then amount_in_usd
    when amount_in_usd>=amount_out_usd then amount_in_usd
    when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
    , a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
    from arbitrum.core.fact_transactions a join arbitrum.core.ez_dex_swaps b on a.tx_hash = b.tx_hash
    where a.block_timestamp::date >= '2023-08-03'
    and platform ilike '%trader-joe%'
    UNION
    select date(a.block_timestamp) as date, 'Ethereum' as chain, 'WETH' as token,
    case when amount_in_usd is null then amount_out_usd
    when amount_out_usd is null then amount_in_usd
    when amount_in_usd>=amount_out_usd then amount_in_usd
    when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
    , a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
    from ethereum.core.fact_transactions a join ethereum.core.ez_dex_swaps b on a.tx_hash = b.tx_hash
    where a.block_timestamp::date >= '2023-08-03'
    and platform ilike '%trader-joe%'
    UNION
    select date(a.block_timestamp) as date, 'BSC' as chain, 'WBNB' as token,
    case when amount_in_usd is null then amount_out_usd
    when amount_out_usd is null then amount_in_usd
    when amount_in_usd>=amount_out_usd then amount_in_usd
    when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
    , a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
    Run a query to Download Data