HosseinUntitled Query
    Updated 2022-11-16
    with price_list as (
    select
    date_trunc('day', hour) as date,
    avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    where token_address = '0xd31a59c85ae9d8edefec411d448f90841571b89c'
    group by date
    )

    select
    contract_name,
    count(distinct (tx_id)) as sales_events,
    sum(sales_amount) as sales_amount_sol,
    sum(price * sales_amount) as sales_amount_usd,
    count(distinct (purchaser)) as purchasers_num
    from solana.core.fact_nft_sales a
    left join solana.core.dim_nft_metadata b
    left join price_list
    on date = block_timestamp::date
    and a.mint = b.mint
    where block_timestamp >= current_date - interval '1 months'
    group by contract_name
    order by sales_amount_usd desc
    Run a query to Download Data