MufasaBuyers by their total spend on NFTs (in ETH)
    Updated 2022-10-18
    with price_of_optimism as (
    select hour::date as date,
    avg (price) as average_op_price
    from optimism.core.fact_hourly_token_prices
    where symbol = 'OP'
    group by date
    ),
    price_of_eth as (
    select hour::date as date,
    avg (price) as average_eth_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by date
    ),

    eth_op_price as (
    select op.date,
    average_op_price/average_eth_price as average_price
    from price_of_optimism op join price_of_eth eth on op.date = eth.date
    order by op.date
    ),

    overall_data as (
    select block_timestamp,
    tx_hash,
    seller_address,
    buyer_address,
    price_usd,
    case when currency_symbol = 'ETH' then price when currency_symbol = 'OP' then price*average_price end as price_of_ethereum
    from optimism.core.ez_nft_sales sales join eth_op_price price on sales.block_timestamp::date = price.date)
    -- data as (
    -- select buyer_address,
    -- sum (price_of_ethereum) as total_amount_of_eth,
    -- sum (price_usd) as total_amount_of_usd
    -- from overall_data
    -- group by buyer_address
    Run a query to Download Data