Sbhn_NPDaily OSMO Transfers To/From/in Binance (TX Count)
    Updated 2023-01-04
    --credit : alik110
    with osmopricet as (
    select recorded_at::date as day,
    avg (price) as USD_Price
    from osmosis.core.dim_prices
    where symbol = 'OSMO'
    group by 1)

    select block_timestamp::Date as date,
    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 'Inner Binance Flow' end as type,
    count (distinct tx_id) as tx_count,
    count (distinct sender) as Senders_Count,
    sum (amount/pow(10,decimal)) as OSMO_Volume,
    sum (amount*USD_Price/pow(10,decimal)) as USD_Volume
    from osmosis.core.fact_transfers t1 join osmopricet t2 on t1.block_timestamp::date = t2.day
    where tx_status = 'SUCCEEDED'
    and currency = 'uosmo'
    and (receiver in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu')
    or sender in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu'))
    group by 1,2
    Run a query to Download Data