amelia-leeCopy of volume copy
    Updated 2023-05-18
    select
    date_trunc('month', BLOCK_TIMESTAMP) as date,TOKEN,
    avg (CLOSE) as Price,
    count (distinct TX_ID) as TXN,
    count (distinct TRADER) as Users,
    sum ( DISTINCT TOKEN_IN_AMOUNT) as volume,
    volume * Price as USD,

    sum (TXN) over (partition by token order by Date) as cum_TXN,
    sum (Users) over (partition by token order by Date) as cum_Users,
    sum (USD) over (partition by token order by Date) as cum_USD
    FROM flow.core.ez_swaps
    JOIN flow.core.fact_hourly_prices ON ID = TOKEN_IN_CONTRACT and RECORDED_HOUR::DATE = BLOCK_TIMESTAMP::DATE
    WHERE TOKEN IS NOT NULL and TOKEN_IN_AMOUNT > 0 and CLOSE > 0
    group by 1,2


    Run a query to Download Data