Afonso_Diaz2023-11-04 09:28 PM
    Updated 2023-11-04
    with

    t1 as (
    select
    recorded_hour::date as date,
    avg(price) as price_usd
    from osmosis.price.ez_prices
    where symbol ilike any ('OSMO', 'STARS', 'Juno', 'LUNA', 'EVMOS', 'INJ','UMEE', 'CMDX', 'SOMM')
    group by 1
    ),

    t2 as (
    select
    tx_id,
    block_timestamp,
    nvl(try_parse_json(attribute_value):amount::float, 0)/1e6 as amount,
    replace(try_parse_json(attribute_value):denom::string, 'transfer/channel-326/', '') as symbol
    from osmosis.core.fact_msg_attributes
    left join t1 on t1.date = block_timestamp::date and symbol ilike replace(try_parse_json(attribute_value):denom::string, 'transfer/channel-326/u', '')
    where 1 = 1
    and try_parse_json(attribute_value):receiver::string ilike 'stride%'
    and try_parse_json(attribute_value):denom::string ilike 'transfer/channel-326/%'
    )

    select count(distinct tx_id) from t2
    Run a query to Download Data