0xHaM-dRef-finance in Total
    Updated 2024-10-22
    -- forked from ThalaSwap in Total @ https://flipsidecrypto.xyz/studio/queries/e66fbb1e-e278-4871-80a8-6152b78c0616

    with swapEvent as (
    select
    block_timestamp,
    TX_HASH,
    TRADER,
    SYMBOL_IN,
    SYMBOL_OUT,
    coalesce(AMOUNT_OUT_USD, AMOUNT_IN_USD) as amount_usd
    from near.defi.ez_dex_swaps
    where PLATFORM ilike ('%ref-finance%')
    -- and block_timestamp::date >= '2024-01-01'
    )
    SELECT
    count(DISTINCT tx_hash) as n_swaps,
    count(DISTINCT TRADER) as unique_swapper,
    sum (amount_usd) as volume,
    volume/n_swaps as avg_vol_per_swap,
    volume/unique_swapper as avg_vol_per_swappper,
    FROM swapEvent





    QueryRunArchived: QueryRun has been archived