strawbettyCumulative amount of inflow and outflow
Updated 2022-04-24
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
27
28
29
›
⌄
with OUTFLOW as
(SELECT date_trunc('day',block_timestamp) as day,
sum(event_attributes:amount[0]:amount::float/1e6) as outflow_amount,
sum(outflow_amount) over(order by day asc) as cumulative_outflow,
count(distinct event_attributes:sender::string) as outflow_bridgers,
count(distinct tx_id) as outflow_transactions
from terra.msg_events where block_timestamp>='2022-02-01'
and tx_status='SUCCEEDED' and event_type='transfer'
and event_attributes:amount[0]:denom::string='uusd'
and event_attributes:recipient::string='terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf'
group by 1),
INFLOW as
(SELECT date_trunc ('day',block_timestamp) as day,
sum(event_attributes:amount[0]:amount::float/1e6) as inflow_amount,
sum(inflow_amount) over(order by day asc) as cumulative_inflow,
count(distinct event_attributes:recipient::string) as inflow_bridgers,
count(distinct tx_id) as inflow_transactions
from terra.msg_events where block_timestamp>='2022-02-01'
and tx_status='SUCCEEDED' and event_type='transfer'
and event_attributes:amount[0]:denom::string='uusd'
and event_attributes:sender::string='terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf'
group by 1)
SELECT OUTFLOW.day, outflow_amount,inflow_amount, cumulative_outflow,cumulative_inflow,
outflow_bridgers,inflow_bridgers,outflow_transactions,inflow_transactions
from OUTFLOW
join INFLOW on OUTFLOW.day= INFLOW.day
order by 1 desc
Run a query to Download Data