NavidCopy of Untitled Query
    Updated 2022-12-12
    with prices as (
    select
    date(timestamp) as day,
    token_contract,
    symbol,
    avg(price_usd) as priceusd
    from
    flow.core.fact_prices
    group by
    1,2,3
    ), daily as (
    select
    date_trunc('day', block_timestamp) as dayy,
    sum(AMOUNT*priceusd) as "Volume (USD)",
    avg("Volume (USD)") over (order by dayy asc rows between 7 preceding and current row) as "Moving Average"
    from
    flow.core.ez_token_transfers a join prices b on b.day=date_trunc('day', block_timestamp) and a.token_contract=b.token_contract
    where
    TX_SUCCEEDED and block_timestamp >= '2022-01-01'
    group by 1
    )
    select
    avg("Volume (USD)") as aver,
    median("Volume (USD)") as medi,
    min("Volume (USD)") as mini,
    max("Volume (USD)") as maxi,
    sum("Volume (USD)") as tot
    from
    daily
    Run a query to Download Data