elenahooDaily liquidate amount - Mar 15th - Aug 13th 2021
Updated 2022-01-09
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 unique_liq_tx as (
select
distinct(tx_id) as tx_id
, msg_value
from terra.msgs
where substring(msg_value:execute_msg::string, 3, 20) = 'liquidate_collateral'
and tx_status = 'SUCCEEDED'
),
liq_tx as (
select
date_trunc('day', block_timestamp) as date
, ltx.tx_id
, ltx.msg_value:execute_msg:liquidate_collateral:borrower as borrower
, m.msg_value:coins[0]:amount / POW(10, 6) as liquidated_amount
, substring(m.msg_value:coins[0]:denom, 2, 4) as denom
--, m.msg_value:execute_msg:borrow_stable:borrow_amount /POW(10,6) as borrowed_amount --
from terra.msgs m
inner join unique_liq_tx ltx
on ltx.tx_id = m.tx_id
where m.msg_value:execute_msg:submit_bid is not null
--and m.msg_value:execute_msg:borrow_stable IS NOT NULL
order by date asc, liquidated_amount desc
),
borrow as (
select
date_trunc('day', BLOCK_TIMESTAMP) as date
, sum(msg_value:execute_msg:borrow_stable:borrow_amount /POW(10,6)) as borrow_amount
from terra.msgs
where msg_value:execute_msg:borrow_stable is not null
and tx_status = 'SUCCEEDED'
group by 1
)
select tx.date
, tx.denom
, count(tx.tx_id) as tx_count
Run a query to Download Data