SalehBinance Bonanza-Outflow From Binance and Inflow To Binance
Updated 2023-01-04Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
›
⌄
-- SQL Credit: https://app.flipsidecrypto.com/velocity/queries/06e74550-01da-4899-96b8-5789c0014fe5
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
date_trunc('hour',block_timestamp) 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 n_transfers,
count (distinct sender) as n_wallets,
sum (amount/pow(10,decimal)) as osmo_amount,
sum (amount*USD_Price/pow(10,decimal)) as osmo_amount_usd
from osmosis.core.fact_transfers t1 join osmopricet t2 on t1.block_timestamp::date = t2.day
where tx_status = 'SUCCEEDED'
and block_timestamp::date>='2022-10-28'
and currency = 'uosmo'
and (receiver in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu')
or sender in ('osmo129uhlqcsvmehxgzcsdxksnsyz94dvea907e575','osmo1krmqr8zhvteevq4hnl7q0pxtff6xpnqz4ckxcu'))
group by date, type
Run a query to Download Data