SpiltadavidTrending token based on their swap volume on Orca
Updated 2022-07-12Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
with swap_from_volume as(
select label, sum(swap_to_amount) as from_volume
from solana.core.fact_swaps, solana.core.dim_labels
where block_timestamp::date >= '2022-02-01' And succeeded = 'True' and swap_program = 'orca' and (SWAP_to_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' or
SWAP_to_MINT = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') and address = SWAP_from_MINT and SWAP_FROM_AMOUNT>0 and SWAP_TO_AMOUNT>0 and SWAP_FROM_MINT != SWAP_TO_MINT
group by label
order by 2 desc),
swap_to_volume as (
select label, sum(swap_from_amount) as to_volume
from solana.core.fact_swaps, solana.core.dim_labels
where block_timestamp::date >= '2022-02-01' And succeeded = 'True' and swap_program = 'orca' and (SWAP_from_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' or
SWAP_from_MINT = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') and address = SWAP_to_MINT and SWAP_FROM_AMOUNT>0 and SWAP_TO_AMOUNT>0 and SWAP_FROM_MINT != SWAP_TO_MINT
group by label
order by 2 desc)
select swap_from_volume.label, from_volume + to_volume as token_volume
from swap_from_volume, swap_to_volume
where swap_from_volume.label = swap_to_volume.label
order by token_volume desc
Run a query to Download Data