Query editor
WITH events_data AS (SELECTblock_time,bytearray_to_uint256(data[5]) AS product_id,bytearray_to_uint256(data[6]) AS amount,bytearray_to_uint256(data[7]) AS priceFROM starknet.eventsWHEREfrom_address = FROM_HEX('0422d33a3638dcc4c62e72e1d6942cd31eb643ef596ccac2351e0e21f6cd4bf4')AND block_number > cast('652696' as BIGINT)AND (CONTAINS(keys, FROM_HEX('0x02df90525e8a75383064e68e37c015a4ed0f4156903c24f300427a6be559f4d8'))OR CONTAINS(keys, FROM_HEX('0x0299d12261db430d6d61be5a1833a6080b96cdfebebbacbe89d8ff3c0cebf599'))))SELECTe.block_time as "Date",SUM(cast(e.amount as BIGINT)) AS Quantity,sum(e.amount * e.price / POWER(10, 6)) / SUM(e.amount) as Price,sum(cast(e.amount * e.price / POWER(10, 6) as BIGINT)) as "Total SWAY",p.name AS product_nameFROM events_data eJOIN dune.brakmaar.dataset_influence_products p ON cast(e.product_id as varchar) = p.idWHERE e.product_id = {{product_id}}GROUP BY e.block_time, p.nameORDER BY e.block_time DESC