Query editor
SELECTdate_trunc('{{granularity_Section_W}}', e.evt_block_time) AS date_trade,CASEWHEN e."from" = {{wallet_address_Section_W}} THEN '🚨 Sell'WHEN e."to" = {{wallet_address_Section_W}} THEN '💰 Buy'ELSE 'unknown'END AS status,e."from" AS sell_side,e."to" AS buy_side,ceiling(CAST(e.value AS REAL) / power(10, t.decimals)) AS tx_value,e.evt_tx_hash AS tx_hash,{{token_address}} AS contract_addressFROM erc20_{{chain_section_W}}.evt_transfer eJOIN tokens.erc20 tON e.contract_address = t.contract_addressAND t.blockchain = '{{chain_section_W}}'WHEREe.contract_address = {{token_address}}AND (e."from" = {{wallet_address_Section_W}}OR e."to" = {{wallet_address_Section_W}})AND e.evt_block_time > CAST('{{start_date_Section_W}}' AS TIMESTAMP)AND e.evt_block_time < CAST('{{end_date_Section_W}}' AS TIMESTAMP)ORDER BY date_trade ASC;