scottincryptoUntitled Query
Updated 2022-08-07
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 awsteth as (
select
date_trunc('day',block_timestamp) as block_day
, from_address
, to_address
, raw_amount / 1e18 as amount
from ethereum.core.ez_token_transfers
where contract_address = '0x1982b2f5814301d4e9a8b0201555376e62f82428' --awstETH
)
, awsteth_out as (
select
block_day
, from_address as wallet
, sum(amount) as awsteth_out
from awsteth
group by block_day, from_address
)
, awsteth_in as (
select
block_day
, to_address as wallet
, sum(amount) as awsteth_in
from awsteth
group by block_day, to_address
)
select 1
-- repeat all this for WETH debt tokens
-- make dates_wallets
-- join both ins & outs to this
-- add a cumu balance partition by wallet order by day for both tokens
-- filter both tokens positive balance - and keep null address
-- roll up by day without null address
--
Run a query to Download Data