Query editor
select time, position_side, SUM(SUM(size)) OVER (PARTITION BY position_side ORDER BY time) as total_size,SUM(SUM(size)/1e6) OVER (PARTITION BY position_side ORDER BY time) as converted_sizefrom (select date_trunc('hour', evt_block_time) as time, sizeDelta/1e30 as size, if(`isLong`, 'LONG', 'SHORT') as position_side FROM gmx_arbitrum.Vault_evt_IncreasePositionUNION ALLselect date_trunc('hour', evt_block_time) as time, -size/1e30 as size, if(`isLong`, 'LONG', 'SHORT') as position_side FROM gmx_arbitrum.Vault_evt_LiquidatePositionUNION ALLselect date_trunc('hour', evt_block_time) as time, -sizeDelta/1e30 as size, if(`isLong`, 'LONG', 'SHORT') as position_side FROM gmx_arbitrum.Vault_evt_DecreasePositionUNION ALLselect date_trunc('hour', evt_block_time) as time, -size/1e30 as volume, if(`isLong`, 'LONG', 'SHORT') as position_sideFROM gmx_avalanche_c.Vault_evt_LiquidatePositionUNION ALLselect date_trunc('hour', evt_block_time) as time, sizeDelta/1e30 as volume, if(`isLong`, 'LONG', 'SHORT') as position_sideFROM gmx_avalanche_c.Vault_evt_IncreasePositionUNION ALLselect date_trunc('hour', evt_block_time) as time, -sizeDelta/1e30 as volume, if(`isLong`, 'LONG', 'SHORT') as position_sideFROM gmx_avalanche_c.Vault_evt_DecreasePosition) as open_interestGROUP BY time, 2ORDER BY time DESC, 2