danielrDaily staked and unstaked
Updated 2023-06-04
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
›
⌄
with A as(
SELECT
date_trunc('{{Date_Trunc}}',block_timestamp) as date,
sum(AMOUNT_USD) as amount,
'Staked' as type
from ethereum.core.ez_token_transfers
where TO_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
and ORIGIN_TO_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
and block_timestamp >= CURRENT_DATE - {{Period_From_Current_Date}}
and SYMBOL='AAVE'
group by 1),
B as(
SELECT
date_trunc('{{Date_Trunc}}',block_timestamp) as date,
sum(AMOUNT_USD) as amount,
'Unstaked' as type
from ethereum.core.ez_token_transfers
where from_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
and ORIGIN_TO_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
and block_timestamp >= CURRENT_DATE - {{Period_From_Current_Date}}
and SYMBOL='AAVE'
group by 1),
C as(
select * from A
union all
select * from B
)
select * from C
Run a query to Download Data