Query editor
-- ПараметрыWITH parameters AS (SELECT'{{token_mint_address}}' AS target_token,-- Приводим TIMESTAMP к DATE правильноCAST(CAST('{{analysis_date}}' AS TIMESTAMP) AS DATE) AS target_date),-- ============================================-- Активные пулы на целевую дату (из dex_solana.trades)-- ============================================active_pools_on_date AS (SELECT DISTINCTt.project_program_id AS pool_address,t.project AS dex,t.version_name AS pool_typeFROM dex_solana.trades tCROSS JOIN parametersWHERE t.block_date = parameters.target_date -- теперь block_date (date) = target_date (date)AND (t.token_bought_mint_address = parameters.target_tokenOR t.token_sold_mint_address = parameters.target_token)),-- ============================================-- Meteora DLMM пулы-- ============================================meteora_dlmm_pools AS (SELECTcall_block_time AS created_at,call_tx_id AS creation_tx,call_tx_signer AS creator_signer,'Meteora' AS dex,'DLMM' AS pool_type,account_lbPair AS pool_address,account_tokenMintX AS token_a,account_tokenMintY AS token_b,account_reserveX AS vault_a,account_reserveY AS vault_b,account_oracle AS oracle,account_funder AS funder,binStep AS bin_step,activeId AS active_idFROM meteora_solana.lb_clmm_call_initializelbpairCROSS JOIN parametersWHERE (account_tokenMintX = parameters.target_tokenOR account_tokenMintY = parameters.target_token)),-- ============================================-- Meteora CPMM пулы-- ============================================meteora_cpmm_pools AS (SELECTcall_block_time AS created_at,call_tx_id AS creation_tx,call_tx_signer AS creator_signer,'Meteora' AS dex,'CPMM' AS pool_type,account_pool AS pool_address,account_token_a_mint AS token_a,