Query editor
WITH fills AS (SELECTdate_trunc('day', block_time) AS day,tx_hash,bytearray_substring(topic2, 13, 20) AS user_id,CASEWHEN bytearray_substring(topic3, 13, 20) = from_hex('e3333700ca9d93003f00f0f71f8515005f6c00aa')THEN 'taker' ELSE 'maker'END AS order_type,(CASE WHEN bytearray_to_uint256(bytearray_substring(data, 1, 32)) = 0THEN cast(bytearray_to_uint256(bytearray_substring(data, 65, 32)) AS double)ELSE cast(bytearray_to_uint256(bytearray_substring(data, 97, 32)) AS double)END) / 1e6 AS amount_usdc,(CASE WHEN bytearray_to_uint256(bytearray_substring(data, 1, 32)) = 0THEN cast(bytearray_to_uint256(bytearray_substring(data, 97, 32)) AS double)ELSE cast(bytearray_to_uint256(bytearray_substring(data, 65, 32)) AS double)END) / 1e6 AS amount_sharesFROM polygon.logsWHERE contract_address = 0xe3333700ca9d93003f00f0f71f8515005f6c00aa -- ExchangeV3 ContractAND topic0 = 0xd543adfd945773f1a62f74f0ee55a5e3b9b1a28262980ba90b1a89f2ea84d8ee -- OrderFilled EventAND block_time >= TIMESTAMP '2026-06-10'AND block_time < CURRENT_DATEAND bytearray_to_uint256(bytearray_substring(data, 33, 1)) = 3 -- combo positions only: V2 tokenId MSB byte == 3 (combinatorial))SELECTday AS date,sum(CASE WHEN order_type = 'taker' THEN amount_shares END) AS volume_notional,sum(CASE WHEN order_type = 'taker' THEN amount_usdc END) AS volume_usdc_taker,count(DISTINCT CASE WHEN order_type = 'taker' THEN tx_hash END) AS trades,count(DISTINCT user_id) AS usersFROM fillsGROUP BY 1ORDER BY 1 DESC