Query editor
-- ============================================================-- Polymarket Private Lending — V3 MAX下界 用户明细---- 口径:MAX(YES, NO) per market per user-- 业务依据:保守假设每个市场只有较大一边可以抵押-- Cutoff:$50K-- ============================================================WITHLongTermTrades AS (SELECTcondition_id,maker,amount,token_outcome,question,event_market_nameFROM polymarket_polygon.market_tradesWHEREblock_time >= NOW() - INTERVAL '90' dayAND event_market_name NOT LIKE '%Up or Down%'AND question NOT LIKE '%Up or Down%'AND maker NOT IN (0xc5d563a36ae78145c45a50134d48a1215220f80a,0x4bfb41d5b3570defd03c39a9a4d8de6bd8b8982e)),MaxPositions AS (SELECTmaker AS user_address,condition_id,question,SUM(CASE WHEN token_outcome IN ('Yes', 'Up')THEN amount ELSE 0 END) AS yes_amount,SUM(CASE WHEN token_outcome IN ('No', 'Down')THEN amount ELSE 0 END) AS no_amount,GREATEST(SUM(CASE WHEN token_outcome IN ('Yes', 'Up') THEN amount ELSE 0 END),SUM(CASE WHEN token_outcome IN ('No', 'Down') THEN amount ELSE 0 END)) AS max_exposureFROM LongTermTradesGROUP BY maker, condition_id, question),UserProfile AS (SELECTuser_address,SUM(max_exposure) AS total_max_exposure,COUNT(DISTINCT condition_id) AS markets_played,SUM(yes_amount) AS total_yes_amount,SUM(no_amount) AS total_no_amount,SUM(yes_amount) / NULLIF(SUM(yes_amount) + SUM(no_amount), 0) AS yes_ratioFROM MaxPositionsGROUP BY user_addressHAVING SUM(max_exposure) > 50000),