Query editor
-- Distribution of Polymarket wallets by average taker bet size — V1 + V2.-- The curated `polymarket_polygon.market_trades` spell already includes V2-- trades; we just expand the IN-list to include both V2 exchange addresses.---- V1 CTF Exchange: 0x4bfb41d5b3570defd03c39a9a4d8de6bd8b8982e-- V1 NegRisk Exchange: 0xc5d563a36ae78145c45a50134d48a1215220f80a-- V2 CTF Exchange: 0xe111180000d2663c0091e4f400237545b87b996b-- V2 NegRisk Exchange: 0xe2222d279d744050d28e00520010520000310f59---- Logic note: `AVG(CASE WHEN ... THEN shares END)` correctly averages only-- over taker-side rows (CASE returns NULL otherwise, and AVG skips nulls).-- The HAVING clause excludes wallets that never appeared as takers.-- Refactored to compute the CASE once per row to avoid repeating the IN-list.WITH user_taker_shares AS (SELECTmaker AS user_address,CASE WHEN taker IN (0x4bfb41d5b3570defd03c39a9a4d8de6bd8b8982e,0xc5d563a36ae78145c45a50134d48a1215220f80a,0xe111180000d2663c0091e4f400237545b87b996b,0xe2222d279d744050d28e00520010520000310f59) THEN shares END AS taker_sharesFROM polymarket_polygon.market_tradesWHERE block_month >= DATE '2024-01-01'),user_avg_bet AS (SELECTuser_address,AVG(taker_shares) AS avg_bet_notionalFROM user_taker_sharesGROUP BY 1HAVING AVG(taker_shares) IS NOT NULL),bucketed AS (SELECTCASEWHEN avg_bet_notional <= 10 THEN '01: $0-$10'WHEN avg_bet_notional <= 50 THEN '02: $10-$50'WHEN avg_bet_notional <= 100 THEN '03: $50-$100'WHEN avg_bet_notional <= 500 THEN '04: $100-$500'WHEN avg_bet_notional <= 1000 THEN '05: $500-$1k'WHEN avg_bet_notional <= 5000 THEN '06: $1k-$5k'WHEN avg_bet_notional <= 10000 THEN '07: $5k-$10k'WHEN avg_bet_notional <= 50000 THEN '08: $10k-$50k'WHEN avg_bet_notional <= 100000 THEN '09: $50k-$100k'ELSE '10: $100k+'END AS avg_bet_bucketFROM user_avg_bet)SELECTavg_bet_bucket,COUNT(*) AS num_wallets,ROUND(COUNT(*) * 1.0 / SUM(COUNT(*)) OVER (), 4) AS pct_of_totalFROM bucketedGROUP BY 1ORDER BY 1