saeedmzn2024-06-13 07:38 PM
Updated 2024-06-13
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 test_1 as (select
-- count (tx_hash),
-- count (DISTINCT tx_hash)
tx_hash,
max (amount_usd) max_
-- case when platform ilike '%aave%' then 'AAVE'
-- when platform ilike '%joe%' then 'Trader Joe'
-- else platform end as platform_name,
-- token_symbol as market,
-- sum (amount_usd) as repayment_volume
--sum (case when token_symbol ilike '%usd%' or token_symbol ilike '%dai%' or token_symbol ilike '%frax%' or token_symbol ilike '%mim%' then amount else amount_usd end) as repayment_volume
from avalanche.defi.ez_lending_repayments
where token_symbol = 'WBTC.e'
-- and platform ='Benqi'
-- order by 1 limit 200
group by 1
),
test_2 as (select
-- count (tx_hash),
-- count (DISTINCT tx_hash)
tx_hash,
amount_usd
-- case when platform ilike '%aave%' then 'AAVE'
-- when platform ilike '%joe%' then 'Trader Joe'
-- else platform end as platform_name,
-- token_symbol as market,
-- sum (amount_usd) as repayment_volume
--sum (case when token_symbol ilike '%usd%' or token_symbol ilike '%dai%' or token_symbol ilike '%frax%' or token_symbol ilike '%mim%' then amount else amount_usd end) as repayment_volume
from avalanche.defi.ez_lending_repayments
where token_symbol = 'WBTC.e'
-- and platform ='Benqi'
-- order by 1 limit 200
-- group by 1
)
-- group by 1,2
select sum (max_) amount, 'removed_duplicate' type from test_1
QueryRunArchived: QueryRun has been archived