Query editor
-- trading volumewith closeSuccess as (selectdate_trunc('day', block_time) as day,topic1 as address,topic2 as trace,bytearray_to_uint256(bytearray_substring(data, 1,32))/1e8 as closePrice,bytearray_to_int256(bytearray_substring(data, 33,32))/1e18 as fundingFee,bytearray_to_uint256(bytearray_substring(data, 65,32))/1e18 as closeFee,bytearray_to_int256(bytearray_substring(data, 97,32))/1e18 as pnlfrom bnb.logswhere contract_address = 0x1b6f2d3844c6ae7d56ceb3c3643b9060ba28feb0and block_number > 24638880and topic0 = 0x5fe568f6d99b9b23e2eabf02f546038a30936ddaf9a9fe25c47b85ca046ca8e7),closeReceive as (selectdate_trunc('day', block_time) as day,topic1 as address,topic2 as trace,case when topic3=0x00000000000000000000000055d398326f99059ff775485246999027b3197955 then 'USDT' end token,bytearray_to_uint256(bytearray_substring(data, 1,32))/1e18 as closeAmountfrom bnb.logswhere contract_address = 0x1b6f2d3844c6ae7d56ceb3c3643b9060ba28feb0and block_number > 24638880and topic0 = 0x82982650e85330c501b1cfb68b1ae3e06d6be2048d4378a018d8b84da6d5c959),passiveclose as (select date_trunc('day', block_time) as day,topic1 as address,topic2 as trace,case when bytearray_to_int256(bytearray_substring(data, 1,32)) = cast (0 as int256) then 'TP'when bytearray_to_int256(bytearray_substring(data, 1,32)) = cast (1 as int256) then 'SL'when bytearray_to_int256(bytearray_substring(data, 1,32)) = cast (2 as int256) then 'LIQ'end as type,bytearray_to_int256(bytearray_substring(data, 33,32))/1e8 as closeprice,bytearray_to_int256(bytearray_substring(data, 65,32))/1e18 as fundingfee,bytearray_to_int256(bytearray_substring(data, 97,32))/1e18 as closefee,bytearray_to_int256(bytearray_substring(data, 129,32))/1e18 as pnlfrom bnb.logswhere contract_address = 0x1b6f2d3844c6ae7d56ceb3c3643b9060ba28feb0and block_number > 24638880and topic0 = 0x9be0c933647236dbebc4b2196c684c57c03490f98cb37b8a502b5dfb3d293162),open as (selectdate_trunc('day', block_time) as day,topic1 as address,topic2 as trace,bytearray_to_uint256(bytearray_substring(data, 65,32))/1e8 as entryPrice--,bytearray_substring(data, 97,32) as pairBase,casewhen bytearray_substring(data, 97,32) = 0x0000000000000000000000007130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c then 'BTC'when bytearray_substring(data, 97,32) = 0x000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c then 'BNB'when bytearray_substring(data, 97,32) = 0x0000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f8 then 'ETH'when bytearray_substring(data, 97,32) = 0x000000000000000000000000a452dc8129bc7d39d4d297d3288b5483cf0fedc4 then 'EUR'when bytearray_substring(data, 97,32) = 0x0000000000000000000000003d4a5b0e5c9a641e662b23559d414b36e2d01cd4 then 'GBP'else 'NULL' end