sinahosseinzadehUntitled Query
    Updated 2022-08-03
    with nft as
    (
    SELECT
    address,
    project_name
    from optimism.core.dim_labels
    WHERE label_type='nft'
    ),
    ep AS
    (
    SELECT
    date_trunc('d',hour) as dt1,
    --hour,
    --price
    avg(price) as eth_price
    from optimism.core.fact_hourly_token_prices
    where symbol='WETH'
    GROUP BY dt1
    ),
    fe as
    (
    SELECT
    date_trunc('d',block_timestamp) as dt2,
    count(buyer_address) as buyers,
    --sum(buyers) OVER (ORDER BY dt ASC) as cumulative_buyers,
    nft_address,
    project_name,
    -- tokenid,
    --currency_symbol,
    --eth_price,
    sum(price) as daily_volume_eth,
    -- daily_volume_eth*eth_price as usd_price,
    sum(daily_volume_eth) OVER (partition by nft_address ORDER BY dt2 ASC) as cumulative_volume_eth
    -- cumulative_volume_eth*eth_price
    FROM optimism.core.ez_nft_sales ns
    LEFT JOIN nft on ns.nft_address=nft.address
    Run a query to Download Data