Query editor
with batches_and_trades as (selectcount(*) total_batches,sum(num_trades) as total_tradesfrom gnosis_protocol_v2."batches"where block_time between '2022-03-01' and '2022-05-24')selecttotal_batches,total_trades,trunc((100 * total_batches - {{PerBatchReward}} * total_batches) / total_trades) as per_trade_reward,trunc((100 * total_batches - {{PerBatchReward}} * total_batches) / total_trades) + {{PerBatchReward}} as single_order_batch_rewardfrom batches_and_trades