MasiShare of Buyers based on Number of Purchased Collections
    Updated 2024-10-31
    -- forked from Share of Buyers Based on Number of Purchased NFTs @ https://flipsidecrypto.xyz/studio/queries/c79cd643-d8e1-42d5-94a0-701a72143e20

    with tb0 as ( select DISTINCT tx_hash,
    platform_name as market,
    block_timestamp::date as date,
    token_id,
    buyer_address as buyer,
    nft_address as collection,
    price as nft_price
    from near.nft.ez_nft_sales
    where date >= current_date - 30
    )
    ,
    tb3_1 as (select DISTINCT tx_hash,
    from near.core.fact_actions_events_function_call
    where method_name = 'ft_on_transfer'
    and receiver_id = 'uwon.hot.tg'
    and block_timestamp::date >= '2024-05-01'
    )
    ,
    tb3_2 as ( select block_timestamp,
    a.tx_hash,
    'uwon' as market,
    contract_address as collection,
    from_address as seller,
    to_address as buyer,
    token_id
    from near.nft.fact_nft_transfers a join tb3_1 b on a.tx_hash = b.tx_hash
    where block_timestamp::date >= '2024-05-01'
    and to_address != 'uwon.hot.tg'
    and from_address != 'uwon.hot.tg')
    ,
    tb3_3 as ( select hour,
    symbol,
    avg(price) as price
    from crosschain.price.ez_prices_hourly
    QueryRunArchived: QueryRun has been archived