anomoneArbitrage - Find the tokens for which arbitrage trading works
Updated 2022-03-23
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 swaps as (
SELECT block_timestamp, tx_id, SWAPPER,
(SWAP_TO_AMOUNT - SWAP_FROM_AMOUNT)/SWAP_FROM_AMOUNT *100 as gain
FROM solana.swaps
where block_timestamp::date >= '2022-02-01'
and swap_program = 'jupiter aggregator v2'
and succeeded = 'True'
and (swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and (swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' or swap_to_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and swap_from_amount >=100 and swap_to_amount >=100
and (SWAP_TO_AMOUNT - SWAP_FROM_AMOUNT)/SWAP_FROM_AMOUNT *100 >= 1
),
flattened as (
SELECT
BLOCK_TIMESTAMP,
TX_ID,
value:mint as token_address,
value:owner as owner, -- if accountIndex is 1 then sender; 2 then reciepient
value:accountIndex as accountIndex,
value:uiTokenAmount:uiAmount as amount
FROM solana.fact_transactions as t
, lateral flatten(input => POST_TOKEN_BALANCES)
)
SELECT f.BLOCK_TIMESTAMP,
f.TX_ID,
token_address,
owner,
accountIndex FROM flattened f
INNER JOIN swaps as s
ON f.tx_id = s.tx_id
AND f.owner = s.swapper
Run a query to Download Data