kiacryptodaily x_count, user, and volume on sushiswap
    Updated 2023-03-14
    select
    date_trunc('day', block_timestamp) as date,
    count(distinct tx_hash) as tx_count,
    count(distinct origin_from_address) as unique_swapper,
    (sum(amount_in_usd) + sum(amount_out_usd)) / 2 as swap_volume,
    -- sum(tx_fee) as daily_fee,
    -- avg(tx_fee) as avg_fee,

    sum(tx_count) over (order by date) as cum_tx_count,
    sum(swap_volume) over (order by date) as cum_swap_volume,
    -- sum(daily_fee) over (order by date) as cum_daily_fee,

    avg(tx_count) over (order by date, date rows between 6 preceding and current row) as ma7_tx_count,
    avg(unique_swapper) over (order by date, date rows between 6 preceding and current row) as ma7_unique_swapper,
    avg(swap_volume) over (order by date, date rows between 6 preceding and current row) as ma7_swap_volume--,
    -- avg(daily_fee) over (order by date, date rows between 6 preceding and current row) as ma7_daily_fee,
    -- avg(avg_fee) over (order by date, date rows between 6 preceding and current row) as ma7_avg_fee
    from optimism.sushi.ez_swaps
    where date >= current_date - {{interval}} and platform = 'sushiswap'
    group by 1
    Run a query to Download Data