Broaden audited adaptive settlement windows

This commit is contained in:
Theodore Song
2026-08-21 19:19:40 -04:00
parent c0ce373833
commit a01571d5ee
8 changed files with 156 additions and 87 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ jobs:
- run: node scripts/run-autonomous-cycle.mjs
env:
ARENA_URL: https://polymarket-site-eta.vercel.app
EXPECTED_BUILD: "96"
EXPECTED_BUILD: "97"
RUNTIME_BRANCH: runtime-state
RUNTIME_STATE_PATH: runtime/state.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+15 -13
View File
@@ -20,7 +20,7 @@ market snapshots. During an outage, cycles continue locally; cached entries are
allowed for 90 minutes, older snapshots become mark-only, and all cached data
expires after 24 hours.
Build 96 runs the headless GitHub Actions runtime every 15 minutes, continues
Build 97 runs the headless GitHub Actions runtime every 15 minutes, continues
from the previous agent snapshot,
and runs the next due paper cycle even when no browser is open. It writes a
sanitized snapshot to the `runtime-state` branch and `/api/state` uses that as a
@@ -41,9 +41,9 @@ Polymarket event key. Related Ethereum or Bitcoin contracts cannot create
several simultaneous copies of one move, and outcomes from the same underlying
three-hour shock window count as one learner event.
Build 96 adds a separate current-regime resolution-window NO pilot for
Build 97 expands the separate current-regime resolution-window NO pilot for
the five aggressive agents. It accepts only non-sports, fixed-date contracts
inside validated 2.5-3.5 day or 6.5-7.5 day windows, with the NO midpoint from 50%-55%, at least $15,000 total
inside validated 2.5-3.5, 3.5-4.5, 4.5-5.5, or 5.5-6.5 day windows, with the NO midpoint from 50%-55%, at least $15,000 total
volume, $1,400 liquidity, and no more than a three-cent spread. The entry uses
the executable NO ask plus 0.25 cents of slippage and rejects more than one cent
of entry friction. Initial positions are 0.5% of equity, one new position per
@@ -55,16 +55,18 @@ pilot loss disables the lane for every adopter, and ten convincingly losing
events disable only their exact holding horizon. Forty events with a positive
lower confidence bound above 1% can raise position size to 1%.
The frozen recent audit used 2,916 resolved markets and a one-cent cost. At
three days, the exact 50%-55% NO rule covered 158 event clusters with a 33.24%
event mean and 25.52% lower 90% bound; train and holdout lower bounds were
19.32% and 27.27%. At seven days, 114 event clusters produced a 38.21% event
mean and 31.25% lower bound; train and holdout lower bounds were 30.58% and
23.77%. The one, fourteen, thirty, and ninety-day windows failed or lacked
enough data and remain disabled. Contemporaneous historical liquidity cannot
be reconstructed, so production adds live spread and liquidity gates and
remains a bounded, automatically demoted paper pilot rather than a claim of
durable or guaranteed profit.
The corrected production-matched audit used 2,954 of 3,000 recent resolved
markets and a one-cent cost. It excludes Sports and the same path-dependent
barrier and range contracts rejected by production. At three, four, five, and
six days, the exact 50%-55% NO rule covered 121, 144, 104, and 86 independent
event clusters. Event mean returns were 24.52%, 38.15%, 36.86%, and 43.94%,
with lower 90% bounds of 15.78%, 31.40%, 29.39%, and 37.67%. Every retained
horizon had positive train, holdout, and chronological-segment lower bounds.
Two days failed holdout. Seven and ten days lost a segment confidence test;
other longer windows were not retained. Contemporaneous historical liquidity
cannot be reconstructed, so production adds live spread and liquidity gates
and remains a bounded, automatically demoted paper pilot rather than a claim
of durable or guaranteed profit.
Build 94 also closes the contract-safety hole exposed by the first Strategy 3
paper positions. Shock Strategy 4 keeps the same audited accelerating
+36 -22
View File
@@ -341,7 +341,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color
<nav class="topnav">
<div class="brand">
<div class="logo">🏆</div>
<div><div class="brand-name">Polymarket Arena</div><div class="brand-sub">10 agents · 5 core + 5 aggressive</div><div class="build-badge">Adaptive strategy 59 · resolution-window pilot 1 · build 96</div></div>
<div><div class="brand-name">Polymarket Arena</div><div class="brand-sub">10 agents · 5 core + 5 aggressive</div><div class="build-badge">Adaptive strategy 59 · resolution-window pilot 2 · build 97</div></div>
</div>
<div class="tabs" id="tabs">
<button class="tab" data-tab="overview">Overview</button>
@@ -363,7 +363,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color
<div class="personal-banner" id="personalBanner">
<b>Personal research mode.</b> This copy is for your own analysis, paper tracking, and manual trade research only. It does not pool money, onboard investors, custody funds, bypass eligibility rules, or place orders without your manual approval.
</div>
<div class="live-build-banner"><b>Build 96 active:</b> The public paper agents run autonomously every 15 minutes while every user device is closed. Five aggressive agents can take tightly bounded, fixed-date 5055% NO positions only in independently passing three-day or seven-day settlement windows. Entries use an executable ask plus slippage, one agent owns each event, positions hold to verified settlement, and each horizon can demote itself from losing forward evidence. Other unproven directional rules remain observation-only. Phones and computers display the same read-only autonomous state. Profits are not guaranteed.</div>
<div class="live-build-banner"><b>Build 97 active:</b> The public paper agents run autonomously every 15 minutes while every user device is closed. Five aggressive agents can take tightly bounded, safe non-Sports 5055% NO positions in independently passing three-through-six-day settlement windows. Entries use an executable ask plus slippage, one agent owns each event, positions hold to verified settlement, and every exact horizon can demote itself from losing forward evidence. Other unproven directional rules remain observation-only. Phones and computers display the same read-only autonomous state. Profits are not guaranteed.</div>
<!-- ============ OVERVIEW ============ -->
<section class="tabpanel" data-tab="overview">
@@ -745,7 +745,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color
</section>
<footer>
Build 96 · Adaptive strategy 59 · Resolution-window pilot 1 · Validated 3d/7d entries · Executable 5055% NO pricing · Settlement-only exits · Per-horizon forward demotion · Autonomous runtime 1 · Offline runtime 2 · Maker research 3 · Agent learning 3 · Paper trading only · Live prices from Polymarket's public Gamma and CLOB APIs · Not financial advice ·
Build 97 · Adaptive strategy 59 · Resolution-window pilot 2 · Validated 3d6d entries · Executable 5055% NO pricing · Settlement-only exits · Per-horizon forward demotion · Autonomous runtime 1 · Offline runtime 2 · Maker research 3 · Agent learning 3 · Paper trading only · Live prices from Polymarket's public Gamma and CLOB APIs · Not financial advice ·
<a class="market-link" href="https://github.com/theodore-song/polymarket-analyst" target="_blank" rel="noopener">Source on GitHub</a>
</footer>
</div>
@@ -774,12 +774,12 @@ const POLITICS_TREND_MIN_HOLD_HOURS = 72;
const EXIT_CONFIRM_HOURS = 6;
const AGENTS_KEY = "pma_agents_v2";
const SUG_KEY = "pma_suggestions_v5";
const BUILD_VERSION = 96;
const BUILD_VERSION = 97;
const AGENT_LEARNING_VERSION = 3;
const SUGGESTION_ENGINE_VERSION = 59;
const MAKER_STRATEGY_VERSION = 3;
const SHOCK_FADE_STRATEGY_VERSION = 4;
const RESOLUTION_WEEK_NO_STRATEGY_VERSION = 1;
const RESOLUTION_WEEK_NO_STRATEGY_VERSION = 2;
const PREVIOUS_STRATEGY_VERSION = 58;
const DIRECTIONAL_SIGNAL_POLICY_VERSION = 1;
const DIRECTIONAL_SIGNAL_COMPATIBLE_STRATEGY_MIN = 51;
@@ -1306,7 +1306,16 @@ const SHOCK_FADE_HISTORY_CACHE_MS=10*60*1000;
const SHOCK_FADE_BACKTEST_APPROVED=false;
const SHOCK_FADE_ADOPTER_IDS=new Set(["catalyst","reversal","breakout","tailalpha","conviction"]);
const RESOLUTION_WEEK_NO_ADOPTER_IDS=new Set(["catalyst","reversal","breakout","tailalpha","conviction"]);
const RESOLUTION_WEEK_NO_WINDOWS=Object.freeze([{days:3,min:2.5,max:3.5},{days:7,min:6.5,max:7.5}]);
const RESOLUTION_WEEK_NO_WINDOWS=Object.freeze([
{days:3,min:2.5,max:3.5},{days:4,min:3.5,max:4.5},
{days:5,min:4.5,max:5.5},{days:6,min:5.5,max:6.5},
]);
const RESOLUTION_WEEK_NO_AUDIT=Object.freeze({
3:{events:121,eventMean:0.2452,lower:0.1578,trainEvents:85,trainLower:0.1315,holdoutEvents:40,holdoutLower:0.0991},
4:{events:144,eventMean:0.3815,lower:0.3140,trainEvents:102,trainLower:0.3032,holdoutEvents:47,holdoutLower:0.2717},
5:{events:105,eventMean:0.3686,lower:0.2939,trainEvents:77,trainLower:0.2687,holdoutEvents:30,holdoutLower:0.3001},
6:{events:87,eventMean:0.4394,lower:0.3767,trainEvents:60,trainLower:0.3309,holdoutEvents:29,holdoutLower:0.4368},
});
const RESOLUTION_WEEK_NO_MIN_ENTRY=0.50;
const RESOLUTION_WEEK_NO_MAX_ENTRY=0.55;
const RESOLUTION_WEEK_NO_MAX_EXECUTABLE_ENTRY=0.56;
@@ -1484,9 +1493,7 @@ function resolutionWeekNoSuggestion(m){
const executionCost=Math.max(0,modeledEntry-marketPrice);
if(modeledEntry>RESOLUTION_WEEK_NO_MAX_EXECUTABLE_ENTRY||executionCost>RESOLUTION_WEEK_NO_MAX_EXECUTION_COST+0.00001)return null;
const eventKey=String(m.event_id||m.event||m.id),conviction=+clamp(72+Math.log10(Math.max(1,m.volume_24hr||m.volume))*1.2+Math.log10(Math.max(1,m.liquidity)),72,82).toFixed(1);
const audit=window.days===3
?{events:158,eventMean:0.3324,lower:0.2552,trainEvents:102,trainLower:0.1932,holdoutEvents:58,holdoutLower:0.2727}
:{events:114,eventMean:0.3821,lower:0.3125,trainEvents:79,trainLower:0.3058,holdoutEvents:35,holdoutLower:0.2377};
const audit=RESOLUTION_WEEK_NO_AUDIT[window.days];
return {market_id:m.id,question:m.question,event:m.event,event_key:eventKey,url:m.url,category:m.category,tags:m.tags,
clob_yes:(m.clob_token_ids||[])[0]||null,clob_no:(m.clob_token_ids||[])[1]||null,
yes_price:m.yes_price,no_price:m.no_price,fair_value:+modeledEntry.toFixed(4),edge:0,net_edge:0,
@@ -1499,7 +1506,7 @@ function resolutionWeekNoSuggestion(m){
pilot_prior:{recent_markets:2916,recent_events:audit.events,recent_event_mean:audit.eventMean,recent_event_lower_90:audit.lower,
train_events:audit.trainEvents,train_lower_90:audit.trainLower,holdout_events:audit.holdoutEvents,holdout_lower_90:audit.holdoutLower,modeled_cost_cents:1,regime_specific:true},
drivers:[`validated ${window.days}-day settlement window`,"NO midpoint is 5055%","executable NO ask plus 0.25c slippage","one owner per event","hold to verified settlement"],
rationale:`Bounded current-regime pilot: NO is priced at ${pct(marketPrice)} for a fixed-date contract resolving in ${days.toFixed(1)} days, inside the independently passing ${window.days}-day window. The modeled entry is ${pct(modeledEntry)} using the executable NO ask plus 0.25-cent slippage, ${(executionCost*100).toFixed(2)} cents above midpoint. In the most recent 2,916 resolved-market replay at one-cent cost, the exact 5055% NO rule covered ${audit.events} ${window.days}-day event clusters with a ${(audit.eventMean*100).toFixed(2)}% event mean and ${(audit.lower*100).toFixed(2)}% lower 90% bound; chronological train and holdout bounds were ${(audit.trainLower*100).toFixed(2)}% and ${(audit.holdoutLower*100).toFixed(2)}%. Historical liquidity at the decision point cannot be reconstructed, so this remains a 0.5% paper pilot with live liquidity gates, one owner per event, a 3% total cap, settlement-only exits, and automatic per-horizon forward demotion.`};
rationale:`Bounded current-regime pilot: NO is priced at ${pct(marketPrice)} for a safe non-Sports contract resolving in ${days.toFixed(1)} days, inside the independently passing ${window.days}-day window. The modeled entry is ${pct(modeledEntry)} using the executable NO ask plus 0.25-cent slippage, ${(executionCost*100).toFixed(2)} cents above midpoint. In the most recent 2,954 resolved-market replay at one-cent cost, the exact production-matched 5055% NO rule covered ${audit.events} ${window.days}-day event clusters with a ${(audit.eventMean*100).toFixed(2)}% event mean and ${(audit.lower*100).toFixed(2)}% lower 90% bound; chronological train and holdout bounds were ${(audit.trainLower*100).toFixed(2)}% and ${(audit.holdoutLower*100).toFixed(2)}%. Historical liquidity at the decision point cannot be reconstructed, so this remains a 0.5% paper pilot with live liquidity gates, one owner per event, a 3% total cap, settlement-only exits, and automatic per-horizon forward demotion.`};
}
function sportsFavoriteLeadHours(item){return hoursUntil(item&&item.game_start);}
function sportsFavoritePilotSuggestion(m){
@@ -4011,7 +4018,7 @@ async function runDailyCycle(){
.forEach(row=>claimedResolutionWeekEvents.add(String(row.event_key||row.market_id)));
if(RESOLUTION_WEEK_NO_ADOPTER_IDS.has(cfg.id)){
p.lastDecision=Object.assign({},p.lastDecision,{resolutionWeekNoPilot:sharedResolutionWeekProfile});
p.lastDecision.allocationStatus=`${p.lastDecision.allocationStatus||""} Resolution-window NO pilot: shared state ${sharedResolutionWeekProfile.state}, ${sharedResolutionWeekProfile.events} settled events, ${(sharedResolutionWeekProfile.position_pct*100).toFixed(2)}% position cap and ${RESOLUTION_WEEK_NO_TOTAL_CAPITAL_PCT*100}% total cap; only validated 3d/7d windows can trade, one agent owns each event, and positions hold to verified settlement.`.trim();
p.lastDecision.allocationStatus=`${p.lastDecision.allocationStatus||""} Resolution-window NO pilot: shared state ${sharedResolutionWeekProfile.state}, ${sharedResolutionWeekProfile.events} settled events, ${(sharedResolutionWeekProfile.position_pct*100).toFixed(2)}% position cap and ${RESOLUTION_WEEK_NO_TOTAL_CAPITAL_PCT*100}% total cap; only validated 3d6d windows can trade, one agent owns each event, and positions hold to verified settlement.`.trim();
}
if(SHOCK_FADE_ADOPTER_IDS.has(cfg.id)){
(p.positions||[]).filter(row=>row.signal_type==="shock-fade-pilot"&&Number(row.shock_strategy_version||0)===SHOCK_FADE_STRATEGY_VERSION)
@@ -4247,15 +4254,15 @@ function decisionSummary(p){
const maker=d.makerQuotes!=null?` Maker research: ${d.makerShadowActive||0} zero-capital lock-or-exit observations active; ${d.makerFills||0} verified touches and ${d.makerShadowCompleted||0} outcomes completed this cycle.${makerStats?` Event-clustered ledger: ${makerStats.attempts} attempts / ${makerStats.events} events, ${makerStats.locked} locked pairs, ${makerStats.adverse} immediate adverse exits, ${makerStats.unfilled} unfilled, and ${fmtUSD(makerStats.shadow_pnl)} simulated shadow net.`:""} Capital is disabled because neither the 6,048-rule chronological maker audit nor the reward stress test produced a validated holdout winner. Hypothetical rewards are excluded.`:"";
const sportsPilot=d.sportsFavoritePilot?` Sports forward learner: ${d.sportsFavoritePilot.state}, ${d.sportsFavoritePilot.active_shadows||0} zero-capital observations active and ${d.sportsFavoritePilot.events} independent closed events, ${d.sportsFavoritePilot.events?`${(d.sportsFavoritePilot.mean*100).toFixed(2)}% mean with ${d.sportsFavoritePilot.lower>=0?"+":""}${(d.sportsFavoritePilot.lower*100).toFixed(2)}% to ${d.sportsFavoritePilot.upper>=0?"+":""}${(d.sportsFavoritePilot.upper*100).toFixed(2)}% 90% interval; `:""}${fmtUSD(d.sportsFavoritePilot.shadow_pnl_per_100||0)} simulated per-$100 net and ${fmtUSD(d.sportsFavoritePilot.pnl)} realized capital P&L. Position cap ${(d.sportsFavoritePilot.position_pct*100).toFixed(2)}%; capital remains zero until ${SPORTS_FAVORITE_PROMOTION_EVENTS} new independent events establish a positive lower bound.`:"";
const shockPilot=d.shockFadePilot?` Shared shock strategy ${SHOCK_FADE_STRATEGY_VERSION}: ${d.shockFadePilot.state}, ${d.shockFadePilot.active_shadows||0} ${SHOCK_FADE_EXIT_HOURS}-hour observations active and ${d.shockFadePilot.events} deduplicated forward events complete across five adopters. Mean ${(d.shockFadePilot.mean*100).toFixed(2)}%; 90% interval ${(d.shockFadePilot.lower*100).toFixed(2)}% to ${(d.shockFadePilot.upper*100).toFixed(2)}%; ${d.shockFadePilot.expired_ungraded||0} missed windows were discarded. Position cap ${(d.shockFadePilot.position_pct*100).toFixed(2)}%, total cap ${SHOCK_FADE_TOTAL_CAPITAL_PCT*100}%; ${SHOCK_FADE_QUALIFICATION_EVENTS} positive events can qualify 1% capital and ${SHOCK_FADE_PROMOTION_EVENTS} stronger events can raise size to ${SHOCK_FADE_PROMOTED_POSITION_PCT*100}%.`:"";
const resolutionWeek=d.resolutionWeekNoPilot?` Resolution-window NO pilot: ${d.resolutionWeekNoPilot.state}, ${d.resolutionWeekNoPilot.events} shared settled events, ${(d.resolutionWeekNoPilot.mean*100).toFixed(2)}% mean and ${(d.resolutionWeekNoPilot.lower*100).toFixed(2)}% lower 90% bound. Position cap ${(d.resolutionWeekNoPilot.position_pct*100).toFixed(2)}%, total cap ${RESOLUTION_WEEK_NO_TOTAL_CAPITAL_PCT*100}%; only validated 3d/7d windows can trade, each horizon adapts separately, one agent owns each event, and every position holds to verified settlement.`:"";
const resolutionWeek=d.resolutionWeekNoPilot?` Resolution-window NO pilot: ${d.resolutionWeekNoPilot.state}, ${d.resolutionWeekNoPilot.events} shared settled events, ${(d.resolutionWeekNoPilot.mean*100).toFixed(2)}% mean and ${(d.resolutionWeekNoPilot.lower*100).toFixed(2)}% lower 90% bound. Position cap ${(d.resolutionWeekNoPilot.position_pct*100).toFixed(2)}%, total cap ${RESOLUTION_WEEK_NO_TOTAL_CAPITAL_PCT*100}%; only validated 3d6d windows can trade, each horizon adapts separately, one agent owns each event, and every position holds to verified settlement.`:"";
return `${d.mode} mode: ${d.reason}${emotion} Limits now: ${d.maxNew} new trade${d.maxNew===1?"":"s"}, max ${(d.maxFrac*100).toFixed(1)}% per position${d.minConv?`, conviction ${d.minConv}+`:""}.${learning}${calibration}${maker}${sportsPilot}${shockPilot}${resolutionWeek}${exposure}${allocation}${candidates}${blockers}`;
}
function renderAgentBrief(cfg,p,st){
const root=$("agentBrief"); if(!root)return;
const bw=bestAndWorst(p);
const risk=cfg.aggressive?"Extreme risk":cfg.maxFrac>=0.055?"Active":cfg.maxFrac<=0.04?"Broad active":"Disciplined";
const cadence=cfg.id==="favorite"?"Zero-capital 12h sports observations until 30 forward events promote 1.25% positions":RESOLUTION_WEEK_NO_ADOPTER_IDS.has(cfg.id)?`One bounded 3d/7d resolution-window NO entry per cycle; ${RESOLUTION_WEEK_NO_TOTAL_CAPITAL_PCT*100}% total cap plus zero-capital shock research`:`${cfg.maxNew||0} new trades max per cycle`;
const exitRule=cfg.id==="favorite"?"Grade shadow observations only when Polymarket closes the market; after promotion, capital positions retain the 18% stop and profit locks":RESOLUTION_WEEK_NO_ADOPTER_IDS.has(cfg.id)?`Hold 3d/7d resolution-window positions to verified settlement; exit shock positions at the executable bid after ${SHOCK_FADE_EXIT_HOURS} hours and discard missed grading windows`
const cadence=cfg.id==="favorite"?"Zero-capital 12h sports observations until 30 forward events promote 1.25% positions":RESOLUTION_WEEK_NO_ADOPTER_IDS.has(cfg.id)?`One bounded 3d6d resolution-window NO entry per cycle; ${RESOLUTION_WEEK_NO_TOTAL_CAPITAL_PCT*100}% total cap plus zero-capital shock research`:`${cfg.maxNew||0} new trades max per cycle`;
const exitRule=cfg.id==="favorite"?"Grade shadow observations only when Polymarket closes the market; after promotion, capital positions retain the 18% stop and profit locks":RESOLUTION_WEEK_NO_ADOPTER_IDS.has(cfg.id)?`Hold 3d6d resolution-window positions to verified settlement; exit shock positions at the executable bid after ${SHOCK_FADE_EXIT_HOURS} hours and discard missed grading windows`
:`Exit after a confirmed reversal, a 12h unconfirmed fade after 48h, a trailing-profit retrace, or ${EXIT_STALE_DAYS}d stale while losing; Politics trends get 72h before ordinary signal exits`;
const thesis=agentPlainBlurb(cfg,st);
const quoteSummary=(p.maker_quotes||[]).slice(0,3).map(quote=>`${quote.shadow_only?"Shadow":"Capital"} · ${quote.question.slice(0,34)}${quote.question.length>34?"...":""}: YES ${pct(quote.yes_quote)} + NO ${pct(quote.no_quote)}${quote.yes_filled_at||quote.no_filled_at?" (one leg touched)":""}`).join("; ");
@@ -5938,7 +5945,7 @@ window.PMA_ENGINE_DIAGNOSTICS=Object.freeze({
maximumExecutableEntry:RESOLUTION_WEEK_NO_MAX_EXECUTABLE_ENTRY,
adopterAgentIds:[...RESOLUTION_WEEK_NO_ADOPTER_IDS],backtestApproved:RESOLUTION_WEEK_NO_BACKTEST_APPROVED,
fixedDateOnly:true,sportsExcluded:true,settlementOnlyExit:true,oneOwnerPerEvent:true,sharedForwardDemotion:true},
historicalPrior:"No broad directional rule survived the adaptive holdouts at both 24h and 72h. Contract-safe Shock Strategy 4 remains zero-capital after its untouched expansion failed. A separate current-regime 50%-55% NO rule passed exact three-day and seven-day chronological audits at one-cent modeled cost; one-day, fourteen-day, thirty-day, and ninety-day windows failed or lacked evidence and remain disabled. Contemporaneous historical liquidity cannot be reconstructed, so only live, fixed-date, non-sports contracts in the passing windows that clear spread and liquidity gates receive 0.5% paper positions, one owner per event, a 3% cap, settlement-only exits, and automatic per-horizon demotion from forward losses. Favorite-priced trend remains hard-blocked. Maker capital remains disabled"}),
historicalPrior:"No broad directional rule survived the adaptive holdouts at both 24h and 72h. Contract-safe Shock Strategy 4 remains zero-capital after its untouched expansion failed. An exact production-matched 50%-55% NO rule passed safe non-Sports chronological audits at three, four, five, and six days with one-cent modeled cost; two days failed holdout and seven through ten days failed the stricter all-segment confidence test or were not retained. Contemporaneous historical liquidity cannot be reconstructed, so only live safe non-Sports contracts in the passing windows that clear spread and liquidity gates receive 0.5% paper positions, one owner per event, a 3% cap, settlement-only exits, and automatic per-horizon demotion from forward losses. Favorite-priced trend remains hard-blocked. Maker capital remains disabled"}),
});
function runEngineSelfTest(){
const market=(overrides={})=>Object.assign({
@@ -5957,15 +5964,19 @@ function runEngineSelfTest(){
const pathBarrierContract=analyzeMarket(market({id:"barrier-test",question:"Will Bitcoin reach $66,000 August 17-23?",category:"Crypto"}),news);
const fixedDateLevelContract=analyzeMarket(market({id:"fixed-level-test",question:"Will Bitcoin be above $66,000 on 2026-08-23?",category:"Crypto"}),news);
const ordinaryDatedContract=analyzeMarket(market({id:"dated-test",question:"Will the policy pass on 2026-08-22?"}),news);
const resolutionWeekEnd=new Date(Date.now()+7*86400000).toISOString();
const resolutionWeekEnd=new Date(Date.now()+6*86400000).toISOString();
const resolutionWeekMarket=market({id:"resolution-week",question:"Will Bitcoin be above $82,000 on August 27?",event:"Bitcoin price on August 27",event_id:"btc-aug-27",
category:"Crypto",yes_price:0.48,no_price:0.52,best_bid:0.477,best_ask:0.483,spread:0.006,volume:250000,volume_24hr:30000,liquidity:35000,
days_to_resolution:7,end_date:resolutionWeekEnd,price_change_1h:0,price_change_1d:0,price_change_1w:0});
days_to_resolution:6,end_date:resolutionWeekEnd,price_change_1h:0,price_change_1d:0,price_change_1w:0});
const resolutionWeekSuggestion=resolutionWeekNoSuggestion(resolutionWeekMarket);
const validatedResolutionHorizons=[3,4,5,6].map(days=>resolutionWeekNoSuggestion(Object.assign({},resolutionWeekMarket,
{id:`resolution-${days}d`,event_id:`resolution-${days}d-event`,days_to_resolution:days})));
const unvalidatedSevenDayResolution=resolutionWeekNoSuggestion(Object.assign({},resolutionWeekMarket,
{id:"resolution-7d",event_id:"resolution-7d-event",days_to_resolution:7}));
const pathDependentResolutionWeek=resolutionWeekNoSuggestion(market({id:"resolution-path",question:"Will Bitcoin reach $82,000 by August 27?",event_id:"resolution-path-event",
category:"Crypto",yes_price:0.48,no_price:0.52,best_bid:0.477,best_ask:0.483,spread:0.006,volume:250000,liquidity:35000,days_to_resolution:7,end_date:resolutionWeekEnd}));
category:"Crypto",yes_price:0.48,no_price:0.52,best_bid:0.477,best_ask:0.483,spread:0.006,volume:250000,liquidity:35000,days_to_resolution:6,end_date:resolutionWeekEnd}));
const sportsResolutionWeek=resolutionWeekNoSuggestion(market({id:"resolution-sports",question:"Will Harbor FC win?",event_id:"resolution-sports-event",
category:"Sports",yes_price:0.48,no_price:0.52,best_bid:0.477,best_ask:0.483,spread:0.006,volume:250000,liquidity:35000,days_to_resolution:7,end_date:resolutionWeekEnd}));
category:"Sports",yes_price:0.48,no_price:0.52,best_bid:0.477,best_ask:0.483,spread:0.006,volume:250000,liquidity:35000,days_to_resolution:6,end_date:resolutionWeekEnd}));
const resolutionAgent=AGENTS.find(agent=>agent.id==="catalyst"),initialResolutionProfile=resolutionWeekNoPilotProfile(defaultPortfolio());
const resolutionBook=defaultPortfolio(),resolutionDecision={minConv:0,maxNew:4,maxFrac:0.09,reserve:0.10,targetExposure:0.80,
learning:buildAdaptiveProfile(resolutionBook),marketLearning:buildSignalCalibration(defaultSignalLedger()),resolutionWeekNoPilot:initialResolutionProfile};
@@ -5985,7 +5996,7 @@ function runEngineSelfTest(){
market_id:`losing-3d-resolution-${i}`,original_cost:50,cost:50,realized_pnl:-5});
const horizonResolutionProfile=sharedResolutionWeekNoPilotProfile(horizonResolutionState);
const blockedThreeDayResolution=applyResolutionWeekNoProfile(Object.assign({},resolutionWeekSuggestion,{target_horizon_days:3}),horizonResolutionProfile);
const allowedSevenDayResolution=applyResolutionWeekNoProfile(Object.assign({},resolutionWeekSuggestion,{target_horizon_days:7}),horizonResolutionProfile);
const allowedSixDayResolution=applyResolutionWeekNoProfile(Object.assign({},resolutionWeekSuggestion,{target_horizon_days:6}),horizonResolutionProfile);
const duplicateResolutionState=defaultState();
duplicateResolutionState.agents.catalyst.closed.push({signal_type:"resolution-week-no-pilot",resolution_week_strategy_version:RESOLUTION_WEEK_NO_STRATEGY_VERSION,
event_key:"duplicate-resolution-event",market_id:"duplicate-a",original_cost:50,cost:50,realized_pnl:5});
@@ -6747,6 +6758,9 @@ function runEngineSelfTest(){
resolutionWeekNoPilot:{
identifiesFixedDateNoFavorite:Boolean(resolutionWeekSuggestion&&resolutionWeekSuggestion.trade_ready
&&resolutionWeekSuggestion.side==="NO"&&resolutionWeekSuggestion.entry_price===0.5255),
acceptsEveryValidatedThreeThroughSixDayHorizon:validatedResolutionHorizons.length===4
&&validatedResolutionHorizons.every((suggestion,index)=>suggestion&&suggestion.target_horizon_days===index+3),
rejectsUnvalidatedSevenDayHorizon:unvalidatedSevenDayResolution===null,
usesExecutableNoAskPlusSlippage:Boolean(resolutionWeekSuggestion&&resolutionWeekSuggestion.market_price===0.52
&&resolutionWeekSuggestion.friction===0.0055),
rejectsPathDependentBarrier:pathDependentResolutionWeek===null,
@@ -6762,9 +6776,9 @@ function runEngineSelfTest(){
losingForwardCohortDisablesAllAdopters:losingResolutionProfile.demoted&&!losingResolutionProfile.allowed
&&losingResolutionProfile.position_pct===0,
horizonsAdaptIndependently:horizonResolutionProfile.allowed&&horizonResolutionProfile.horizons[3].demoted
&&!horizonResolutionProfile.horizons[3].allowed&&horizonResolutionProfile.horizons[7].allowed,
&&!horizonResolutionProfile.horizons[3].allowed&&horizonResolutionProfile.horizons[6].allowed,
demotedHorizonCannotTradeWhilePeerHorizonCan:!blockedThreeDayResolution.trade_ready&&blockedThreeDayResolution.watch_only
&&allowedSevenDayResolution.trade_ready&&!allowedSevenDayResolution.watch_only,
&&allowedSixDayResolution.trade_ready&&!allowedSixDayResolution.watch_only,
sharedEvidenceDeduplicatesEvent:duplicateResolutionProfile.events===1,
globalEventClaimsDeduplicateOwner:claimedResolutionKeys.size===1&&claimedResolutionKeys.has("duplicate-resolution-event"),
},
+54 -36
View File
@@ -1,61 +1,79 @@
{
"generated_at": "2026-08-21T22:50:27.912Z",
"strategy": "resolution-window-no-50-55",
"generated_at": "2026-08-21T23:16:59.364Z",
"strategy": "resolution-window-no-50-55-safe-non-sports-v2",
"selection": {
"markets_requested": 3000,
"markets_with_history": 2916,
"markets_with_history": 2954,
"order": "closedTime descending",
"horizon_days_tested": [1, 3, 7, 14, 30, 90],
"horizon_days_enabled": [3, 7],
"horizon_days_tested": [2, 3, 4, 5, 6, 7, 8, 9, 10],
"horizon_days_enabled": [3, 4, 5, 6],
"modeled_round_trip_cost_cents": 1,
"history_fidelity_minutes": 1440,
"cluster_unit": "Polymarket event"
"cluster_unit": "Polymarket event",
"production_contract_filter": "non-Sports and no path-dependent barrier, numeric range, currency range, exact score, or post-count contract"
},
"rules": {
"side": "NO",
"midpoint_min_inclusive": 0.5,
"midpoint_max_exclusive": 0.55,
"3_day": {
"observations": 632,
"events": 158,
"event_mean_return": 0.3324127082,
"event_lower_90": 0.2551784721,
"win_rate": 0.8022151899,
"train_events": 102,
"train_event_lower_90": 0.1932371274,
"holdout_events": 58,
"holdout_event_lower_90": 0.2726926035,
"chronological_thirds_event_lower_90": [0.1536229561, 0.1670007024, 0.2405597789]
"events": 121,
"event_mean_return": 0.2451763293,
"event_lower_90": 0.1577733713,
"train_events": 85,
"train_event_lower_90": 0.1314547114,
"holdout_events": 40,
"holdout_event_lower_90": 0.0991402647,
"chronological_thirds_event_lower_90": [0.052193276, 0.0937543342, 0.1174259244]
},
"7_day": {
"observations": 512,
"events": 114,
"event_mean_return": 0.3820780403,
"event_lower_90": 0.3124946179,
"win_rate": 0.818359375,
"train_events": 79,
"train_event_lower_90": 0.305848167,
"holdout_events": 35,
"holdout_event_lower_90": 0.2376613258,
"chronological_thirds_event_lower_90": [0.348483419, 0.1301313899, 0.3106913741]
"4_day": {
"events": 144,
"event_mean_return": 0.381453985,
"event_lower_90": 0.3139573933,
"train_events": 102,
"train_event_lower_90": 0.3031863842,
"holdout_events": 47,
"holdout_event_lower_90": 0.2716756304,
"chronological_thirds_event_lower_90": [0.3388899636, 0.2711632708, 0.2004748563]
},
"5_day": {
"events": 105,
"event_mean_return": 0.3686092965,
"event_lower_90": 0.2938832777,
"train_events": 77,
"train_event_lower_90": 0.2686815198,
"holdout_events": 30,
"holdout_event_lower_90": 0.3000837037,
"chronological_thirds_event_lower_90": [0.2828281426, 0.1431972556, 0.3007470066]
},
"6_day": {
"events": 87,
"event_mean_return": 0.4393573265,
"event_lower_90": 0.3767305502,
"train_events": 60,
"train_event_lower_90": 0.3308720214,
"holdout_events": 29,
"holdout_event_lower_90": 0.4367621838,
"chronological_thirds_event_lower_90": [0.2863423727, 0.3447299413, 0.3561383759]
}
},
"rejected_neighboring_rule": {
"name": "resolution-week-no-55-90",
"events": 37,
"event_mean_return": -0.0119488579,
"event_lower_90": -0.1573098631,
"reason": "The exact neighboring band failed pooled, train, holdout, and chronological-segment robustness."
"rejected_windows": {
"2_day": "The chronological holdout lower 90% bound was negative.",
"7_day": "The exact safe non-Sports cohort had a negative middle-segment lower 90% bound.",
"8_day": "Not retained after the contiguous 3-6 day production window passed more strongly.",
"9_day": "Not retained after the contiguous 3-6 day production window passed more strongly.",
"10_day": "The exact safe non-Sports cohort had a negative middle-segment lower 90% bound.",
"adjacent_price_bands": "The 45-50% band lacked sufficient holdout evidence and the 55-60% band was unstable across shorter horizons."
},
"production_constraints": {
"fixed_date_only": true,
"safe_contract_only": true,
"sports_excluded": true,
"minimum_total_volume_usd": 15000,
"minimum_live_liquidity_usd": 1400,
"maximum_spread": 0.03,
"entry": "executable NO ask plus 0.25 cents slippage",
"maximum_entry_friction_cents": 1,
"resolution_windows_days": [[2.5, 3.5], [6.5, 7.5]],
"resolution_windows_days": [[2.5, 3.5], [3.5, 4.5], [4.5, 5.5], [5.5, 6.5]],
"initial_position_pct": 0.5,
"total_cap_pct": 3,
"one_owner_per_event": true,
@@ -67,5 +85,5 @@
"Published midpoint history is not a fill guarantee; production therefore applies current executable pricing and liquidity gates.",
"This audit authorizes only bounded paper trading and does not guarantee future profit."
],
"reproduce": "SETTLEMENT_MARKETS=3000 SETTLEMENT_HORIZONS=1,3,7,14,30,90 SETTLEMENT_COST_CENTS=1 SETTLEMENT_ORDER=closedTime SETTLEMENT_ASCENDING=false SETTLEMENT_TARGET_ONLY=1 SETTLEMENT_TARGET_RULES=buy_no_50_55 node scripts/evaluate-settlements.mjs"
"reproduce": "SETTLEMENT_MARKETS=3000 SETTLEMENT_HORIZONS=3,4,5,6,7,8,9,10 SETTLEMENT_COST_CENTS=1 SETTLEMENT_ORDER=closedTime SETTLEMENT_ASCENDING=false SETTLEMENT_TARGET_ONLY=1 SETTLEMENT_TARGET_RULES=buy_no_50_55_safe_non_sports node scripts/evaluate-settlements.mjs"
}
+36 -2
View File
@@ -31,6 +31,16 @@ function categoryOf(raw) {
return "Other";
}
function hardSettlementJumpRisk(raw) {
const text = `${raw?.question || ""} ${raw?.events?.[0]?.title || ""}`.toLowerCase();
const numericRange = /\b\d+(?:\.\d+)?\s*(?:%|percent)?\s*(?:-||—|to)\s*\d+(?:\.\d+)?\s*(?:%|percent|votes?|points?|seats?|bps|basis points?|tweets?|posts?|goals?)(?![a-z])/;
const currencyRange = /[$€£]\d+(?:\.\d+)?\s*(?:-||—|to)\s*[$€£]?\d+(?:\.\d+)?/;
const betweenRange = /\bbetween\s+[$€£]?\d+(?:\.\d+)?\s*(?:%|percent)?\s+(?:and|to)\s+[$€£]?\d+(?:\.\d+)?/;
const pathDependentBarrier = /\b(?:reach|hit|touch|dip(?:\s+(?:to|below))?|rise\s+(?:to|above)|fall\s+(?:to|below))\b[^?]{0,45}(?:[$€£]\s*)?\d[\d,]*(?:\.\d+)?\s*(?:%|percent|k|m|b|points?|bps|basis points?)?/;
return numericRange.test(text) || currencyRange.test(text) || betweenRange.test(text) || pathDependentBarrier.test(text)
|| /\bexact score\b|\bscore:\s*\d|\bposts? \d+-\d+|\bnumber of (tweets|posts)\b/.test(text);
}
async function fetchJson(url, options = {}, attempts = 3) {
let lastError;
for (let attempt = 0; attempt < attempts; attempt++) {
@@ -109,7 +119,7 @@ async function fetchResolvedMarkets(limit) {
seen.add(id); raw.push({ id, question: market.question || "", category: categoryOf(market),
eventId: String(market.events?.[0]?.id || id),
tokenId: String(tokens[0]), finalYes: outcomes[0] >= 0.99 ? 1 : 0, closedAt,
volume: Number(market.volumeNum || market.volume || 0) });
safeContract: !hardSettlementJumpRisk(market), volume: Number(market.volumeNum || market.volume || 0) });
if (raw.length >= limit) break;
}
if (page.length < pageSize || !payload.next_cursor || payload.next_cursor === cursor) break;
@@ -129,7 +139,8 @@ function evaluateMarket(market, points) {
for (const side of ["YES", "NO"]) {
const entry = side === "YES" ? yesEntry : noEntry, final = side === winningSide ? 1 : 0;
const netReturn = final / entry - 1 - (COST_CENTS / 100) / entry;
rows.push({ marketId: market.id, eventId: market.eventId, question: market.question, category: market.category, closedAt: market.closedAt,
rows.push({ marketId: market.id, eventId: market.eventId, question: market.question, category: market.category,
safeContract: market.safeContract, closedAt: market.closedAt,
horizonDays, side, favorite: side === favoriteSide, winner: side === winningSide,
trend: Boolean(trend && trend.side === side), trendSide: trend?.side || null,
dayMove: trend?.dayMove || 0, weekMove: trend?.weekMove || 0,
@@ -167,6 +178,16 @@ function summarize(rows) {
worst: Math.min(...values), best: Math.max(...values) };
}
const SAFE_PRICE_BANDS = Object.freeze([
{ label: "50_55", min: 0.50, max: 0.55 },
{ label: "55_60", min: 0.55, max: 0.60 },
{ label: "60_70", min: 0.60, max: 0.70 },
{ label: "70_80", min: 0.70, max: 0.80 },
{ label: "80_90", min: 0.80, max: 0.90 },
{ label: "90_95", min: 0.90, max: 0.95 },
{ label: "95_97", min: 0.95, max: 0.97 },
]);
const RULES = [
{ name: "buy_favorite", test: (row) => row.favorite },
{ name: "buy_heavy_favorite", test: (row) => row.favorite && row.entry >= 0.78 },
@@ -176,8 +197,13 @@ const RULES = [
{ name: "buy_yes", test: (row) => row.side === "YES" },
{ name: "buy_no", test: (row) => row.side === "NO" },
{ name: "buy_no_favorite", test: (row) => row.side === "NO" && row.favorite },
{ name: "buy_no_45_50", test: (row) => row.side === "NO" && row.entry >= 0.45 && row.entry < 0.50 },
{ name: "buy_no_55_90", test: (row) => row.side === "NO" && row.entry >= 0.55 && row.entry < 0.90 },
{ name: "buy_no_50_55", test: (row) => row.side === "NO" && row.entry >= 0.50 && row.entry < 0.55 },
{ name: "buy_no_50_55_non_sports", test: (row) => row.side === "NO" && row.entry >= 0.50 && row.entry < 0.55 && row.category !== "Sports" },
{ name: "buy_no_50_55_safe_non_sports", test: (row) => row.side === "NO" && row.entry >= 0.50 && row.entry < 0.55
&& row.category !== "Sports" && row.safeContract },
{ name: "buy_no_55_60", test: (row) => row.side === "NO" && row.entry >= 0.55 && row.entry < 0.60 },
{ name: "buy_no_60_90", test: (row) => row.side === "NO" && row.entry >= 0.60 && row.entry < 0.90 },
{ name: "buy_no_90_95", test: (row) => row.side === "NO" && row.entry >= 0.90 && row.entry < 0.95 },
{ name: "buy_no_95_99", test: (row) => row.side === "NO" && row.entry >= 0.95 && row.entry < 0.99 },
@@ -189,9 +215,17 @@ const RULES = [
{ name: "follow_trend_underdog", test: (row) => row.trend && !row.favorite },
{ name: "follow_strong_trend", test: (row) => row.trend && row.strongTrend },
{ name: "follow_moderate_trend", test: (row) => row.trend && row.moderateTrend },
...SAFE_PRICE_BANDS.flatMap((band) => [
{ name: `buy_safe_favorite_${band.label}`, test: (row) => row.favorite && row.entry >= band.min && row.entry < band.max
&& row.category !== "Sports" && row.safeContract },
{ name: `buy_safe_no_${band.label}`, test: (row) => row.side === "NO" && row.entry >= band.min && row.entry < band.max
&& row.category !== "Sports" && row.safeContract },
]),
...["Politics", "Sports", "Crypto", "Economy", "Pop Culture", "Other"].flatMap((category) => [
{ name: `buy_favorite_${category.toLowerCase().replace(/\s+/g, "_")}`, test: (row) => row.favorite && row.category === category },
{ name: `buy_underdog_${category.toLowerCase().replace(/\s+/g, "_")}`, test: (row) => !row.favorite && row.category === category },
{ name: `buy_no_50_55_${category.toLowerCase().replace(/\s+/g, "_")}`,
test: (row) => row.side === "NO" && row.entry >= 0.50 && row.entry < 0.55 && row.category === category },
{ name: `follow_trend_${category.toLowerCase().replace(/\s+/g, "_")}`, test: (row) => row.trend && row.category === category },
]),
];
+1 -1
View File
@@ -128,7 +128,7 @@ async function main() {
const branch = process.env.RUNTIME_BRANCH || "runtime-state";
const pathname = process.env.RUNTIME_STATE_PATH || "runtime/state.json";
const arenaUrl = (process.env.ARENA_URL || "https://polymarket-site-eta.vercel.app").replace(/\/$/, "");
const expectedBuild = Number(required("EXPECTED_BUILD", "96"));
const expectedBuild = Number(required("EXPECTED_BUILD", "97"));
await ensureRuntimeBranch(repository, branch);
const prior = await readRuntimeFile(repository, branch, pathname);
if (prior.snapshot) validateRuntimeSnapshot(prior.snapshot, 0, { allowIncomplete: true });
+12 -11
View File
@@ -9,7 +9,7 @@ const runner = fs.readFileSync(new URL("./run-autonomous-cycle.mjs", import.meta
const resolutionAudit = JSON.parse(fs.readFileSync(new URL("../research/resolution-week-no-audit.json", import.meta.url), "utf8"));
const build = Number(index.match(/const BUILD_VERSION = (\d+);/)?.[1]);
assert.equal(build, 96);
assert.equal(build, 97);
assert.deepEqual([...ALLOWED_RUNTIME_KEYS].sort(), ["pma_agents_v2", "pma_suggestions_v5"]);
assert.match(index, /function collectPublicRuntimeItems\(\)/);
assert.match(index, /const PUBLIC_RUNTIME_KEYS=Object\.freeze\(\[AGENTS_KEY,SUG_KEY\]\)/);
@@ -26,17 +26,18 @@ assert.match(api, /Buffer\.from\(file\.content/);
assert.match(api, /searchParams\.set\("runtime", `\$\{Date\.now\(\)\}/);
assert.match(workflow, /cron: "7,22,37,52 \* \* \* \*"/);
assert.match(workflow, /contents: write/);
assert.match(workflow, /EXPECTED_BUILD: "96"/);
assert.match(workflow, /EXPECTED_BUILD: "97"/);
assert.match(runner, /MAX_STATE_BYTES = 900_000/);
assert.equal(resolutionAudit.strategy, "resolution-window-no-50-55");
assert.deepEqual(resolutionAudit.selection.horizon_days_enabled, [3, 7]);
assert.ok(resolutionAudit.rules["3_day"].train_event_lower_90 > 0);
assert.ok(resolutionAudit.rules["3_day"].holdout_event_lower_90 > 0);
assert.ok(resolutionAudit.rules["3_day"].chronological_thirds_event_lower_90.every((value) => value > 0));
assert.ok(resolutionAudit.rules["7_day"].train_event_lower_90 > 0);
assert.ok(resolutionAudit.rules["7_day"].holdout_event_lower_90 > 0);
assert.ok(resolutionAudit.rules["7_day"].chronological_thirds_event_lower_90.every((value) => value > 0));
assert.ok(resolutionAudit.rejected_neighboring_rule.event_lower_90 < 0);
assert.equal(resolutionAudit.strategy, "resolution-window-no-50-55-safe-non-sports-v2");
assert.deepEqual(resolutionAudit.selection.horizon_days_enabled, [3, 4, 5, 6]);
for (const days of resolutionAudit.selection.horizon_days_enabled) {
const rule = resolutionAudit.rules[`${days}_day`];
assert.ok(rule.train_event_lower_90 > 0);
assert.ok(rule.holdout_event_lower_90 > 0);
assert.ok(rule.chronological_thirds_event_lower_90.every((value) => value > 0));
}
assert.match(resolutionAudit.rejected_windows["2_day"], /holdout/i);
assert.match(resolutionAudit.rejected_windows["7_day"], /negative/i);
const agentIds = ["value", "momentum", "favorite", "longshot", "diversifier", "catalyst", "reversal", "breakout", "tailalpha", "conviction"];
const agents = Object.fromEntries(agentIds.map(id => [id, { cash: 10000, positions: [], lastDecision: { mode: "test" } }]));
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE_NAME = "polymarket-arena-build-96";
const CACHE_NAME = "polymarket-arena-build-97";
const APP_SHELL = ["/", "/index.html", "/personal.html", "/cycle-worker.js"];
self.addEventListener("install", event => {