bachiTinyman liquidity
    Updated 2022-03-27
    with pool_ids as (
    select
    y.asset_id,
    y.asset_parameters:an::string as pool_name
    from algorand.application_call_transaction x
    inner join algorand.asset_configuration_transaction y on x.tx_group_id=y.tx_group_id
    where app_id=552635992 and x.block_id > 18718200
    ),
    pool_addresses as (
    SELECT
    x.asset_id,
    x.asset_name,
    x.address
    from algorand.account_asset x
    inner join pool_ids y on x.asset_id=y.asset_id and x.asset_name=y.pool_name
    ),
    addings as (
    select
    x.asset_id,
    y.asset_name,
    --count(distinct x.sender) as wallets,
    sum(asset_amount/1e6) as volume_in
    from algorand.asset_transfer_transaction x
    inner join pool_addresses y on x.asset_receiver = y.address and x.asset_id = y.asset_id
    where asset_amount is not null and tx_message:sig is null
    --where asset_receiver='pool_address'
    group by 1,2
    --order by 3 desc,
    ),
    removings as (
    select
    x.asset_id,
    y.asset_name,
    --count(distinct x.asset_receiver) as wallets,
    sum(asset_amount/1e6) as volume_out
    from algorand.asset_transfer_transaction x
    Run a query to Download Data