MLDZMNbbon11
    Updated 2023-01-04
    with tb1 as (select
    date_trunc('day',recorded_at) as day,
    avg (price) as usd_price
    from osmosis.core.dim_prices
    where symbol='OSMO'
    and recorded_at::date>='2022-03-01'
    group by 1
    )

    select
    block_timestamp::Date as day,
    case
    when sender in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu')
    and receiver not in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu') then 'Outflow From Binance'
    when receiver in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu')
    and sender not in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu') then 'Inflow To Binance'
    else null end as type,
    count (distinct tx_id) as no_liq,
    count (distinct sender) as no_sender,
    sum (amount/pow(10,decimal)) as volume,
    sum (amount*usd_price/pow(10,decimal)) as volume_usd
    from osmosis.core.fact_transfers s join tb1 b on s.block_timestamp::date = b.day
    where tx_status = 'SUCCEEDED'
    and currency = 'uosmo'
    and (receiver in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu')
    or sender in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu'))
    group by 1,2 having type is not null
    Run a query to Download Data