Query editor
with simple_transfers as (select block_date, trace_id from ton.messageswhere direction = 'in'and block_date > now() - interval '{{days}}' daygroup by 1, 2having count(distinct tx_hash) = 2), tx_fees as (select hash, block_date, trace_id, total_fees from ton.transactions join simple_transfers using(trace_id, block_date)where block_date > now() - interval '{{days}}' day), msg_fees as (select hash, M.block_date, M.trace_id, coalesce(fwd_fee, 0) as total_fees from ton.messages M join tx_feeson tx_fees.block_date = M.block_date and M.tx_hash = tx_fees.hash and direction = 'in'where M.block_date > now() - interval '{{days}}' day), all_fees as (select * from tx_feesunion allselect * from msg_fees), total_fees_for_trace as (select trace_id, sum(total_fees) as total_fees, count(distinct hash) as tx_countfrom all_fees group by 1)select count(1) as "TON Simple transfers count", round(sum(total_fees) / 1e9) as "TON Simple transfers total fees, TON",sum(total_fees) / 1e9 / count(1) as "TON Simple transfers average fee, TON"from total_fees_for_trace