Query editor
/****************************** Smart Money **********************//*0x808507121b80c02388fad14726482e061b8da827 -- ethereum ************* token contract ***********0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8 -- arb ************* token contract ***********0xb3Ed0A426155B79B898849803E3B36552f7ED507 -- bsc ************* token contract ************/with tag_summary as (selectpool as address,'dex' as tag,'dex' as namefrom query_2781510 -- pool list https://dune.com/queries/2781510), hourly_token_price_detail as (SELECThourly_block_time as hourly_time, median_priceFROMquery_2785302 -- token price from dex and rpc https://dune.com/queries/2785302), latest_price as (select median_price from hourly_token_price_detail where median_price > 0 order by hourly_time desc limit 1), transfer_detail as (SELECTevt_block_time,to as address,t3.median_price,cast(value as double)/1e18 as balance,CASE WHEN t1."from"= t2.address THEN if(t2.tag='dex','Bought','Receive') ELSE 'Receive' END as type,CASE WHEN t1."from"= t2.address THEN if(t2.tag='dex',-cast(value as double)/1e18*t3.median_price,0) ELSE 0 END as amount_usd,-cast(value as double)/1e18*t3.median_price as transfer_amount_usdFROM erc20_ethereum.evt_Transfer t1 -- ************ blockchain *************LEFT JOIN tag_summary t2 on t1."from" = t2.addressLEFT JOIN hourly_token_price_detail t3 on date_trunc('hour',evt_block_time)= t3.hourly_timeWHERE t1.contract_address =0x808507121b80c02388fad14726482e061b8da827 --************* token contract ***********UNIONSELECTevt_block_time,"from" as address,t3.median_price,-cast(value as double)/1e18 as balance,CASE WHEN t1.to= t2.address THEN if(t2.tag='dex','Sold','Send') ELSE 'Send' END as type,CASE WHEN t1.to= t2.address THEN if(t2.tag='dex',cast(value as double)/1e18*t3.median_price,0) ELSE 0 END as amount_usd,cast(value as double)/1e18*t3.median_price as transfer_amount_usdFROM erc20_ethereum.evt_Transfer t1 -- ************ blockchain *************LEFT JOIN tag_summary t2 on t1.to = t2.addressLEFT JOIN hourly_token_price_detail t3 on date_trunc('hour',evt_block_time)= t3.hourly_timeWHERE t1.contract_address =0x808507121b80c02388fad14726482e061b8da827 --************* token contract ***********UNIONSELECTevt_block_time,to as address,t3.median_price,