Query editor
with inflow as (select sum(amount_display) as sol_amount, sum(amount_usd) as usd_amountfrom tokens_solana.transferswhere --date_trunc('day', block_time) > DATE_TRUNC('day', NOW()) - INTERVAL '3' dayouter_executing_account = 'HVdfohHjp1kZwxn123Cxv3GDeXeXnLM1RAXaF8dPYBdS'and to_owner = 'GwXEzAYMQkZJr2VgiPfp5BtJoh7tBuFhM7djkMNzAiTT' and symbol = 'SOL'),outflow as (select sum(amount_display) as sol_amount, sum(amount_usd) as usd_amountfrom tokens_solana.transferswhere --date_trunc('day', block_time) > DATE_TRUNC('day', NOW()) - INTERVAL '3' dayouter_executing_account = 'HVdfohHjp1kZwxn123Cxv3GDeXeXnLM1RAXaF8dPYBdS'and from_owner = 'GwXEzAYMQkZJr2VgiPfp5BtJoh7tBuFhM7djkMNzAiTT' and symbol = 'SOL'),balance as (select-- d.time as day-- ,coalesce(i.sol_amount,0) as sol_in-- ,coalesce(i.usd_amount,0) as usd_in-- ,coalesce(o.sol_amount,0) as sol_out-- ,coalesce(o.usd_amount,0) as usd_outcoalesce(i.sol_amount,0) - coalesce(o.sol_amount,0) as sol_balance,coalesce(i.usd_amount,0) - coalesce(o.usd_amount,0) as usd_balancefrom inflow i, outflow o)selectsol_balance,sol_balance *(select pricefrom dex_solana.price_hourwhere contract_address = 'So11111111111111111111111111111111111111112'order by hour desclimit 1) as usd_balancefrom balance