Query editor
-- =============================================================================-- FINAL: Daily Liquidity Changes with Orca Daily Median Prices (no VWAP)-- Replaces dependency on query_6116370 and drops all VWAP pricing-- Params: start_date, end_date (ISO8601)-- =============================================================================WITH/* 1) Base LP actions in window (same source your 6116370 used upstream) */liquidity_actions_ix AS (SELECT *FROM "query_5804973(start_date='{{start_date}}', end_date='{{end_date}}')"),/* 2) Keep only top pools early (credit saver) */top_pools AS (SELECT whirlpool_addressFROM "query_5921773"),liquidity_actions_top_pools AS (SELECT actions.*FROM liquidity_actions_ix actionsWHERE EXISTS (SELECT 1FROM top_pools tpWHERE tp.whirlpool_address = actions.account_whirlpool)),/* 3) Only transfers from those txs in the same window */relevant_transfers AS (SELECTt.tx_id,t.block_slot,t.outer_instruction_index,t.inner_instruction_index,t.token_mint_address,t.symbol,t.amount_display,t.action,t.block_timeFROM tokens_solana.transfers tWHERE t.block_time >= TIMESTAMP '{{start_date}}'AND t.block_time < TIMESTAMP '{{end_date}}'AND t.action = 'transfer'AND EXISTS (SELECT 1FROM liquidity_actions_top_pools lpWHERE lp.call_tx_id = t.tx_idAND lp.call_block_slot = t.block_slot)),/* 4) Link transfers to actions, collapse per (tx, mint), and keep ordering key */transfers_per_mint AS (SELECTix.call_tx_id,ix.account_position,ix.account_whirlpool,