Query editor
withprofit_per_block as(selectevt_block_number,evt_block_time,sum(amt)/1e18 as profit_per_blockfrom(selectevt_block_number,evt_block_time,evt_tx_hash,"from" as addy,-cast(value as double) as amtfrom erc20_ethereum.evt_Transferwhere contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2and "from" = 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80and to in (select distinct address from ethereum.creation_traces)union allselectevt_block_number,evt_block_time,evt_tx_hash,to as addy,cast(value as double) as amtfrom erc20_ethereum.evt_Transferwhere contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2and to = 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80and "from" in (select distinct address from ethereum.creation_traces))group by 1,2),gas_fee_per_block as(selectblock_number,block_time,sum(gas_price * 1.0 * gas_used/1e18) as gas_feefrom ethereum.transactionswhere "from" = 0xae2fc483527b8ef99eb5d9b44875f005ba1fae13group by 1,2)selectpnl.block_date,avg_profit,income_per_day,gas_fee,pnl_per_day,if(pnl_per_day < 0,pnl_per_day,null) as under_water,if(pnl_per_day < 0,pnl_per_day,null) * avg_price as under_water_usd,if(pnl_per_day >= 0,pnl_per_day,null) as in_the_money,if(pnl_per_day >= 0,pnl_per_day,null) * avg_price as in_the_money_usd,pnl_in_profit,pnl_in_loss,block_in_loss_count,block_in_profit_count,pnl.total_block_count as bot_block_count,b.block_count as total_block_count,b.block_count - pnl.total_block_count as other_block_count,