mlhswap amounts
Updated 2022-06-07Copy Reference Fork
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 top_swaps as (
Select
date_trunc('day', block_timestamp) as date,
SWAP_FROM_MINT,
SWAP_TO_MINT,
sum(iff(swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'
or swap_from_mint = '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i',
swap_from_amount,
swap_to_amount)) as swapamount
From
Solana.fact_swaps
Where
block_timestamp::date >= '2022-04-30' And
succeeded = 'True' and
swap_program = 'orca' and
(swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'
or swap_from_mint = '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i') and
SWAP_FROM_AMOUNT>0 and
SWAP_TO_AMOUNT>0 and
SWAP_FROM_MINT != SWAP_TO_MINT
Group by date, SWAP_FROM_MINT, SWAP_TO_MINT
order by swapamount desc
) ,top_with_label as (select
ROW_NUMBER() OVER (PARTITION BY date ORDER BY swapamount DESC) as cnt,
date,
swapamount,
concat(a.label,' to ' ,b.label) as "label"
from top_swaps,solana.dim_labels as a,solana.dim_labels as b
where a.address=SWAP_FROM_MINT and b.address=SWAP_TO_MINT
order by swapamount desc
) (
select * from top_with_label where cnt < 6
Run a query to Download Data