Query editor
with usd as (selectdate_trunc('{{Time BTC}}', minute) as dayt,avg(price) as pricesfrom prices.usdwhere symbol = 'BTC'group by 1),transfer as (selectdt,sum(amount) as netflowfrom (selectdate_trunc('{{Time BTC}}', block_time) as dt,-1 * value as amountfrom bitcoin.inputs awhere address = '{{Wallet BTC}}'union allselectdate_trunc('{{Time BTC}}', block_time) as dt,value as amountfrom bitcoin.outputs awhere address = '{{Wallet BTC}}')group by 1)selectdayt,netflow,pricesfrom transfer aright join usd b on a.dt = b.daytwhere dayt >= now() - interval '{{Timeframe BTC}}' day