binhachonLet’s keep diving into the Algorand NFT ecosystem. - Marketplace stats
    Updated 2022-05-31
    with tx_group_id as (
    select
    distinct
    sender as sender_0,
    tx_group_id as tx_group_id_0,
    receiver as receiver_0
    from algorand.payment_transaction
    where receiver in ('RANDGVRRYGVKI3WSDG6OGTZQ7MHDLIN5RYKJBABL46K5RQVHUFV3NY5DUE', 'XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4')
    and amount > 0
    ),
    stats as (
    select
    block_timestamp,
    tx_group_id,
    case
    when receiver_0 = 'RANDGVRRYGVKI3WSDG6OGTZQ7MHDLIN5RYKJBABL46K5RQVHUFV3NY5DUE' then 'Rand Gallery'
    when receiver_0 = 'XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4' then 'ALGOxNFT'
    end as marketplace,
    sum(amount) as price
    from algorand.payment_transaction
    inner join tx_group_id on (tx_group_id = tx_group_id_0)
    group by 1, 2, 3
    ),
    ALGO_swaps as (
    select
    block_timestamp,
    swap_from_amount as algo_amount,
    swap_to_amount as usdc_amount
    from algorand.swaps
    where swap_from_asset_id = 0
    and swap_to_asset_id in (31566704, 312769)
    and swap_from_amount > 0
    and swap_to_amount > 0
    union all
    select
    block_timestamp,
    Run a query to Download Data