par_rndust buy volume
    Updated 2022-12-02
    WITH T1 as (
    SELECT
    date_trunc('day', block_timestamp) as date,
    count(tx_id) as number_of_swaps,
    sum(case when swap_to_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ' then swap_to_amount end) as buy_volume,
    -1*sum(case when swap_from_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ' then swap_from_amount end) as sell_volume
    FROM solana.core.fact_swaps
    WHERE succeeded = 'TRUE'
    and (swap_to_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ' or swap_from_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ')
    GROUP BY 1
    )

    SELECT
    buy_volume + sell_volume as Total,
    sum(total) over (order by date) as cumu_diff,*
    FROM T1
    Run a query to Download Data