From 5481afebd24c86559c33a8f6c8c162b66ade1c9e Mon Sep 17 00:00:00 2001 From: Theodore Song Date: Wed, 15 Jul 2026 22:33:14 -0400 Subject: [PATCH] Fetch all active markets across modes --- index.html | 71 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index a448404..ef2a04f 100644 --- a/index.html +++ b/index.html @@ -677,7 +677,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color

The hourly cycle

    -
  1. Fetch — page through hundreds of live markets and tag each by category.
  2. +
  3. Fetch — page through every active Polymarket market and tag each by category.
  4. Score — rank every market 0–100 by conviction and estimate its edge vs. a fair-value model.
  5. Suggest — surface the strongest picks per category with a plain-English rationale.
  6. Compete — the strategy agents trade the same suggestions their own way, stop-loss weak positions, scale out through gain-stop tiers, exit stale or fading trades, then snapshot equity.
  7. @@ -896,14 +896,17 @@ function normalizeMarket(raw){ days_to_resolution:daysUntil(raw.endDate),image:raw.image||"", url:ev.slug?`https://polymarket.com/event/${ev.slug}`:""}; } -async function fetchMarkets(pages=4,perPage=100){ +async function fetchMarkets(pages=Infinity,perPage=100,onProgress=null){ const all=[]; - for(let i=0;im&&m.question); } @@ -1591,7 +1594,7 @@ async function runDailyCycle(){ SNAP_TS=nowIso(); setStatus("fetching markets…",true); try{ - const markets=await fetchMarkets(10,100); + const markets=await fetchMarkets(Infinity,100,count=>setStatus(`fetching all active markets (${count})…`,true)); setStatus("analyzing…",true); const sugs=generateSuggestions(markets); saveSuggestions(sugs); @@ -2487,21 +2490,29 @@ async function searchPaperMarkets(){ PAPER_MARKET_OFFSET=0;PAPER_MARKET_QUERY=q; await loadPaperMarketPage(true); } -async function loadPaperMarketPage(reset=false){ +async function loadPaperMarketPage(reset=false,loadAll=false){ const q=PAPER_MARKET_QUERY||(($("paperSearchInput")&&$("paperSearchInput").value)||"").trim(); setStatus("searching Polymarket...",true); try{ if(reset){PAPER_SEARCH_RESULTS=[];PAPER_MARKET_OFFSET=0;} - const params=new URLSearchParams({closed:"false",active:"true",archived:"false",include_tag:"true",limit:"100",offset:String(PAPER_MARKET_OFFSET),order:"volume24hr",ascending:"false"}); - if(q)params.set("search",q); - const r=await fetch(`${GAMMA}/markets?${params}`); - if(!r.ok)throw new Error("market load failed"); - const raw=await r.json(); - const next=raw.map(normalizeMarket).filter(Boolean).map(paperTradeFromMarket); - PAPER_SEARCH_RESULTS=(PAPER_SEARCH_RESULTS||[]).concat(next); - PAPER_MARKET_OFFSET+=raw.length; + let loaded=0,rawCount=0,keepGoing=true; + const limit=100,maxPages=loadAll?250:1; + for(let page=0;pagepaperMoveCash("deposit",$("pap $("paperWithdrawBtn").addEventListener("click",()=>paperMoveCash("withdraw",$("paperMoneyAmount").value,$("paperPasswordInput").value)); $("buyAgentBtn").addEventListener("click",()=>paperBuyAgent($("buyAgentSelect").value,$("buyAgentAmount").value)); $("paperSearchBtn").addEventListener("click",()=>searchPaperMarkets()); -$("paperAllBtn").addEventListener("click",()=>{PAPER_MARKET_QUERY="";PAPER_SEARCH_RESULTS=[];loadPaperMarketPage(true);}); +$("paperAllBtn").addEventListener("click",()=>{PAPER_MARKET_QUERY="";PAPER_SEARCH_RESULTS=[];loadPaperMarketPage(true,true);}); $("paperMoreBtn").addEventListener("click",()=>loadPaperMarketPage(false)); $("paperClearSearchBtn").addEventListener("click",()=>{PAPER_SEARCH_RESULTS=null;PAPER_MARKET_OFFSET=0;PAPER_MARKET_QUERY="";renderPaperTab();}); $("paperLoginBtn").addEventListener("click",async()=>{ @@ -3078,7 +3097,7 @@ $("personalWithdrawBtn").addEventListener("click",()=>personalCapitalAction("WIT $("personalBuyAgentBtn").addEventListener("click",()=>personalCapitalAction("BUY_AGENT")); $("personalSellAgentBtn").addEventListener("click",()=>personalCapitalAction("SELL_AGENT")); $("liveSearchBtn").addEventListener("click",()=>searchLiveMarkets()); -$("liveAllBtn").addEventListener("click",()=>{LIVE_MARKET_QUERY="";LIVE_SEARCH_RESULTS=[];loadLiveMarketPage(true);}); +$("liveAllBtn").addEventListener("click",()=>{LIVE_MARKET_QUERY="";LIVE_SEARCH_RESULTS=[];loadLiveMarketPage(true,true);}); $("liveMoreBtn").addEventListener("click",()=>loadLiveMarketPage(false)); $("liveClearSearchBtn").addEventListener("click",()=>{LIVE_SEARCH_RESULTS=[];LIVE_MARKET_OFFSET=0;LIVE_MARKET_QUERY="";renderLiveMarkets();}); $("recordConsentBtn").addEventListener("click",()=>recordLiveConsent());