mirror of
https://github.com/theodore-song/polymarket-analyst.git
synced 2026-08-24 13:08:10 +00:00
Harden Build 124 release and report secured profit
This commit is contained in:
@@ -2,7 +2,10 @@ name: Release Build 124 after Vercel quota reset
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "15 13 23 8 *"
|
||||
# Vercel's Hobby deployment quota is rolling. Retry across the reset
|
||||
# window, then remove this workflow as soon as Build 124 is live.
|
||||
- cron: "15 13-23/2 23 8 *"
|
||||
- cron: "15 1-13/2 24 8 *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
||||
@@ -142,6 +142,14 @@ Every probation position exits at the matching six-hour executable bid and keeps
|
||||
the 18% stop policy active. Normal directional sizing remains locked until the
|
||||
same cohort independently passes both the 24-hour and 72-hour promotion gates.
|
||||
|
||||
An August 23 exact-fee settlement calibration independently checked 5,000
|
||||
resolved markets, 4,807 usable histories, and 7,854 observations across 1,400
|
||||
fixed side, category, price-band, and 1/3/7/14/30-day rules. Zero rules cleared
|
||||
even the event-clustered 95% training lower-bound gate. The three-day Sports NO
|
||||
target fell to -44.14% in validation and remained negative in holdout, so it
|
||||
cannot authorize capital. The reproducible result is stored in
|
||||
`research/settlement-calibration-exact-fee-5000-audit.json`.
|
||||
|
||||
Build 124 retains Build 100's retirement of the old 3-6 day resolution-window
|
||||
capital permission. That audit clustered confidence by event but still averaged
|
||||
several correlated contracts inside each event, while production could choose
|
||||
|
||||
+15
-3
@@ -2799,6 +2799,15 @@ function completeBundleAccountingFloor(group){
|
||||
const settlementFloor=units*payoutPerUnit;
|
||||
return settlementFloor+0.005>=cost?cost:0;
|
||||
}
|
||||
function completeBundleSecuredProfit(p){
|
||||
return completeBundleGroups(p).reduce((total,group)=>{
|
||||
const cost=group.reduce((sum,pos)=>sum+Number(pos.cost||0),0);
|
||||
const payoutPerUnit=Math.min(...group.map(pos=>Number(pos.bundle_payout_per_unit||0)));
|
||||
const units=Math.min(...group.map(pos=>Number(pos.shares||0)));
|
||||
const profit=units*payoutPerUnit-cost;
|
||||
return total+(Number.isFinite(profit)&&profit>0?profit:0);
|
||||
},0);
|
||||
}
|
||||
function portfolioPositionValue(p){
|
||||
const positions=p&&Array.isArray(p.positions)?p.positions:[];
|
||||
let total=positions.reduce((sum,pos)=>sum+Number(pos.shares||0)*Number(pos.current_price||0),0);
|
||||
@@ -5086,7 +5095,8 @@ function board(){
|
||||
const st=loadState();
|
||||
return rankBoardRows(AGENTS.map(c=>{const p=st.agents[c.id]||defaultPortfolio();const eq=equity(p);
|
||||
const baseline=Number(p.engine_baseline&&normalizedStrategyVersion(p.engine_baseline.version)===SUGGESTION_ENGINE_VERSION?p.engine_baseline.equity:eq);
|
||||
return {c,p,eq,pnl:eq-STARTING_BALANCE,ret:(eq/STARTING_BALANCE-1)*100,enginePnl:eq-baseline,engineRet:baseline>0?(eq/baseline-1)*100:0,change24h:portfolioChange24h(p,eq)};})
|
||||
return {c,p,eq,pnl:eq-STARTING_BALANCE,ret:(eq/STARTING_BALANCE-1)*100,enginePnl:eq-baseline,engineRet:baseline>0?(eq/baseline-1)*100:0,
|
||||
securedProfit:completeBundleSecuredProfit(p),change24h:portfolioChange24h(p,eq)};})
|
||||
);
|
||||
}
|
||||
const MEDALS=["🥇","🥈","🥉"];
|
||||
@@ -5100,6 +5110,7 @@ function renderOverview(){
|
||||
const engineAvg=b.reduce((s,r)=>s+r.engineRet,0)/b.length;
|
||||
const core=b.filter(r=>!r.c.aggressive),coreAvg=core.reduce((s,r)=>s+r.engineRet,0)/Math.max(1,core.length);
|
||||
const aggressive=b.filter(r=>r.c.aggressive),aggressiveAvg=aggressive.reduce((s,r)=>s+r.engineRet,0)/Math.max(1,aggressive.length);
|
||||
const securedProfit=b.reduce((sum,row)=>sum+row.securedProfit,0);
|
||||
const sugCount=(loadSuggestions().suggestions||[]).length;
|
||||
const stats=[
|
||||
{ic:lead.c.emoji,label:"Leader",value:lead.c.name.split(" ")[0]},
|
||||
@@ -5108,6 +5119,7 @@ function renderOverview(){
|
||||
{ic:"🧪",label:"Adaptive avg",value:fmtPct(engineAvg),cls:signClass(engineAvg)},
|
||||
{ic:"🧠",label:"Core adaptive avg",value:fmtPct(coreAvg),cls:signClass(coreAvg)},
|
||||
{ic:"⚡",label:"Aggressive adaptive",value:fmtPct(aggressiveAvg),cls:signClass(aggressiveAvg)},
|
||||
{ic:"🔒",label:"Secured bundle profit",value:fmtUSD(securedProfit),cls:securedProfit>0?"pos-val":""},
|
||||
{ic:"💡",label:"Scored ideas",value:sugCount},
|
||||
{ic:"🏆",label:"Agents",value:AGENTS.length},
|
||||
];
|
||||
@@ -5273,7 +5285,7 @@ function renderLeaderboard(){
|
||||
<div class="lb-top"><span class="medal">${MEDALS[i]||""}</span><span class="lb-emoji">${r.c.emoji}</span>
|
||||
<div><div class="lb-name">${r.c.name}</div><div class="lb-blurb">${agentBlurb(r.c,st)}</div></div></div>
|
||||
<div class="lb-mid"><div class="lb-eq">${fmtUSD(r.eq)}</div><div><div class="lb-ret ${signClass(r.enginePnl)}">${fmtPct(r.engineRet)}</div><div class="small ${signClass(r.pnl)}">legacy/replay ${fmtPct(r.ret)}</div><div class="small ${signClass(r.change24h.pct)}">24h ${format24h(r.change24h)}</div></div></div>
|
||||
<div class="lb-foot"><span class="muted small">${r.p.positions.length} open · ${r.p.closed.length} closed</span>${miniSpark(r.p.snapshots,r.c.color)}</div>
|
||||
<div class="lb-foot"><span class="muted small">${r.p.positions.length} open · ${r.p.closed.length} closed${r.securedProfit>0?` · <span class="pos-val">${fmtUSD(r.securedProfit)} secured</span>`:""}</span>${miniSpark(r.p.snapshots,r.c.color)}</div>
|
||||
</div>`).join("");
|
||||
document.querySelectorAll("#leaderboard .lb-card").forEach(el=>{
|
||||
el.addEventListener("click",()=>{localStorage.setItem(VIEW_KEY,el.dataset.agent);renderPortfolioTab();showTab("portfolio");});
|
||||
@@ -5689,7 +5701,7 @@ function renderAgentReports(){
|
||||
<p><b>Adaptation:</b> ${esc(decisionSummary(row.p))}</p>
|
||||
<p><b>Performance:</b> ${esc(dailyPerformanceExplanation(row))}</p>
|
||||
${crash}
|
||||
<p><b>Status:</b> ${open} open position${open===1?"":"s"} with ${fmtUSD(row.eq)} equity. ${esc(line)}</p>
|
||||
<p><b>Status:</b> ${open} open position${open===1?"":"s"} with ${fmtUSD(row.eq)} marked equity.${row.securedProfit>0?` ${fmtUSD(row.securedProfit)} of additional settlement profit is secured by intact verified bundles and remains excluded from marked return until an exit, conversion, or settlement.`:""} ${esc(line)}</p>
|
||||
<p><b>${esc(plan)}</b></p>
|
||||
</article>`;
|
||||
}).join("");
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"generated_at": "2026-08-23T00:10:38.029Z",
|
||||
"strategy": "exact-fee settlement calibration",
|
||||
"requested_markets": 5000,
|
||||
"resolved_markets": 5000,
|
||||
"histories_with_data": 4807,
|
||||
"failures": 0,
|
||||
"observations": 7854,
|
||||
"tested_rules": 1400,
|
||||
"train_passed": 0,
|
||||
"validation_selected": 0,
|
||||
"holdout_passed": 0,
|
||||
"methodology": {
|
||||
"selection": "most recently closed eligible Yes/No markets",
|
||||
"horizons_days": [1, 3, 7, 14, 30],
|
||||
"history_fidelity_minutes": 1440,
|
||||
"maximum_price_staleness_hours": 36,
|
||||
"modeled_entry_slippage_cents": 1,
|
||||
"exact_gamma_entry_fee_schedules": true,
|
||||
"split": "60% train / 20% validation / 20% untouched holdout",
|
||||
"confidence": "event-clustered 95% lower bound",
|
||||
"stability": "positive event mean in each of four chronological windows; at most one highest-entry market per underlying event or sports contest"
|
||||
},
|
||||
"partition_observations": {
|
||||
"train": 4987,
|
||||
"validation": 1419,
|
||||
"holdout": 1448
|
||||
},
|
||||
"sports_no_3d_target": {
|
||||
"train": {"events": 79, "event_mean": -0.00873, "lower_95": -0.11764},
|
||||
"validation": {"events": 53, "event_mean": -0.44135, "lower_95": -0.62545},
|
||||
"holdout": {"events": 34, "event_mean": -0.05382, "lower_95": -0.28345},
|
||||
"stability_means": [0.00226, 0.01151, -0.36967, -0.18035],
|
||||
"passes_holdout": false
|
||||
},
|
||||
"production_decision": "No static settlement-horizon, side, category, or price-band rule receives capital. Continue event-deduplicated zero-capital forward learning and require the existing promotion gates."
|
||||
}
|
||||
@@ -11,10 +11,15 @@ const resolutionAudit = JSON.parse(fs.readFileSync(new URL("../research/resoluti
|
||||
const sportsContestAudit = JSON.parse(fs.readFileSync(new URL("../research/sports-contest-no-exploration-audit.json", import.meta.url), "utf8"));
|
||||
const sportsDisjointAudit = JSON.parse(fs.readFileSync(new URL("../research/sports-contest-no-disjoint-10000-audit.json", import.meta.url), "utf8"));
|
||||
const adaptiveAudit = JSON.parse(fs.readFileSync(new URL("../research/adaptive-strategy-64-audit.json", import.meta.url), "utf8"));
|
||||
const settlementCalibrationAudit = JSON.parse(fs.readFileSync(new URL("../research/settlement-calibration-exact-fee-5000-audit.json", import.meta.url), "utf8"));
|
||||
const sportsEvaluator = fs.readFileSync(new URL("./evaluate-sports-favorites.mjs", import.meta.url), "utf8");
|
||||
const build = Number(index.match(/const BUILD_VERSION = (\d+);/)?.[1]);
|
||||
|
||||
assert.equal(build, 124);
|
||||
assert.equal(settlementCalibrationAudit.requested_markets, 5000);
|
||||
assert.equal(settlementCalibrationAudit.train_passed, 0);
|
||||
assert.equal(settlementCalibrationAudit.validation_selected, 0);
|
||||
assert.equal(settlementCalibrationAudit.holdout_passed, 0);
|
||||
assert.match(index, /Adaptive strategy 65 · exact bundle conversion · build 124/);
|
||||
assert.deepEqual([...ALLOWED_RUNTIME_KEYS].sort(), ["pma_agents_v2", "pma_suggestions_v5"]);
|
||||
assert.match(index, /function collectPublicRuntimeItems\(\)/);
|
||||
@@ -72,6 +77,8 @@ assert.match(workflow, /next=\$\(\( \(now \/ 300 \+ 1\) \* 300 \+ 15 \)\)/);
|
||||
assert.match(workflow, /actions\/workflows\/autonomous-cycle\.yml\/dispatches/);
|
||||
assert.match(workflow, /--data '\{"ref":"main"\}'/);
|
||||
assert.match(releaseWorkflow, /name: Release Build 124 after Vercel quota reset/);
|
||||
assert.match(releaseWorkflow, /cron: "15 13-23\/2 23 8 \*"/);
|
||||
assert.match(releaseWorkflow, /cron: "15 1-13\/2 24 8 \*"/);
|
||||
assert.match(releaseWorkflow, /grep -q 'const BUILD_VERSION = 124;'/);
|
||||
assert.match(releaseWorkflow, /EXPECTED_BUILD: "124"/);
|
||||
assert.doesNotMatch(releaseWorkflow, /Build 123|build_123|build-123/);
|
||||
@@ -79,6 +86,9 @@ assert.match(index, /cloudRestartReconstructsOfflineCache:true/);
|
||||
assert.match(index, /saveSuggestions\(sugs,markets\.length,analysisMarkets\.length,bundleAudit\)/);
|
||||
assert.match(index, /const NEG_RISK_EVENT_SCAN_LIMIT=1000;/);
|
||||
assert.match(index, /bundleOpportunityTelemetry:true/);
|
||||
assert.match(index, /function completeBundleSecuredProfit\(p\)/);
|
||||
assert.match(index, /label:"Secured bundle profit"/);
|
||||
assert.match(index, /additional settlement profit is secured by intact verified bundles/);
|
||||
assert.match(index, /const BUNDLE_DEPTH_CANDIDATE_LIMIT=80;/);
|
||||
assert.match(index, /const BINARY_COMPLEMENT_DEPTH_RESERVE=20;/);
|
||||
assert.match(index, /const NEG_RISK_CONVERSION_DEPTH_RESERVE=20;/);
|
||||
|
||||
Reference in New Issue
Block a user