adriaparcerisasmonthly flow sales vs others
    Updated 2023-11-13

    with
    flow_price as (
    SELECT
    trunc(timestamp,'hour') as date,
    token_contract,
    avg(price_usd) as flow_price
    from flow.price.fact_prices
    group by 1,2
    ),
    flow_data as (
    select
    block_timestamp,
    tx_id,
    buyer,
    price*flow_price as price
    from flow.nft.ez_nft_sales x
    full outer join flow_price y on trunc(x.block_timestamp,'hour')=y.date and currency=token_contract
    ),
    flow as (
    select
    trunc(block_timestamp,'{{granularity}}') as date,
    count(distinct tx_id) as transactions,
    count(distinct buyer) as nft_users,
    sum(price) as volume_in_sales
    from flow_data where date >= CURRENT_DATE - INTERVAL '{{period}}'
    group by 1
    ),
    eth as (
    select
    trunc(block_timestamp,'{{granularity}}') as date,
    count(distinct tx_hash) as transactions,
    count(distinct buyer_address) as nft_users,
    sum(price_usd) as volume_in_sales
    from ethereum.nft.ez_nft_sales where price_usd <10000000 and price_usd is not null AND date >= CURRENT_DATE - INTERVAL '{{period}}'
    group by 1
    Run a query to Download Data