MLDZMNyts6
    Updated 2022-12-09
    with tb1 as (
    select
    distinct tx_id
    from solana.core.fact_transactions
    where inner_instructions[1]:instructions[3]:accounts[12] ilike 'yootn8Kf22CQczC732psp7qEqxwPGSDQCFZHkzoXp25'
    and block_timestamp >= '2022-11-01'
    and succeeded = 'TRUE'),

    tb2 as (select
    mint
    from solana.core.fact_nft_mints x join tb1 y on x.tx_id = y.tx_id),

    tb3 as (select
    recorded_hour::date as day,
    avg (close) as price_token
    from solana.core.fact_token_prices_hourly
    where symbol = 'SOL'
    group by 1)

    select
    count(distinct TX_ID) as sale_no,
    count(distinct PURCHASER) as buyer_no,
    count(distinct MARKETPLACE) as no_marketplaces,
    sum(SALES_AMOUNT) as volume,
    sum(SALES_AMOUNT*price_token) as volume_usd,
    avg(SALES_AMOUNT) as average_volume_SOL,
    avg(SALES_AMOUNT*price_token) as average_volume,
    buyer_no/count(distinct date_trunc(day, block_timestamp)) as average_buyer_day,
    volume_USD/count(distinct date_trunc(day, block_timestamp)) as average_volume_day,
    volume_USD/count(distinct BLOCK_ID) as average_volume_block,
    min(SALES_AMOUNT*price_token) as floor_price,
    max(SALES_AMOUNT*price_token) as highest_price,
    median(SALES_AMOUNT*price_token) as median_price
    from solana.core.fact_nft_sales x join tb3 y on x.BLOCK_TIMESTAMP::date=y.day
    where SUCCEEDED='TRUE'
    and mint in (select mint from tb2)
    Run a query to Download Data