0xBlackfishMagic Eden Sales and Sales Volume
    Updated 2023-11-04
    with
    -- Prices from EZ Token Prices
    hourly_prices_ez as (
    select
    date_trunc('hour', recorded_hour) as hour
    , avg(close) as hourly_price
    from solana.price.ez_token_prices_hourly p
    where
    date(recorded_hour) between date('2022-11-01') and date('2023-10-31')
    and is_imputed = FALSE
    and p.token_address = 'So11111111111111111111111111111111111111112'
    group by 1
    ),

    daily_prices_ez as (
    select
    date_trunc('day', recorded_hour) as day
    , avg(close) as daily_price
    from solana.price.ez_token_prices_hourly p
    where
    date(recorded_hour) between date('2022-11-01') and date('2023-10-31')
    and is_imputed = FALSE
    and p.token_address = 'So11111111111111111111111111111111111111112'
    group by 1
    ),

    buyers as (
    select
    n.purchaser as buyer
    , count(distinct n.tx_id) as nfts_purchased
    , sum(n.sales_amount * coalesce(hp.hourly_price,dp.daily_price)) as nft_purchase_volume
    from solana.nft.fact_nft_sales n
    left join hourly_prices_ez hp on hp.hour = date_trunc('hour',n.block_timestamp)
    left join daily_prices_ez dp on dp.day = date_trunc('day',n.block_timestamp)
    where
    lower(n.marketplace) like '%magic eden%'
    Run a query to Download Data