mastercheth-bWgp_-Getting Started
Updated 2023-11-06
999
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 lending_union as (
SELECT
'Borrow' as action,
date_trunc('year',
block_timestamp) as year,
date_trunc('quarter',
block_timestamp) as quarter,
date_trunc('month',
block_timestamp) as month,
date_trunc('week',
block_timestamp) as week,
token_symbol,
event_name,
platform,
tx_hash,
origin_from_address,
sum(amount) as amount,
sum(amount_usd) amount_usd,
avg(amount_usd) amount_usd_avg,
count(*) as txn_count,
count(distinct(origin_from_address)) as distinct_lenders
from
ethereum.defi.ez_lending_borrows
group by 1,2,3,4,5,6,7,8,9,10
UNION ALL
SELECT
'Deposits' as action,
date_trunc('year',
block_timestamp) as year,
date_trunc('quarter',
block_timestamp) as quarter,
date_trunc('month',
block_timestamp) as month,
date_trunc('week',
block_timestamp) as week,
Run a query to Download Data