maybeyonasust_balance
Updated 2022-07-06
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
30
›
⌄
with ust_bals as(
select * from terra.daily_balances
where currency = 'UST'
),
daily_bals as(
select date, sum(balance) as total_ust
from ust_bals
group by date
),
mir_event as(
select date_from_parts(2020,12,1) as date, 3000000000 as mir_genesis
),
anchor_event as(
select date_from_parts(2021,3,17) as date, 3000000000 as anchor_genesis
),
elon_event as(
select date_from_parts(2021,05,18) as date, 3000000000 as elon_drop
)
select
d.date,
total_ust,
case when mir_genesis is null then 0 else mir_genesis-total_ust end as mir_genesis,
case when anchor_genesis is null then 0 else anchor_genesis-total_ust end as anchor_genesis,
case when elon_drop is null then 0 else elon_drop-total_ust end as elon_drop
from daily_bals d
left join mir_event m on m.date=d.date
left join anchor_event a on a.date=d.date
left join elon_event e on e.date=d.date
Run a query to Download Data