MasterChETHTime Series Query
Updated 2024-06-14Copy Reference Fork
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 base as (
SELECT
'Borrows' 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,
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
{{Chain}}.defi.ez_lending_borrows
group by
1,
2,
3,
4,
5,
6,
7,
8
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,
token_symbol,
event_name,
QueryRunArchived: QueryRun has been archived