goanji6455total amount of bought (ETH)
    Updated 2023-01-03
    with

    sell as (
    SELECT BLOCK_TIMESTAMP::date as date,
    SWAP_PROGRAM,
    sum(SWAP_FROM_AMOUNT) as sold_amount,
    count(DISTINCT SWAPPER) as sold_SWAPPERS
    from flipside_prod_db.algorand.swaps
    where BLOCK_TIMESTAMP::date >= '2022-04-01'
    and SWAP_FROM_ASSET_ID in (386195940)
    GROUP by 1,2
    )
    , buy as (
    SELECT BLOCK_TIMESTAMP::date as date,
    SWAP_PROGRAM,
    sum(SWAP_to_AMOUNT) as bought_amount,
    count(DISTINCT SWAPPER) as bought_SWAPPERS
    from flipside_prod_db.algorand.swaps
    where BLOCK_TIMESTAMP::date >= '2022-04-01'
    and SWAP_to_ASSET_ID in (386195940)
    GROUP by 1,2
    )

    SELECT sell.date, sell.SWAP_PROGRAM, sold_amount, sold_SWAPPERS, bought_amount, bought_SWAPPERS,
    sold_amount-bought_amount as net_sold
    from sell
    join buy on (sell.SWAP_PROGRAM = buy.SWAP_PROGRAM and sell.date = buy.date)
    Run a query to Download Data