davidwallUntitled Query
    Updated 2023-01-03
    --credit : https://app.flipsidecrypto.com/velocity/queries/cd996c3b-c3c8-4d07-9348-5331a7d44864
    with mintable as (
    select tx_from,
    min (block_timestamp) as mindate
    from osmosis.core.fact_transactions
    group by 1),

    pricet as (
    select recorded_at::date as day,
    address,
    symbol,
    avg (price) as USDPrice
    from osmosis.core.dim_prices t1 join osmosis.core.dim_labels t2 on t1.symbol = t2.project_name
    group by 1,2,3)

    select project_name,
    sum (to_amount*usdprice/pow(10,to_decimal)) as Volume
    from osmosis.core.fact_swaps t1 join mintable t2 on t1.trader = t2.tx_from and t1.block_timestamp = t2.mindate
    join osmosis.core.dim_tokens on to_currency = address
    join pricet t3 on t1.to_currency = t3.address and t1.block_timestamp::date = t3.day
    where project_name not in ('IOV')
    group by 1
    order by 2 DESC
    limit 20
    Run a query to Download Data