grahamgoBTC
    Updated 2022-05-16
    with swap_table as(
    select
    date_trunc('day',block_timestamp) as date,
    count(distinct swapper) as goBTC_swappers,
    sum(swap_to_amount) as swap_volume,
    sum(goBTC_swappers) over (order by date) as cum_swappers,
    sum(swap_volume) over (order by date) as cum_swap_volume
    from algorand.swaps
    where swap_to_asset_id = '386192725'
    group by 1),

    mint_table as(
    select
    date_trunc('day',block_timestamp) as date,
    count(distinct asset_receiver) as goBTC_minters,
    sum(asset_amount/1e8) as mint_volume,
    sum(goBTC_minters) over (order by date) as cum_minters,
    sum(mint_volume) over (order by date) as cum_mint_volume
    from algorand.asset_transfer_transaction
    where sender = 'ETGSQKACKC56JWGMDAEP5S2JVQWRKTQUVKCZTMPNUGZLDVCWPY63LSI3H4'
    and asset_id = '386192725'
    group by 1)
    select swap_table.date, goBTC_swappers, goBTC_minters, swap_volume, mint_volume, cum_swappers, cum_swap_volume, cum_minters, cum_mint_volume
    from swap_table
    left join mint_table on swap_table.date = mint_table.date
    order by 1
    Run a query to Download Data