MasiTotal Transactions
    Updated 2024-10-17
    with tb1 as ( select trunc(block_timestamp,'day') as day,
    tx_hash,
    origin_from_address as swapper,
    case when amount_in_usd is null then amount_out_usd else amount_in_usd end as amount_usd,
    concat(symbol_in,'/',symbol_out) as pair
    from avalanche.defi.ez_dex_swaps
    where (AMOUNT_IN_USD between AMOUNT_OUT_USD - 5000 and AMOUNT_OUT_USD + 5000) -- Credited to Abbas from old Dashboards
    and block_timestamp::date >= '2023-01-01')

    select
    case when day >= '2023-01-01' and day < '2023-04-01' then 'Q1-2023'
    when day >= '2023-04-01' and day < '2023-07-01' then 'Q2-2023'
    when day >= '2023-07-01' and day < '2023-10-01' then 'Q3-2023'
    when day >= '2023-10-01' and day < '2024-01-01' then 'Q4-2023'
    when day >= '2024-01-01' and day < '2024-04-01' then 'Q1-2024'
    when day >= '2024-04-01' and day < '2024-07-01' then 'Q2-2024'
    when day >= '2024-07-01' and day < '2024-10-01' then 'Q3-2024'
    when day >= '2024-10-01' and day < '2025-01-01' then 'Q4-2024' end as breakdown,
    count(DISTINCT swapper) as swappers,
    count(DISTINCT tx_hash) as transactions,
    sum(amount_usd) as volume,
    count(DISTINCT pair) as pairs
    from tb1
    group by 1
    order by 3 desc



    QueryRunArchived: QueryRun has been archived