Pine Analyticstime.fun copy
Updated 2024-11-01
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
›
⌄
with tab1 as (
SELECT
tx_hash as tx,
case when ORIGIN_FUNCTION_SIGNATURE like '0x6945b123' then 'Buy'
when ORIGIN_FUNCTION_SIGNATURE like '0xb51d0534' then 'Sell'
end AS tx_type
from base.core.fact_event_logs
WHERE ORIGIN_TO_ADDRESS like lower('0x428aeF7fB31E4E86162D62d4530a4dd7232D953D')
and ORIGIN_FUNCTION_SIGNATURE in ('0x6945b123', '0xb51d0534')
)
SELECT *
from (
select
tx_hash,
'Sell' as tx_type,
block_timestamp,
ORIGIN_FROM_ADDRESS as user,
sum(amount_usd) as amount_usd
from base.core.ez_native_transfers as a
left outer join tab1
on tx = tx_hash
where a.tx_hash in (SELECT tx from tab1)
AND tx_type like 'Sell'
and ORIGIN_FROM_ADDRESS = to_address
GROUP BY 1,2,3,4
)
QueryRunArchived: QueryRun has been archived