Query editor
WITH trades AS (SELECT *FROM dune.testing_1_2.result_solana_dex_trades_7_days -- april 14th to 20th-- dune.elo_viano.result_dex_trades_7_dUNION ALLSELECT *FROM dune.elo_viano.result_e6yo_trades_7days-- query_5014737 --5014850-- FROM dune.testing_1_2.result_e6yo_bot_trades_last7_days)-- select * from trades-- , dexs as (-- SELECT block_date, block_time, block_slot, tx_id, inner_executing_account AS dex_program_id-- FROM solana.instruction_calls-- WHERE block_date >= CURRENT_DATE - INTERVAL '7' DAY-- -- AND executing_account = 'E6YoRP3adE5XYneSseLee15wJshDxCsmyD2WtLvAmfLi'-- AND outer_instruction_index = 1 AND inner_instruction_index = 1-- AND tx_id in (SELECT id FROM dune.testing_1_2.result_e6yo_bot_trades_last7_days)-- ), first_frontrun AS (SELECTt1.*,ROW_NUMBER() OVER (PARTITION BY t1.block_id, t1.trader_id, t1.token_pair ORDER BY t1.index) as fr_orderFROM trades t1),last_backrun AS (SELECTt2.*,ROW_NUMBER() OVER (PARTITION BY t2.block_id, t2.trader_id, t2.token_pair ORDER BY t2.index DESC) as br_orderFROM trades t2), jito_tips AS (SELECTblock_date, block_time, block_slot-- , tx_id-- , tx_index, from_owner AS tipper, sum(amount_display) AS tips_paid_sol, sum(amount_usd) AS tips_paid_usdFROM tokens_solana.sol_transfersWHEREblock_date >= CURRENT_DATE - INTERVAL '7' DAYAND to_owner IN ('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5', 'HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe', 'Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY', 'ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49', 'DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh', 'ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt', 'DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL', '3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT' )