Sandeshsol_nft
    Updated 2022-11-29
    with sol_price as
    (
    select date_trunc({{granularity}},recorded_hour) as time,avg(close) as usd from solana.core.fact_token_prices_hourly
    where symbol='SOL'
    group by time
    ),
    sol_nft as
    (
    select
    'solana' as chain,
    date_trunc('{{granularity}}',block_timestamp) as time,
    nft.tx_id as tx_hash,
    nft.marketplace as marketplace,
    seller,
    purchaser as buyer,
    nft.mint,
    ad.address_name as project_name,
    '0' as token_id,
    'sol' as currency,
    nft.sales_amount*sol.usd as price
    from solana.core.fact_nft_sales nft
    inner join sol_price sol
    on date_trunc('{{granularity}}',block_timestamp) =sol.time
    left join solana.core.dim_labels ad
    on nft.mint=ad.address
    where time between '{{start_date}}' and '{{end_date}}'
    )
    select * from sol_nft
    where tx_hash='4HGGULRTpqwwHjTyKf2KvyVkoDjF8AkTKKmt5vKVEJ9rkJjAgasMeubKCgUNsTYg2egQ3TNcSJStvXdbH3DAA9ku'
    -- limit 5
    Run a query to Download Data