vendettaUntitled Query
    Updated 2022-11-29
    with price as (
    select recorded_at::date as day,
    address,
    symbol,
    median (price) as USD_Price
    from
    osmosis.core.dim_prices t1
    join osmosis.core.dim_labels t2 on t1.symbol = t2.project_name
    where symbol != 'OSMO'
    group by 1,2,3
    ),
    Single_asset as (
    select
    tx_id,
    count (tx_id) as TXS_Count
    from
    osmosis.core.fact_liquidity_provider_actions
    where
    action = 'pool_joined'
    and tx_status = 'SUCCEEDED'
    group by 1
    having TXS_Count < 2
    )
    select 'Single asset' as join_type,
    SYMBOL,
    count (distinct tx_id) as TX_Count,
    count (distinct liquidity_provider_address) as Users_Count,
    sum (case when currency = 'ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273' then amount*usd_price/pow(10,18) else amount*usd_price/pow(10,decimal)end) as Total_USD_Volume
    from
    osmosis.core.fact_liquidity_provider_actions t1
    join price t2 on t1.block_timestamp::date = t2.day and t1.currency = t2.address
    where
    tx_status = 'SUCCEEDED'
    and tx_id in (select tx_id from Single_asset)
    group by 1,2
    Run a query to Download Data