Abbas_ra21Daily 2
Updated 2024-11-28
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 main AS (select
date_trunc('{{Interval}}',BLOCK_TIMESTAMP) AS Date,
'Deposit' AS "Event Name",
sum(case when Amount_USD is not null then Amount_USD else Amount*Price end) AS Volume
from
base.defi.ez_lending_deposits A
inner join base.price.ez_prices_hourly B on B.TOKEN_ADDRESS=A.TOKEN_ADDRESS and HOUR=date_trunc('hour',BLOCK_TIMESTAMP)
where
PLATFORM = 'Seamless' and BLOCK_TIMESTAMP >= '{{Start_Date}}'
group by 1
union ALL
select
date_trunc('{{Interval}}',BLOCK_TIMESTAMP) AS Date,
'Borrow' AS "Event Name",
sum(case when Amount_USD is not null then Amount_USD else Amount*Price end) AS Volume
from
base.defi.ez_lending_borrows A
inner join base.price.ez_prices_hourly B on B.TOKEN_ADDRESS=A.TOKEN_ADDRESS and HOUR=date_trunc('hour',BLOCK_TIMESTAMP)
where
PLATFORM = 'Seamless' and BLOCK_TIMESTAMP >= '{{Start_Date}}'
group by 1
union ALL
select
date_trunc('{{Interval}}',BLOCK_TIMESTAMP) AS Date,
'Repayment' AS "Event Name",
sum(case when Amount_USD is not null then Amount_USD else Amount*Price end) AS Volume
from
base.defi.ez_lending_repayments A
inner join base.price.ez_prices_hourly B on B.TOKEN_ADDRESS=A.TOKEN_ADDRESS and HOUR=date_trunc('hour',BLOCK_TIMESTAMP)
where
PLATFORM = 'Seamless' and BLOCK_TIMESTAMP >= '{{Start_Date}}'
group by 1
union ALL
select
date_trunc('{{Interval}}',BLOCK_TIMESTAMP) AS Date,
'Withdraw' AS "Event Name",
Auto-refreshes every 24 hours
QueryRunArchived: QueryRun has been archived