Pine AnalyticsUser's by Activity be 3 copy
Updated 2024-06-22
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
›
⌄
WITH tab1 AS (
SELECT
DISTINCT tx_id
FROM solana.core.fact_events
WHERE PROGRAM_ID LIKE '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P'
AND block_timestamp between '2024-04-15' and '2024-05-01'
)
SELECT
signers[0] as user,
count(DISTINCT date(block_timestamp)) as active_days,
count(DISTINCT tx_id) as events,
sum(abs(((post_balances[0] - pre_balances[0]) / POWER(10, 9)) + 0.000345)) as volume_sol,
min(date(block_timestamp)) as first_day,
max(date(block_timestamp)) as last_day,
count(DISTINCT PRE_TOKEN_BALANCES[0]['mint']) as token_swapped
FROM solana.core.fact_transactions
WHERE tx_id IN (SELECT * FROM tab1)
AND block_timestamp between '2024-04-01' and '2024-05-01'
AND (ARRAY_TO_STRING(log_messages, ', ') LIKE '%Program log: Instruction: Sell%'
OR ARRAY_TO_STRING(log_messages, ', ') LIKE '%Buy%')
AND SUCCEEDED
--LIMIT 100
GROUP BY 1
--LIMIT 5000
ORDER BY 3 DESC
QueryRunArchived: QueryRun has been archived