Afonso_Diaz2023-04-13 04:48 PM
    Updated 2023-04-13
    with
    t as (
    select
    recorded_hour::date as date,
    currency,
    symbol,
    avg(price) as price_usd
    from osmosis.core.ez_prices
    group by 1, 2, 3
    )

    select
    symbol,
    count(distinct tx_id) as transactions,
    sum((amount / pow(10, decimal)) * price_usd) as volume_usd,
    avg((amount / pow(10, decimal)) * price_usd) as average_volume_usd,
    median((amount / pow(10, decimal)) * price_usd) as median_volume_usd,
    count(distinct sender) as users
    from osmosis.core.fact_transfers a
    join t on t.date = block_timestamp::date and t.currency = a.currency
    where tx_succeeded = 1
    and amount > 0
    and block_timestamp > current_date - {{ days }}
    and transfer_type = 'IBC_TRANSFER_OUT'
    group by 1
    order by volume_usd desc
    limit 10
    Run a query to Download Data