phi-deltalyticsMeme Trader Comp
Updated 2024-10-08Copy Reference Fork
999
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
›
⌄
-- forked from chrisfd / Francesco trader query @ https://flipsidecrypto.xyz/chrisfd/q/Mma-8yBF2TyI/francesco-trader-query
with sell_swaps as (
select
block_timestamp as time,
tx_id,
lag(tx_id) over (order by block_timestamp) as last_tx_id,
lag(tx_id, -1) over (order by block_timestamp) as previous_tx_id,
--row_number() over (partition by tx_id order by time) as rank,
swap_program,
swapper,
swap_from_amount as swap_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint
from solana.defi.fact_swaps
where swap_from_mint = 'n7EksMkvk3WT5FjQ3HBMLm9XYU3EnoXUSJ7PoWpxsoG'
--and swapper = '6jvYtr9G5WQnKs3cFsFtKmEfkbEnUXFhBKsmZad26QPV'
order by 1 desc
),
raw_sells as (
select
time,
tx_id,
case
when tx_id in (last_tx_id, previous_tx_id) and swap_program = 'jupiter swap v6' then 1
when tx_id not in (last_tx_id, previous_tx_id) then 1
end final_trade,
swap_program,
swapper,
swap_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint
from sell_swaps
QueryRunArchived: QueryRun has been archived