OCTOPUS2023-12-05 04:14 PM
Updated 2023-12-05
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
›
⌄
WITH token_transfers AS (
SELECT
SUM(amount_usd) as total_transferred,
from_address as investor
FROM arbitrum.core.ez_token_transfers
WHERE to_address = lower('0x553fe5115392e2f024f1099e41a2f8ccb5ed2bca')
GROUP BY investor
),
transfers AS (
SELECT
SUM(amount_usd) as total_received,
origin_from_address as investor
FROM arbitrum.core.ez_token_transfers
WHERE to_address = lower('0x553fe5115392e2f024f1099e41a2f8ccb5ed2bca')
GROUP BY investor
)
SELECT
tt.investor,
COALESCE(tt.total_transferred, 0) as total_sold,
COALESCE(tr.total_received, 0) as total_held,
COALESCE(tr.total_received, 0) - COALESCE(tt.total_transferred, 0) as gains
FROM token_transfers tt
FULL OUTER JOIN transfers tr ON tt.investor = tr.investor
WHERE gains > 0; -- Filter for positive gains
Run a query to Download Data