Pmisha-bmlMdxaverage swap size
    Updated 2022-06-09
    with t1 as (select
    date(BLOCK_TIMESTAMP) as dt1,
    count(TX_GROUP_ID) as no_swaps,
    sum(SWAP_FROM_AMOUNT) as vol,
    vol/no_swaps as average_swap,
    count(distinct SWAPPER) as unique_swappers
    from flipside_prod_db.algorand.swaps
    where BLOCK_TIMESTAMP>='2022-05-01' and SWAP_FROM_ASSET_ID=0
    group by 1),

    price as(select
    date_trunc('day',BLOCK_HOUR) as dt2,
    avg(PRICE_USD) as Price
    from flipside_prod_db.algorand.prices_swap where ASSET_NAME='ALGO'
    and date_trunc('day',BLOCK_HOUR)>='2022-04-01'
    and MAX_PRICE_USD_HOUR is not null
    group by dt2
    )
    select
    t1.dt1 as dt,
    average_swap,
    Price
    from t1
    join price on t1.dt1=price.dt2
    Run a query to Download Data