Query editor
WITH data AS (SELECTblock_month AS month,sum(t.amount) as vol_usd,count (distinct tx_hash) as trx-- t.tx_hash,-- t.shares,-- t.fee,-- t.maker,-- t.taker,-- t.amountFROM polymarket_polygon.market_trades twhere t.maker NOT IN (0xC5d563A36AE78145C45a50134d48A1215220f80a,0xe2222d279d744050d28e00520010520000310F59)AND t.taker NOT IN (0xC5d563A36AE78145C45a50134d48A1215220f80a,0xe2222d279d744050d28e00520010520000310F59)and is_taker_sidegroup by 1-- SELECT date_trunc('month', evt_block_time) AS time-- , SUM(IF(makerAssetId=0, takerAmountFilled, makerAmountFilled))/1e6 AS volume,-- count(distinct evt_tx_hash) as orders-- FROM polymarket_polygon.ctfexchange_evt_orderfilled-- WHERE evt_block_time >= date_trunc('month', NOW() - interval '3' year)-- -- AND evt_block_time < date_trunc('month', NOW())-- GROUP BY 1-- UNION ALL-- SELECT date_trunc('month', evt_block_time) AS time-- , SUM(IF(makerAssetId=0, takerAmountFilled, makerAmountFilled))/1e6 AS volume,-- count(distinct evt_tx_hash) as orders-- FROM polymarket_polygon.negriskctfexchange_evt_orderfilled-- WHERE evt_block_time >= date_trunc('month', NOW() - interval '3' year)-- -- AND evt_block_time < date_trunc('month', NOW())-- GROUP BY 1)select*,sum(vol_usd) over (order by month) as cumu_vol_usd,sum(trx) over (order by month) as cumu_betsfrom dataorder by 1 desc-- with markets as-- (-- select fixedProductMarketMaker-- from polymarketfactory_polygon.FixedProductMarketMakerFactory_evt_FixedProductMarketMakerCreation-- where collateralToken = 0x2791bca1f2de4661ed88a30c99a7a9449aa84174-- ), all_vol as-- (-- select block_time As evt_block_time