binhachonImpacts of UST on STBL - #3
    Updated 2022-05-19
    with swap_transactions as (
    select
    block_timestamp,
    0 as selling_volume,
    swap_to_amount as buying_volume
    from flipside_prod_db.algorand.swaps
    where swap_to_asset_id = 465865291
    and block_timestamp::date >= '2022-05-08'
    and block_timestamp::date <= '2022-05-14'
    union all
    select
    block_timestamp,
    swap_from_amount as selling_volume,
    0 as buying_volume
    from flipside_prod_db.algorand.swaps
    where swap_from_asset_id = 465865291
    and block_timestamp::date >= '2022-05-08'
    and block_timestamp::date <= '2022-05-14'
    )
    select
    date_trunc('day', block_timestamp) as time,
    sum(buying_volume) as daily_buying_volume,
    sum(selling_volume) as daily_selling_volume,
    daily_buying_volume - daily_selling_volume as daily_net_buying_volume
    from swap_transactions
    group by 1

    Run a query to Download Data