theericstonecollateral value
Updated 2022-07-07
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
31
32
33
34
35
36
›
⌄
with add_eth as (select date_trunc('day',block_timestamp) as block_date,
sum(amount) as added_usd
from anchor.collateral
where event_type = 'provide'
and currency = 'terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun'
group by 1),
remove_eth as (select date_trunc('day',block_timestamp) as block_date,
sum(amount) as removed_usd
from anchor.collateral
where event_type = 'withdraw'
and currency = 'terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun'
group by 1),
add_luna as (select date_trunc('day',block_timestamp) as block_date,
sum(amount) as added_usd
from anchor.collateral
where event_type = 'provide'
and currency in ('terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp') --, 'terra17wgmccdu57lx09yzhnnev39srqj7msg9ky2j76')
group by 1),
remove_luna as (select date_trunc('day',block_timestamp) as block_date,
sum(amount) as removed_usd
from anchor.collateral
where event_type = 'withdraw'
and currency in ('terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp') --, 'terra17wgmccdu57lx09yzhnnev39srqj7msg9ky2j76')
group by 1),
bluna as (select a.block_date,
sum(added_usd) over (order by a.block_date) as added_luna,
sum(removed_usd) over (order by a.block_date) as withdrawn_luna,
sum(added_usd-removed_usd) over (order by a.block_date) as net_collateral_luna
from add_luna a
inner join remove_luna r
on a.block_date = r.block_date),
Run a query to Download Data