RamaharSwaps Size
    Updated 2022-11-28
    With token_price as (select
    DATE(recorded_at) as dt,
    symbol,
    AVG(price) as avg_price
    from osmosis.core.dim_prices
    group by 1, 2),

    swaps as (select
    DATE(block_timestamp) as dayz,
    project_name,
    from_amount,
    from_amount / pow(10, from_decimal) as adjusted_amount,
    adjusted_amount * avg_price as usd_value
    from osmosis.core.fact_swaps
    join osmosis.core.dim_labels ON from_currency = address
    join token_price ON symbol = project_name AND dt = block_timestamp::date )

    select
    dayz,
    project_name,
    sum(usd_value) as usd_amount,
    sum(usd_amount) over (partition by project_name) as usd_total,
    sum(usd_amount) over (partition by project_name order by dayz asc rows between unbounded preceding and current row) as cumulative_usd
    from swaps
    where project_name != 'IOV'
    group by 1, 2


    Run a query to Download Data