Updated 2023-05-03
    with t1 as

    (
    select avg(PRICE) as aprice,
    date_trunc(day,HOUR) as datee
    from
    crosschain.core.ez_hourly_prices
    where datee>current_date-40 and
    SYMBOL='WETH'
    group by 2
    )

    ,
    t2 as
    (select
    date_trunc('day',BLOCK_TIMESTAMP) as date, NFT_ADDRESS ,PRICE
    from
    ethereum.core.ez_nft_sales
    where
    BLOCK_TIMESTAMP>current_date-40 and (CURRENCY_SYMBOL='ETH' or CURRENCY_ADDRESS='ETH')
    )

    ,
    t3 as

    (select
    sum(price*aPRICE) as volume ,
    NFT_ADDRESS
    from
    t1 a inner join t2 b
    on a.datee=b.date
    group by 2
    order by 1 desc
    limit 5)
    ,
    t3 as
    Run a query to Download Data