Query editor
with eth_tx as ( -- include $ETH and $USDTselectblock_time,"from" as from_address,"to" as to_address,cast(value as decimal(38, 0)) / 1e18 as tx_amt,tx_hash,'WETH' symbolfromethereum.traceswherecall_type = 'call'and success = trueand value > uint256 '0'and "from" is not nulland "to" is not nulland block_time >= timestamp '2023-06-10'-- and block_time >= now() - interval '30' dayunion allselectevt_block_time block_time,"from" as from_address,"to" as to_address,cast(value as decimal(38, 0)) / 1e6 as tx_amt,evt_tx_hash tx_hash,'USDT' symbolfrom erc20_ethereum.evt_Transferwhere contract_address = 0xdAC17F958D2ee523a2206206994597C13D831ec7 --USDT-- and evt_block_time >= now() - interval '30' dayand evt_block_time >= timestamp '2023-06-10'),token_price as (select symbol, pricefrom prices.usd_latestwhere symbol in ('WETH','USDT')and blockchain = 'ethereum'),withdrawl_address_tx as (-- wallet_address is either personal address or other CEX addressesselectfrom_address,to_address,tx_hash,user_id customer_id,to_addr withdrawl_address,case when from_address = to_addr then 'from' else 'to' end as tx_direction,c.symbol,tx_amt,coalesce(tx_amt*price,0) tx_usd_amtfrometh_tx ajoindune.xyn008.dataset_eth_withdraw_cm b -- withdrawl address listona.from_address = b.to_addror a.to_address = b.to_addrjointoken_price c