From 744387199ecdd8f72dd40f380eb7619d7ea7fa9b Mon Sep 17 00:00:00 2001 From: Theodore Song Date: Sun, 26 Jul 2026 20:10:39 -0400 Subject: [PATCH] Analyze top 5000 active markets --- index.html | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index dca349b..1240020 100644 --- a/index.html +++ b/index.html @@ -739,7 +739,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color @@ -766,7 +766,7 @@ const EXIT_STALE_DAYS = 10; const EXIT_RESOLUTION_DAYS = 2; const AGENTS_KEY = "pma_agents_v2"; const SUG_KEY = "pma_suggestions_v5"; -const SUGGESTION_ENGINE_VERSION = 14; +const SUGGESTION_ENGINE_VERSION = 15; const FOCUS_KEY = "pma_focus_v1"; const VIEW_KEY = "pma_view_v1"; const PF_SORT_KEY = "pma_portfolio_sort_v1"; @@ -995,6 +995,7 @@ const MIN_ENTRY_DAYS=3.0; const EDGE_SCALE=0.13; const MAX_STRATEGY_POSITIONS=16; const MAX_ACTIVE_MARKET_PAGES=1000; +const MARKET_ANALYSIS_LIMIT=5000; const SUGGESTION_TOTAL=900; const SUGGESTION_PER_CATEGORY=180; const VISIBLE_SUGGESTIONS=900; @@ -1057,6 +1058,23 @@ function fairValue(m){const p=m.yes_price,mom=momentumSignal(m),liq=liquiditySig const directional=mom>0.62?(mom-0.62)*0.08:(mom<0.26?(mom-0.26)*0.035:0); const liquidBump=(liq-0.55)*0.012; return clamp(p+directional+liquidBump,0.03,0.97);} +function quickMarketGap(m){ + if(!m||!Number.isFinite(m.yes_price))return 0; + return Math.abs(fairValue(m)-m.yes_price); +} +function marketAnalysisScore(m){ + const activity=Math.log10((m.volume_24hr||0)*8+(m.volume||0)+1); + const liquidity=Math.log10((m.liquidity||0)+1); + const gap=quickMarketGap(m); + const timing=timingSignal(m.days_to_resolution); + return activity*18+liquidity*9+gap*260+timing*8; +} +function selectMarketsForAnalysis(markets,limit=MARKET_ANALYSIS_LIMIT){ + return [...markets] + .filter(m=>m&&m.question&&m.volume>=MIN_SCOUT_VOLUME&&m.liquidity>=MIN_SCOUT_LIQUIDITY) + .sort((a,b)=>marketAnalysisScore(b)-marketAnalysisScore(a)) + .slice(0,limit); +} function timingSignal(d){if(d==null)return 0.4;if(d<1)return 0.1;if(d<=3)return 0.5;if(d<=90)return 1.0-(d-3)/87.0*0.4;return 0.35;} function analyzeMarket(m,realWorldSignals={}){ if(m.volume{const v=localStorage.getItem(k);if(v!=null)items[k]=v;});return compactSyncItems(items);} function applySyncItems(items){ if(!items||typeof items!=="object")return false; @@ -2031,11 +2049,13 @@ async function runDailyCycle(){ SNAP_TS=nowIso(); setStatus("fetching markets…",true); const markets=await fetchMarkets(Infinity,100,count=>setStatus(`fetching all active markets (${count})…`,true)); + const analysisMarkets=selectMarketsForAnalysis(markets); + setStatus(`selected top ${analysisMarkets.length.toLocaleString()} markets for analysis…`,true); setStatus("checking real-world context…",true); - const realWorldSignals=await fetchRealWorldSignals(markets); + const realWorldSignals=await fetchRealWorldSignals(analysisMarkets); setStatus("analyzing expected value…",true); - const sugs=generateSuggestions(markets,SUGGESTION_TOTAL,SUGGESTION_PER_CATEGORY,realWorldSignals); - saveSuggestions(sugs,markets.length); + const sugs=generateSuggestions(analysisMarkets,SUGGESTION_TOTAL,SUGGESTION_PER_CATEGORY,realWorldSignals); + saveSuggestions(sugs,markets.length,analysisMarkets.length); st=loadState(); const emailOffsets=agentHistoryOffsets(st); const focus=getFocus(); @@ -2428,9 +2448,11 @@ function renderSuggestions(){ const filtered=pool.slice(0,VISIBLE_SUGGESTIONS); const buyCount=all.filter(s=>s.trade_ready).length,watchCount=all.length-buyCount; const evAvg=all.length?Math.round(all.reduce((s,x)=>s+Number(x.evidence_score||0),0)/all.length*100):0; + const scanned=Number(data.market_count||0).toLocaleString(); + const analyzed=Number(data.analyzed_count||data.market_count||0).toLocaleString(); $("focusNote").textContent=focus==="All" - ? `Scanned ${Number(data.market_count||0).toLocaleString()} active markets and kept ${all.length} ideas (${buyCount} BUY, ${watchCount} WATCH). Showing ${filtered.length}; agents trade only EV+ ideas after liquidity, chase, and real-world evidence checks. Avg evidence ${evAvg}.` - : `Scanned ${Number(data.market_count||0).toLocaleString()} active markets. Showing ${filtered.length} of ${pool.length} ${focus} ideas; agents only open EV+ BUY ${focus} positions while this is selected.`; + ? `Scanned ${scanned} active markets, analyzed the top ${analyzed} by activity/liquidity/gap, and kept ${all.length} ideas (${buyCount} BUY, ${watchCount} WATCH). Showing ${filtered.length}; agents trade only EV+ ideas after liquidity, chase, and real-world evidence checks. Avg evidence ${evAvg}.` + : `Scanned ${scanned} active markets and analyzed the top ${analyzed}. Showing ${filtered.length} of ${pool.length} ${focus} ideas; agents only open EV+ BUY ${focus} positions while this is selected.`; if(!filtered.length){root.innerHTML=`
No ${esc(focus)} suggestions in this live batch.
`;return;} root.innerHTML=filtered.map(s=>{ const col=catColor(s.category);