Pine Analyticsaxl final 6 copy copy copy copy copy
Updated 2023-12-14
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 tab2 as (
SELECT
block_timestamp,
tx_hash,
user,
sum(CASE when flow like 'out' then -1 * amount else amount end) as net_flow
FROM (
SELECT
block_timestamp,
tx_hash,
from_address as user,
'out' as flow,
RAW_AMOUNT_PRECISE::NUMBER(38, 0) as AMOUNT
from arbitrum.core.fact_token_transfers
WHERE contract_address LIKE lower('0x23ee2343B892b1BB63503a4FAbc840E0e2C6810f')
UNION
SELECT
block_timestamp,
tx_hash,
to_address as user,
'in' as flow,
RAW_AMOUNT_PRECISE::NUMBER(38, 0) as AMOUNT
from arbitrum.core.fact_token_transfers
WHERE contract_address LIKE lower('0x23ee2343B892b1BB63503a4FAbc840E0e2C6810f')
)
GROUP BY 1,2,3
), tab3 as (
SELECT
user,
min(block_timestamp) as first,
max(block_timestamp) as last,
sum(net_flow) balance
Run a query to Download Data