connorhComp Testing
Updated 2021-04-20
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 borrows AS (
SELECT
borrower,
borrows_contract_symbol AS underlying_symbol,
sum(loan_amount) AS token_loan_amount,
sum(loan_amount_usd) AS loan_amount_usd
FROM compound.borrows
WHERE block_timestamp >= CURRENT_DATE - 60
GROUP BY 1,2
), repays AS (
SELECT
borrower,
repay_contract_symbol AS underlying_symbol,
sum(repayed_amount) AS token_repay_amount,
sum(repayed_amount_usd) AS loan_repay_amount_usd
FROM compound.repayments
WHERE block_timestamp >= CURRENT_DATE - 60
GROUP BY 1,2
), liquidations AS (
SELECT
borrower,
liquidation_contract_symbol AS underlying_symbol,
SUM(liquidation_amount) AS amount_seized,
SUM(liquidation_amount_usd) AS amount_seized_usd,
COUNT(DISTINCT liquidator) AS liquidators
FROM
compound.liquidations
WHERE block_timestamp >= CURRENT_DATE - 60
GROUP BY 1,2
Run a query to Download Data