Query editor
--Error: Query is too long for wand tools.--Try shortening query to try again.--Error: Query is too long for wand tools.--Try shortening query to try again.with arbitrum as (select distinct evt_block_time, contract_address , account, indexToken, key, price/1e30 as price , (cast(sizeDelta as int256)/1e30) as sizeDelta, case when isLong = true then 1 else 0 end as position, cast(collateralDelta as int256)/1e30 as collatDelta, fee/1e30 as fee, case when true then 'Arbitrum' else '0' end as blockchain, collateralToken ,'Increase' as PositionType , evt_tx_hashfrom gmx_arbitrum.Vault_evt_IncreasePositionwhere evt_block_time >= cast('2023-06-01' as TIMESTAMP)UNION ALLselect distinct a.evt_block_time, a.contract_address , a.account, a.indexToken, a.key, a.markPrice/1e30 as price , (cast(a.size as int256)/1e30) as sizeDelta, case when a.isLong = true then 1 else 0 end as position, cast(a.collateral as int256)/1e30 as collatDelta, b.fee/1e30 as fee, case when true then 'Arbitrum' else '0' end as blockchain, a.collateralToken ,'Liquidate' as PositionType , a.evt_tx_hashfrom gmx_arbitrum.Vault_evt_LiquidatePosition aleft join gmx_arbitrum.Vault_evt_DecreasePosition b on a.evt_tx_hash = b.evt_tx_hash and a.key = b.keywhere a.evt_block_time >= cast('2023-06-01' as TIMESTAMP)UNION ALLselect distinct a.evt_block_time, a.contract_address , a.account, a.indexToken, a.key, a.price/1e30 as price ,(-cast(a.sizeDelta as int256)/1e30) as sizeDelta, case when a.isLong = true then 1 else 0 end as position, -cast(a.collateralDelta as int256)/1e30 as collatDelta, a.fee/1e30 as fee, case when true then 'Arbitrum' else '0' end as blockchain, a.collateralToken, case when a.evt_tx_hash = b.evt_tx_hash and a.key = b.key then 'Closed'else 'Decrease' end as PositionType, a.evt_tx_hashfrom gmx_arbitrum.Vault_evt_DecreasePosition aleft join gmx_arbitrum.Vault_evt_ClosePosition b on a.evt_tx_hash = b.evt_tx_hash and a.key = b.keywhere a.evt_block_time >= cast('2023-06-01' as TIMESTAMP)),avalanche as (select distinct evt_block_time, contract_address , account, indexToken, key, price/1e30 as price , (cast(sizeDelta as int256)/1e30) as sizeDelta, case when isLong = true then 1 else 0 end as position, cast(collateralDelta as int256)/1e30 as collatDelta, fee/1e30 as fee, case when true then 'Avalanche' else '0' end as blockchain, collateralToken , 'Increase' as PositionType, evt_tx_hashfrom gmx_avalanche_c.Vault_evt_IncreasePositionwhere evt_block_time >= cast('2023-06-01' as TIMESTAMP)UNION ALLselect distinct a.evt_block_time, a.contract_address , a.account, a.indexToken, a.key, a.markPrice/1e30 as price , (cast(a.size as int256)/1e30) as sizeDelta, case when a.isLong = true then 1 else 0 end as position, cast(a.collateral as int256)/1e30 as collatDelta, b.fee/1e30 as fee, case when true then 'Avalanche' else '0' end as blockchain, a.collateralToken ,'Liquidate' as PositionType , a.evt_tx_hashfrom gmx_avalanche_c.Vault_evt_LiquidatePosition aleft join gmx_avalanche_c.Vault_evt_DecreasePosition b on a.evt_tx_hash = b.evt_tx_hash and a.key = b.keywhere a.evt_block_time >= cast('2023-06-01' as TIMESTAMP)UNION ALLselect distinct a.evt_block_time, a.contract_address , a.account, a.indexToken, a.key, a.price/1e30 as price ,(-cast(a.sizeDelta as int256)/1e30) as sizeDelta, case when a.isLong = true then 1 else 0 end as position, -cast(a.collateralDelta as int256)/1e30 as collatDelta, a.fee/1e30 as fee, case when true then 'Avalanche' else '0' end as blockchain, a.collateralToken, case when a.evt_tx_hash = b.evt_tx_hash and a.key = b.key then 'Closed'else 'Decrease' end as PositionType, a.evt_tx_hashfrom gmx_avalanche_c.Vault_evt_DecreasePosition aleft join gmx_avalanche_c.Vault_evt_ClosePosition b on a.evt_tx_hash = b.evt_tx_hash and a.key = b.keywhere a.evt_block_time >= cast('2023-06-01' as TIMESTAMP)),