Eman-RazStablecoins Swaps Over Time
    Updated 2024-10-22
    select date_trunc('{{Time_Frame}}',block_timestamp) as "Date", count(distinct tx_hash) as "Swap Count",
    count(distinct tx_hash)/count(distinct trader) AS "Swap per Trader",
    sum("Swap Count") over (order by "Date" asc) as "Total Swap Count",
    avg(coalesce(amount_in_usd,amount_out_usd)) as "Avg",
    median(coalesce(amount_in_usd,amount_out_usd)) as "Median",
    max(coalesce(amount_in_usd,amount_out_usd)) as "Max",
    count(distinct trader) as "Trader Count", sum(coalesce(amount_in_usd,amount_out_usd)) as "Swap Volume",
    sum("Swap Volume") over (order by "Date" asc) as "Total Swap Volume",
    FROM near.defi.ez_dex_swaps
    WHERE (symbol_in in ('DAI', 'FRAX', 'FUSD', 'USDC', 'USDC.e', 'USDT.e', 'USDt', 'USN', 'cUSD', 'sFRAX')
    or symbol_out in ('DAI', 'FRAX', 'FUSD', 'USDC', 'USDC.e', 'USDT.e', 'USDt', 'USN', 'cUSD', 'sFRAX'))
    and block_timestamp::date between '{{Start_Date}}' and '{{End_Date}}'
    group by 1
    order by 1
    QueryRunArchived: QueryRun has been archived