Query editor
selectblock_time,date_trunc('day', block_time) as day,date_trunc('hour', block_time) as day_hour,CAST(date_trunc('minute',block_time)AS TIMESTAMP(0)) as date_min,topic0 as topic0,topic1 as address,topic2 as trace -- trade_hash,bytearray_to_uint256(bytearray_substring(data, 1,32))/1e8 as closePrice,COALESCE(bytearray_to_int256(bytearray_substring(data, 33,32))/1e18,0) - CASE WHEN topic0 = 0x664a65d3a62405ef2c683493b52778675085be44db1631414b5a2918e4f538b2 THEN COALESCE(bytearray_to_int256(bytearray_substring(data, 129,32))/1e18,0) ELSE 0 END as fundingFee,bytearray_to_uint256(bytearray_substring(data, 65,32))/1e18 as closeFee,bytearray_to_int256(bytearray_substring(data, 97,32))/1e18 as pnl,CASE WHEN topic0 = 0x664a65d3a62405ef2c683493b52778675085be44db1631414b5a2918e4f538b2 THEN COALESCE(bytearray_to_int256(bytearray_substring(data, 129,32))/1e18,0) ELSE 0 END as h_fee,tx_hashfrom bnb.logswhere contract_address = 0x1b6f2d3844c6ae7d56ceb3c3643b9060ba28feb0AND ((block_number > 24638880 and topic0 = 0x5fe568f6d99b9b23e2eabf02f546038a30936ddaf9a9fe25c47b85ca046ca8e7) OR(block_number > 29747250 and topic0 = 0x664a65d3a62405ef2c683493b52778675085be44db1631414b5a2918e4f538b2))