Query editor
WITHdays AS (SELECTdayFROMreservoir.salesCROSS JOIN UNNEST (SEQUENCE(TRY_CAST(MIN(CAST(tx_timestamp AS TIMESTAMP)) AS DATE),TRY_CAST(MAX(CAST(tx_timestamp AS TIMESTAMP)) AS DATE),INTERVAL '1' day) /* WARNING: Check out the docs for example of time series generation: https://dune.com/docs/query/syntax-differences/ */) AS _u (day)WHEREcontract = {{address}}),q AS (SELECTTRY_CAST(CAST(tx_timestamp AS TIMESTAMP) AS DATE) AS day,SUM(price / CAST(1e18 AS DOUBLE)) AS volume,AVG(price / amount / CAST(1e18 AS DOUBLE)) AS avg_price,COUNT(order_source = 'opensea.io'OR NULL) AS order_source_opensea,COUNT(order_source = 'looksrare.org'OR NULL) AS order_source_looksrare,COUNT(order_source = 'blur.io'OR NULL) AS order_source_blur,COUNT(NOT order_source IN ('opensea.io', 'looksrare.org', 'blur.io')OR NULL) AS order_source_others,COUNT(fill_source = 'opensea.io'OR NULL) AS fill_source_opensea,COUNT(fill_source = 'looksrare.org'OR NULL) AS fill_source_looksrare,COUNT(fill_source = 'blur.io'OR NULL) AS fill_source_blur,COUNT(fill_source = 'gem.xyz'OR NULL) AS fill_source_gem,COUNT(NOT fill_source IN ('opensea.io','looksrare.org','blur.io','gem.xyz')