shreyash-5873Anchor Collateral Deposits
Updated 2021-08-03
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 collateral_deposits as (
select
date(block_timestamp) as block_date,
sum(m.msg_value:execute_msg:send:amount) / pow(10, 6) as bluna_collateral_deposited
from terra.msgs m
where m.msg_value:execute_msg:send:msg:deposit_collateral is not null
and date(block_timestamp) >= date('2021-07-18')
and date(block_timestamp) <= date('2021-07-31')
group by 1
),
collateral_withdrawn as (
select
date(block_timestamp) as block_date,
sum(m.msg_value:execute_msg:unlock_collateral:collaterals[0][1]) / pow(10, 6) as bluna_collateral_withdrawn
from terra.msgs m
where m.msg_value:execute_msg:unlock_collateral is not null
and date(block_timestamp) >= date('2021-07-18')
and date(block_timestamp) <= date('2021-07-31')
group by 1
),
luna_prices as (
select
date(block_timestamp) as block_date,
symbol,
avg(price_usd) as avg_price_usd
from terra.oracle_prices
where symbol = 'LUNA'
and block_date <= date('2021-07-31')
and block_date >= date('2021-07-18')
group by 1, 2
)
select
d.block_date,
bluna_collateral_deposited,
bluna_collateral_withdrawn,
(bluna_collateral_deposited - bluna_collateral_withdrawn) as net_bluna_collateralised,
Run a query to Download Data