maybeyonasalgo_rand_nft_dist_algo
    Updated 2022-05-25
    with
    nft_sales as (
    select
    tx_group_id
    from algorand.payment_transaction
    where receiver='RANDGVRRYGVKI3WSDG6OGTZQ7MHDLIN5RYKJBABL46K5RQVHUFV3NY5DUE'
    ),
    nft_txs as (
    select
    block_timestamp,
    tx_group_id,
    sender,
    sum(amount)-0.001 as algos,
    min(case when amount=0.001 then null else amount end) as nft_fee,
    max(amount) as price
    from algorand.payment_transaction
    where tx_group_id in (select tx_group_id from nft_sales)
    -- and tx_group_id = 'xQS0TjHkcxneNqeMY3Q9iYEOzeTRl2VAqLV3VRCaYJk='
    -- and tx_group_id = 'm5Xmjvw60T+/9+xo15Oi5GjffoRHNRtBkSYDDZBeLgc='
    group by 1,2,3
    ),
    user_data as (
    select
    sender,
    min(block_timestamp) as first_date,
    count(tx_group_id) as buys,
    sum(algos) as algo_paid,
    sum(nft_fee) as fees_paid,
    sum(price) as total_nft_value
    from nft_txs
    group by 1
    )

    select
    round(algo_paid,-1) as algo_bucket,
    count(sender) as users
    Run a query to Download Data