KaskoazulAnchor Collateral Event type 90 days
Updated 2022-02-02
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
›
⌄
--140. Anchor Collateralization
--How much of the collateral provided on Anchor is bLUNA vs. bETH? How has this changed over the past 90 days?
WITH
COLLATERAL_PROVIDE as (
select date_trunc('DAY', block_timestamp) as DATE, 'provide' as event_type, 'bETH mmCustody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'provide' AND contract_label = 'bETH mmCustody'
union select date_trunc('DAY', block_timestamp) as DATE,'provide' as event_type, 'bLuna Custody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'provide' AND contract_label = 'bLuna Custody' AND DATE > CURRENT_DATE - 90
),
COLLATERAL_WITHDRAW as(
select date_trunc('DAY', block_timestamp) as DATE, 'withdraw' as event_type, 'bETH mmCustody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'withdraw' AND contract_label = 'bETH mmCustody'
union select date_trunc('DAY', block_timestamp) as DATE, 'withdraw' as event_type, 'bLuna Custody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'withdraw' AND contract_label = 'bLuna Custody' AND DATE > CURRENT_DATE - 90
),
TOTAL as (
select DATE, event_type, contract_label, USD, Transactions, USD_per_transaction from COLLATERAL_PROVIDE
union
select DATE, event_type, contract_label, USD, Transactions, USD_per_transaction from COLLATERAL_WITHDRAW
)
select * from TOTAL ORDER BY 2, 3 desc
Run a query to Download Data