Query editor
WITHmarket AS (SELECT*FROMquery_4671579 -- GMX v2 Markets),trades AS (SELECTblock_time,account,market.market_name,CASE WHEN is_long = true then 'Increase_long' ELSE 'Increase_short' END as type,execution_price,size_delta_usd,size_delta_in_tokens,price_impact_usd,NULL AS base_pnl_usd,order_key,tx_hashFROMgmx_v2.position_increase AS position_increaseJOIN market ON position_increase.market = market.marketWHEREaccount IN (0x7Ab8C59Db7b959Bb8C3481d5b9836dfbc939AF21,0xAb3067C58811aDE7aA17B58808Db3b4c2E86f603,0xe4d31c2541A9cE596419879B1A46Ffc7cD202c62)and block_time >= TIMESTAMP '2025-02-05'UNION ALLSELECTblock_time,account,market.market_name,CASE WHEN is_long = true then 'Decrease_long' ELSE 'Decrease_short' END as type,execution_price,size_delta_usd,size_delta_in_tokens,price_impact_usd,base_pnl_usd,order_key,tx_hashFROMgmx_v2.position_decrease AS position_decreaseJOIN market ON position_decrease.market = market.marketWHEREaccount IN (0x7Ab8C59Db7b959Bb8C3481d5b9836dfbc939AF21,0xAb3067C58811aDE7aA17B58808Db3b4c2E86f603,0xe4d31c2541A9cE596419879B1A46Ffc7cD202c62)and block_time >= TIMESTAMP '2025-02-05'),fees AS (SELECTblock_time,funding_fee_amount * collateral_token_price_min AS funding_fee_usd,fee_amount_for_pool * collateral_token_price_min AS position_fee_usd,borrowing_fee_usd,