Pine AnalyticscbBTC 5
Updated 2024-11-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 tab1 AS (
SELECT
block_timestamp,
to_address as user,
'in' as flow,
amount
FROM base.core.ez_token_transfers
WHERE contract_address LIKE lower('0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf')
union all
SELECT
block_timestamp,
from_address as user,
'out' as flow,
amount
FROM base.core.ez_token_transfers
WHERE contract_address LIKE lower('0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf')
), tab2 as (
SELECT
user,
min(date(block_timestamp)) as first_day,
max(date(block_timestamp)) as last_day,
sum(CASE when flow like 'in' then amount else -amount end) as balance
from tab1
where not user like '0x0000000000000000000000000000000000000000'
GROUP BY 1
), tab3 as (
SELECT
median(price) as price
from ethereum.price.ez_prices_hourly
where token_address like lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599')
QueryRunArchived: QueryRun has been archived