mamad-5XN3k3Untitled Query
    Updated 2022-10-26
    with flowpricet as (
    select TIMESTAMP::date as date, avg(price_usd) as flowprice
    from flow.core.fact_prices
    where symbol ='FLOW' and source ='coinmarketcap'
    group by 1)

    select
    distinct CONTRACT_NAME,
    count (distinct tx_id) as Sales_Count,
    sum (case when currency ='A.1654653399040a61.FlowToken' then price*flowprice else price end) as Total_Sale_Volume
    from flow.core.ez_nft_sales t1 join flowpricet t2 on t1.block_timestamp::date = t2.date
    join flow.core.dim_contract_labels t3 on t1.NFT_COLLECTION=t3.EVENT_CONTRACT
    where tx_succeeded = 'TRUE'
    and buyer is not null
    and block_timestamp::date >= current_date - 90
    group by 1
    order by 2 desc
    limit 10
    Run a query to Download Data