SocioAnalyticavolume of trade over time copy
    Updated 2024-07-18
    with data as (
    select
    'perp' as type,
    *
    from blast.blitz.ez_perp_trades
    -- union all
    -- select
    -- 'spot' as type,
    -- *
    -- from

    )

    select
    date_trunc('d', block_timestamp) as date,
    sum(amount_usd) as volume,
    sum(volume) over (order by date) as cum_volume,
    count(DISTINCT tx_hash) as n_txns,
    sum(n_txns) over ( order by date) as cum_txns,
    count(DISTINCT trader) as n_users ,
    avg(volume) over (order by date) as daily_avg_volume,
    avg(volume) over (order by date ROWS between 6 preceding and current row) as ma_7
    from data
    where is_taker = 'TRUE'
    group by 1
    order by 1 desc




    QueryRunArchived: QueryRun has been archived