hbd1994Untitled Query
    Updated 2022-09-17
    select
    buyer,
    count(*) as purchases_count,
    sum(usd_amount) as paid_volume,
    count(distinct nft_collection) as collections_count
    from
    (
    (with sale as (select
    date(BLOCK_TIMESTAMP) as dte,
    HOUR(block_timestamp) as time_hour,
    minute(block_timestamp) as time_minute,
    TX_ID,
    BUYER,
    NFT_COLLECTION,
    MARKETPLACE,
    PRICE
    from flow.core.ez_nft_sales
    where currency = 'A.1654653399040a61.FlowToken'),
    price as (select date(TIMESTAMP) as dte1, hour(TIMESTAMP) as hour1,minute(TIMESTAMP) as time_minute1, PRICE_USD as flow_price
    from flow.core.fact_prices
    where TOKEN_CONTRACT = 'A.1654653399040a61.FlowToken')
    select
    dte,
    TX_ID,
    BUYER,
    NFT_COLLECTION,
    MARKETPLACE,
    PRICE,
    (PRICE*flow_price) as usd_amount
    from sale
    inner join price on dte1=dte and time_hour=hour1 and time_minute=time_minute1)

    union all

    Run a query to Download Data