Query editor
with position_close as (select *,cast(json_value(closeInfo, 'lax $.positionId') as uint256) as positionId,json_value(closeInfo, 'lax $.isProfit') as isProfit,cast(json_query(closeInfo, 'lax $.pnl') as uint256) as pnlfrom borabora_bnb.Pool_evt_ClosePosition), daily_net_pnl as (select date_trunc('day', evt_block_time) as dt,sum(case when isProfit = 'false' then pnl / pow(10, 18) * -1 else pnl / pow(10, 19) end ) as net_pnlfrom position_closegroup by date_trunc('day', evt_block_time))select dt,net_pnl as "Realized PnL",sum(net_pnl) over (order by dt rows between unbounded preceding and current row) as "Cumulative Realized PnL"from daily_net_pnlorder by dt