rezaramshinidaily data for NBA
    Updated 2022-07-03
    WITH
    help as (
    with flow_price as (SELECT TIMESTAMP::date date, avg(PRICE_USD) as daily_price from flow.core.fact_prices where TOKEN = 'Flow' GROUP by 1)

    SELECT BLOCK_TIMESTAMP::date as date, CURRENCY, count(DISTINCT tx_id) as daily_txs,
    case when CURRENCY = 'A.1654653399040a61.FlowToken' THEN sum(PRICE*daily_price) else sum(PRICE) end as daily_sales
    from flow.core.fact_nft_sales join flow_price on flow_price.date = flow.core.fact_nft_sales.BLOCK_TIMESTAMP::date
    where NFT_COLLECTION ilike '%topshot%' GROUP by 1,2

    )

    select date, daily_sales, daily_txs from help
    Run a query to Download Data