Query editor
SELECT date_trunc('day', pf.call_block_time) as time,SUM(pf."output_pendingFundingPayment" * 1e-18) as pending_funding,SUM(SUM(pf."output_pendingFundingPayment") * 1e-18) OVER (ORDER BY date_trunc('day', pf.call_block_time)) as cumulative_pending_fundingFROM perp_v2."Exchange_call_getAllPendingFundingPayment" as pfWHERE ABS(pf."output_pendingFundingPayment" * 1e-18) >= 0 and pf.call_success = true and pf.trader = CONCAT('\x',SUBSTRING('{{wallet address}}' from 3))::bytea and(CASEWHEN '{{time period}}' = 'Day' THEN date_trunc('day', pf.call_block_time) >= NOW() - interval '1 day'WHEN '{{time period}}' = 'Week' THEN date_trunc('day', pf.call_block_time) >= NOW() - interval '1 week'WHEN '{{time period}}' = 'Month' THEN date_trunc('day', pf.call_block_time) >= NOW() - interval '1 month'WHEN '{{time period}}' = 'Year' THEN date_trunc('day', pf.call_block_time) >= NOW() - interval '1 year'WHEN '{{time period}}' = 'All-Time' THEN 1=1END)GROUP BY 1ORDER BY 1 DESC