kimmayyer-5963nbaplay-10
    Updated 2022-07-25
    with flow_price as (
    select
    timestamp::date as days,
    avg(price_usd) as flow_price_usd
    from flow.core.fact_prices
    where token_contract = 'A.1654653399040a61.FlowToken'
    and timestamp::date >= '2022-04-01'
    group by days
    ),
    top_shot_sales_dapper_coin as (
    select
    block_timestamp,
    nft_id,
    price,
    buyer
    from flow.core.fact_nft_sales
    where nft_collection = 'A.0b2a3299cc857e29.TopShot'
    and currency = 'A.ead892083b3e2c6c.DapperUtilityCoin'
    and tx_succeeded = 'true'
    ),
    top_shot_sales_flow_coin as (
    select
    s.block_timestamp as block_timestamp,
    s.nft_id as nft_id,
    s.price * p.flow_price_usd as price,
    s.buyer
    from flow.core.fact_nft_sales s
    left join flow_price p on s.block_timestamp::date = p.days
    where nft_collection = 'A.0b2a3299cc857e29.TopShot'
    and currency = 'A.1654653399040a61.FlowToken'
    and tx_succeeded = 'true'
    ),
    final_result as (
    select * from top_shot_sales_dapper_coin
    union
    select * from top_shot_sales_flow_coin
    Run a query to Download Data