hessTotal Daily Volume per Blockchain
    Updated 2022-06-13
    with flow as ( select date(BLOCK_TIMESTAMP) as date , count(DISTINCT(BUYER)) as unique_buyer , sum(unique_buyer) over (order by date asc) as cum_user, sum(price) as volume
    from flow.core.fact_nft_sales
    where block_timestamp::date >= '2022-05-09'
    group by 1
    order by 1)
    ,
    ethereum as (select date(BLOCK_TIMESTAMP) as date , count(DISTINCT(BUYER_ADDRESS)) as unique_buyer , sum(unique_buyer) over (order by date asc) as cum_user
    , sum(PRICE_USD) as volume
    from ethereum.core.ez_nft_sales
    where block_timestamp::date >= '2022-05-09'
    group by 1
    order by 1)
    ,
    price as (select date(hour) as price_date , case when token_address = lower('0xD31a59c85aE9D8edEFeC411D448f90841571b89c') then 'SOL' end as token , avg(price) as price
    from flipside_prod_db.ethereum_core.fact_hourly_token_prices
    where token_address = lower('0xD31a59c85aE9D8edEFeC411D448f90841571b89c') and hour::date >= '2022-05-09'
    group by 1,2)
    ,
    solana as (select date(BLOCK_TIMESTAMP) as date , count(DISTINCT(PURCHASER)) as unique_buyer , sum(unique_buyer) over (order by date asc) as cum_user
    , sum(SALES_AMOUNT*price) as volume
    from solana.core.fact_nft_sales a join price b on a.BLOCK_TIMESTAMP::date = b.price_date
    where block_timestamp::date >= '2022-05-09'
    group by 1
    order by 1)

    select 'Flow' as blockchain , date , unique_buyer , cum_user, volume
    from flow
    UNION
    select 'Ethereum' as blockchain , date , unique_buyer , cum_user, volume
    from ethereum
    UNION
    select 'Solana' as blockchain , date , unique_buyer , cum_user, volume
    from solana
    Run a query to Download Data