mirror of
https://github.com/theodore-song/polymarket-analyst.git
synced 2026-08-24 04:58:08 +00:00
Replace rejected sports pilot with forward shadow learner
This commit is contained in:
@@ -15,12 +15,12 @@ https://polymarket-site-eta.vercel.app/personal.html
|
|||||||
|
|
||||||
The site fetches live Polymarket markets, generates agent suggestions, lets you
|
The site fetches live Polymarket markets, generates agent suggestions, lets you
|
||||||
run frequent paper cycles, and syncs the shared arena state through Neon or
|
run frequent paper cycles, and syncs the shared arena state through Neon or
|
||||||
Vercel Blob. Build 72 also installs an offline app shell and caches timestamped
|
Vercel Blob. Build 73 also installs an offline app shell and caches timestamped
|
||||||
market snapshots. During an outage, cycles continue locally; cached entries are
|
market snapshots. During an outage, cycles continue locally; cached entries are
|
||||||
allowed for 90 minutes, older snapshots become mark-only, and all cached data
|
allowed for 90 minutes, older snapshots become mark-only, and all cached data
|
||||||
expires after 24 hours.
|
expires after 24 hours.
|
||||||
|
|
||||||
Build 72 distinguishes a temporary order-book pause from settlement. Exact
|
Build 73 distinguishes a temporary order-book pause from settlement. Exact
|
||||||
market refreshes still mark paused positions to the latest published price, but
|
market refreshes still mark paused positions to the latest published price, but
|
||||||
the engine cannot simulate a stop, policy exit, or settlement while
|
the engine cannot simulate a stop, policy exit, or settlement while
|
||||||
`acceptingOrders` is false and `closed` is still false. Only a closed market
|
`acceptingOrders` is false and `closed` is still false. Only a closed market
|
||||||
@@ -32,7 +32,7 @@ team names, Over/Under, or another pair are rejected instead of being silently
|
|||||||
reinterpreted as Yes/No. The same semantic check applies to complete event
|
reinterpreted as Yes/No. The same semantic check applies to complete event
|
||||||
bundles and the offline evaluators.
|
bundles and the offline evaluators.
|
||||||
|
|
||||||
Build 72 ranks the competition by each agent's return since Strategy 57 began.
|
Build 73 ranks the competition by each agent's return since Strategy 58 began.
|
||||||
Historical replay equity remains visible for context, but it no longer makes an
|
Historical replay equity remains visible for context, but it no longer makes an
|
||||||
agent look like the current leader when the live adaptive strategy is losing.
|
agent look like the current leader when the live adaptive strategy is losing.
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ The learner shrinks small samples toward neutral, caps sizing changes to
|
|||||||
15% of candidates for deterministic exploration so a stale regime cannot become
|
15% of candidates for deterministic exploration so a stale regime cannot become
|
||||||
permanent.
|
permanent.
|
||||||
|
|
||||||
Strategy 57 treats each binary stake as capable of falling to zero even when the
|
Strategy 58 treats each binary stake as capable of falling to zero even when the
|
||||||
18% stop cannot fill. New core positions are capped at 2.5%-4% of equity and
|
18% stop cannot fill. New core positions are capped at 2.5%-4% of equity and
|
||||||
aggressive positions at 3%-5%, with lower limits for near-term, extreme-price,
|
aggressive positions at 3%-5%, with lower limits for near-term, extreme-price,
|
||||||
reversal, and fast-moving setups. Oversized positions inherited from older
|
reversal, and fast-moving setups. Oversized positions inherited from older
|
||||||
@@ -66,8 +66,8 @@ cohort can demote it.
|
|||||||
The Build 69 re-audit loaded all 500 requested histories with no failures. The
|
The Build 69 re-audit loaded all 500 requested histories with no failures. The
|
||||||
six-hour family lost 1.27% net on average across 106 independent events, with
|
six-hour family lost 1.27% net on average across 106 independent events, with
|
||||||
its full 90% interval below zero; no tested rule was robustly positive at 6,
|
its full 90% interval below zero; no tested rule was robustly positive at 6,
|
||||||
12, 24, or 72 hours. Build 72 therefore uses six hours only to stop bad regimes
|
12, 24, or 72 hours. Build 73 therefore uses six hours only to stop bad regimes
|
||||||
sooner. It also closes every stale pre-Strategy-57 directional holding at the
|
sooner. It also closes every stale pre-Strategy-58 directional holding at the
|
||||||
next fresh mark, including legacy records missing a signal label, while leaving
|
next fresh mark, including legacy records missing a signal label, while leaving
|
||||||
complete arbitrage bundles and paired maker inventory under their own accounting.
|
complete arbitrage bundles and paired maker inventory under their own accounting.
|
||||||
|
|
||||||
@@ -98,15 +98,16 @@ evidence proves an edge.
|
|||||||
Run `npm run evaluate:sports-favorites` for the separate pregame favorite audit.
|
Run `npm run evaluate:sports-favorites` for the separate pregame favorite audit.
|
||||||
It anchors decisions to the published game start, rejects stale prices, charges a
|
It anchors decisions to the published game start, rejects stale prices, charges a
|
||||||
modeled five-cent cost, takes only the highest-priced eligible favorite per event,
|
modeled five-cent cost, takes only the highest-priced eligible favorite per event,
|
||||||
and uses a chronological 60/20/20 split. The clean 3,000-market run produced nine
|
and uses a chronological 60/20/20 split. The refreshed August 20 run loaded all
|
||||||
train-pass rules but zero strict validation selections. The exact 24-hour,
|
3,000 histories with no failures and found zero train-pass rules. The Strategy 57
|
||||||
60%-85% rule nevertheless had positive point estimates in all three partitions:
|
24-hour, 60%-85% capital rule averaged -11.98% across 168 independent training
|
||||||
2.97% train, 3.10% validation, and 19.83% untouched holdout, while its train and
|
events and -4.04% across 100 untouched holdout events after the five-cent cost,
|
||||||
validation confidence bounds still crossed zero. Strategy 57 therefore permits
|
so Strategy 58 retires it at the next fresh executable mark. The narrower 12-hour,
|
||||||
only a labeled paper-capital pilot in Favorite Backer: 1.25% of equity per event,
|
60%-75% rule had positive point estimates in train, validation, and holdout but
|
||||||
6% total, with a five-cent cost booked immediately. It disables after 12 completed
|
did not establish a positive lower confidence bound in train or holdout. Favorite
|
||||||
events with materially negative evidence or a 2.5% account loss, and scales to
|
Backer therefore records it with zero capital, one market per event, and persists
|
||||||
2.5% only after 30 events produce a positive 90% lower confidence bound.
|
the pending and completed forward ledger offline. Only 30 new independent closed
|
||||||
|
events with a positive 90% lower confidence bound can promote 1.25% positions.
|
||||||
|
|
||||||
Run `npm run evaluate:settlement-calibration` for the stricter settlement-bias
|
Run `npm run evaluate:settlement-calibration` for the stricter settlement-bias
|
||||||
search across up to 5,000 resolved markets. It uses a 60/20/20 chronological
|
search across up to 5,000 resolved markets. It uses a 60/20/20 chronological
|
||||||
@@ -115,10 +116,10 @@ stability windows, a 24-hour market-age minimum, and a recent non-flat price
|
|||||||
history requirement. Before those activity and overlap controls, four sports
|
history requirement. Before those activity and overlap controls, four sports
|
||||||
rules appeared to pass holdout because correlated props shared one event and
|
rules appeared to pass holdout because correlated props shared one event and
|
||||||
some histories contained inactive default prices. After correction, 11 of
|
some histories contained inactive default prices. After correction, 11 of
|
||||||
1,400 rules passed training and zero passed validation. Strategy 57 therefore
|
1,400 rules passed training and zero passed validation. Strategy 58 therefore
|
||||||
does not install any other static side, category, price-band, or settlement-horizon bet.
|
does not install any other static side, category, price-band, or settlement-horizon bet.
|
||||||
|
|
||||||
Strategy 57 also removes the last emotion-driven sizing path. Agent mood and
|
Strategy 58 also removes the last emotion-driven sizing path. Agent mood and
|
||||||
leaderboard urgency remain visible in reports, but neither can increase capital.
|
leaderboard urgency remain visible in reports, but neither can increase capital.
|
||||||
A positive peer signal receives at most a 5% sizing lift, and only when both the
|
A positive peer signal receives at most a 5% sizing lift, and only when both the
|
||||||
agent's realized-trade cohort and the independent walk-forward market cohort are
|
agent's realized-trade cohort and the independent walk-forward market cohort are
|
||||||
@@ -139,7 +140,7 @@ and 24-hour horizons. Zero rules passed training, validation, or untouched
|
|||||||
holdout. At three hours, the broad 0.5-cent quote-gap rule still lost 0.63% per
|
holdout. At three hours, the broad 0.5-cent quote-gap rule still lost 0.63% per
|
||||||
event in holdout; only 0.61% of observations completed both legs while 23.33%
|
event in holdout; only 0.61% of observations completed both legs while 23.33%
|
||||||
produced adverse one-leg inventory. Wider quotes traded less but remained
|
produced adverse one-leg inventory. Wider quotes traded less but remained
|
||||||
negative. Strategy 57 therefore does not risk paper capital on an unproven
|
negative. Strategy 58 therefore does not risk paper capital on an unproven
|
||||||
maker rule.
|
maker rule.
|
||||||
|
|
||||||
Run `npm run evaluate:reward-maker` to stress current reward-qualified books
|
Run `npm run evaluate:reward-maker` to stress current reward-qualified books
|
||||||
|
|||||||
+161
-56
@@ -341,7 +341,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color
|
|||||||
<nav class="topnav">
|
<nav class="topnav">
|
||||||
<div class="brand">
|
<div class="brand">
|
||||||
<div class="logo">🏆</div>
|
<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 57 · maker research 2 · build 72</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 58 · maker research 2 · build 73</div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs" id="tabs">
|
<div class="tabs" id="tabs">
|
||||||
<button class="tab" data-tab="overview">Overview</button>
|
<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">
|
<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.
|
<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>
|
||||||
<div class="live-build-banner"><b>Build 72 active:</b> Favorite Backer's sports-favorite pilot now distinguishes a temporary trading pause from a resolved market. Paused positions stay open and cannot fire simulated stops, exits, or learner outcomes; only Polymarket's closed-market state books settlement. The pilot remains one 60–85% favorite per independent event near the 24-hour checkpoint, starts at 1.25% of equity, disables on materially negative completed evidence, and scales only after a positive confidence bound. Fresh cached snapshots remain usable for 90 minutes with timing rechecked locally. This remains paper trading; profits are not guaranteed.</div>
|
<div class="live-build-banner"><b>Build 73 active:</b> a fresh 3,000-market replay rejected the Strategy 57 sports-capital rule, so that exposure is retired at the next fresh mark. Favorite Backer now records zero-capital 12-hour, 60–75% sports observations and grades only closed markets. Capital stays at zero until 30 new independent forward events produce a positive lower confidence bound; only then can 1.25% positions begin. Temporary trading pauses cannot create exits or learner outcomes. Fresh cached snapshots remain usable for 90 minutes with timing rechecked locally. This remains paper trading; profits are not guaranteed.</div>
|
||||||
|
|
||||||
<!-- ============ OVERVIEW ============ -->
|
<!-- ============ OVERVIEW ============ -->
|
||||||
<section class="tabpanel" data-tab="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>
|
</section>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Build 72 · Adaptive strategy 57 · Maker research 2 · Paper trading only · Live prices from Polymarket's public Gamma and CLOB APIs · Not financial advice ·
|
Build 73 · Adaptive strategy 58 · Maker research 2 · 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>
|
<a class="market-link" href="https://github.com/theodore-song/polymarket-analyst" target="_blank" rel="noopener">Source on GitHub</a>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
@@ -774,10 +774,10 @@ const POLITICS_TREND_MIN_HOLD_HOURS = 72;
|
|||||||
const EXIT_CONFIRM_HOURS = 6;
|
const EXIT_CONFIRM_HOURS = 6;
|
||||||
const AGENTS_KEY = "pma_agents_v2";
|
const AGENTS_KEY = "pma_agents_v2";
|
||||||
const SUG_KEY = "pma_suggestions_v5";
|
const SUG_KEY = "pma_suggestions_v5";
|
||||||
const BUILD_VERSION = 72;
|
const BUILD_VERSION = 73;
|
||||||
const SUGGESTION_ENGINE_VERSION = 57;
|
const SUGGESTION_ENGINE_VERSION = 58;
|
||||||
const MAKER_STRATEGY_VERSION = 2;
|
const MAKER_STRATEGY_VERSION = 2;
|
||||||
const PREVIOUS_STRATEGY_VERSION = 56;
|
const PREVIOUS_STRATEGY_VERSION = 57;
|
||||||
const LEGACY_BUILD_STRATEGY_LINEAGE = Object.freeze({40:40,41:40});
|
const LEGACY_BUILD_STRATEGY_LINEAGE = Object.freeze({40:40,41:40});
|
||||||
function normalizedStrategyVersion(value){
|
function normalizedStrategyVersion(value){
|
||||||
const version=Number(value||0);
|
const version=Number(value||0);
|
||||||
@@ -870,7 +870,7 @@ const AGENTS = [
|
|||||||
rank:(s)=>[...s].sort((a,b)=>(b.volume_24hr*(b.conviction+20)*Math.max(.4,Math.abs(b.net_edge||b.edge||0)*18))-(a.volume_24hr*(a.conviction+20)*Math.max(.4,Math.abs(a.net_edge||a.edge||0)*18))),
|
rank:(s)=>[...s].sort((a,b)=>(b.volume_24hr*(b.conviction+20)*Math.max(.4,Math.abs(b.net_edge||b.edge||0)*18))-(a.volume_24hr*(a.conviction+20)*Math.max(.4,Math.abs(a.net_edge||a.edge||0)*18))),
|
||||||
maxNew:5, maxFrac:0.06, minConv:57, kelly:0.30, targetExposure:0.72, drawdownExposure:0.50},
|
maxNew:5, maxFrac:0.06, minConv:57, kelly:0.30, targetExposure:0.72, drawdownExposure:0.50},
|
||||||
{id:"favorite", name:"Favorite Backer", emoji:"🛡️", color:"#38d2e6", kind:"strategy",
|
{id:"favorite", name:"Favorite Backer", emoji:"🛡️", color:"#38d2e6", kind:"strategy",
|
||||||
blurb:"Runs a small pregame sports-favorite pilot derived from a 3,000-market chronological replay. It takes at most one 60–85% favorite per independent event near the 24-hour checkpoint, starts at 1.25% of equity, learns from completed positions and settlements, disables itself when live evidence turns materially negative, and scales only after a positive confidence bound.",
|
blurb:"Runs a forward-only sports research lane after the fresh 3,000-market replay rejected the old capital rule. It observes one 60–75% favorite per independent event near the 12-hour checkpoint with zero cash, grades only closed markets, and can begin 1.25% positions only after 30 new events establish a positive lower confidence bound.",
|
||||||
rank:(s)=>[...s].filter(x=>x.entry_price>=0.6).sort((a,b)=>(b.entry_price+Math.abs(b.net_edge||b.edge||0)+Number(b.evidence_score||0)*.2)-(a.entry_price+Math.abs(a.net_edge||a.edge||0)+Number(a.evidence_score||0)*.2)||b.conviction-a.conviction),
|
rank:(s)=>[...s].filter(x=>x.entry_price>=0.6).sort((a,b)=>(b.entry_price+Math.abs(b.net_edge||b.edge||0)+Number(b.evidence_score||0)*.2)-(a.entry_price+Math.abs(a.net_edge||a.edge||0)+Number(a.evidence_score||0)*.2)||b.conviction-a.conviction),
|
||||||
maxNew:4, maxFrac:0.05, minConv:58, kelly:0.24, targetExposure:0.58, drawdownExposure:0.38},
|
maxNew:4, maxFrac:0.05, minConv:58, kelly:0.24, targetExposure:0.58, drawdownExposure:0.38},
|
||||||
{id:"longshot", name:"Longshot Hunter", emoji:"🎰", color:"#fbbf24", kind:"strategy",
|
{id:"longshot", name:"Longshot Hunter", emoji:"🎰", color:"#fbbf24", kind:"strategy",
|
||||||
@@ -1174,14 +1174,15 @@ const NEG_RISK_MIN_LIQUIDITY=1000;
|
|||||||
const NEG_RISK_MIN_NET_PROFIT=0.003;
|
const NEG_RISK_MIN_NET_PROFIT=0.003;
|
||||||
const NEG_RISK_MIN_NET_RETURN=0.0015;
|
const NEG_RISK_MIN_NET_RETURN=0.0015;
|
||||||
const SPORTS_FAVORITE_MIN_ENTRY=0.60;
|
const SPORTS_FAVORITE_MIN_ENTRY=0.60;
|
||||||
const SPORTS_FAVORITE_MAX_ENTRY=0.85;
|
const SPORTS_FAVORITE_MAX_ENTRY=0.75;
|
||||||
const SPORTS_FAVORITE_TARGET_LEAD_HOURS=24;
|
const SPORTS_FAVORITE_TARGET_LEAD_HOURS=12;
|
||||||
const SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS=3;
|
const SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS=3;
|
||||||
const SPORTS_FAVORITE_PILOT_POSITION_PCT=0.0125;
|
const SPORTS_FAVORITE_PILOT_POSITION_PCT=0.0125;
|
||||||
const SPORTS_FAVORITE_PROMOTED_POSITION_PCT=0.025;
|
|
||||||
const SPORTS_FAVORITE_TOTAL_CAPITAL_PCT=0.06;
|
const SPORTS_FAVORITE_TOTAL_CAPITAL_PCT=0.06;
|
||||||
const SPORTS_FAVORITE_VERDICT_EVENTS=12;
|
const SPORTS_FAVORITE_VERDICT_EVENTS=12;
|
||||||
const SPORTS_FAVORITE_PROMOTION_EVENTS=30;
|
const SPORTS_FAVORITE_PROMOTION_EVENTS=30;
|
||||||
|
const SPORTS_FAVORITE_SHADOW_LIMIT=20;
|
||||||
|
const SPORTS_FAVORITE_OUTCOME_LIMIT=240;
|
||||||
const MAKER_MAX_QUOTES=6;
|
const MAKER_MAX_QUOTES=6;
|
||||||
const MAKER_MAX_QUOTE_CAPITAL_PCT=0.02;
|
const MAKER_MAX_QUOTE_CAPITAL_PCT=0.02;
|
||||||
const MAKER_TOTAL_CAPITAL_PCT=0.10;
|
const MAKER_TOTAL_CAPITAL_PCT=0.10;
|
||||||
@@ -1342,15 +1343,15 @@ function sportsFavoritePilotSuggestion(m){
|
|||||||
return {market_id:m.id,question:m.question,event:m.event,event_key:eventKey,url:m.url,category:m.category,tags:m.tags,
|
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,
|
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,
|
yes_price:m.yes_price,no_price:m.no_price,fair_value:+modeledEntry.toFixed(4),edge:0,net_edge:0,
|
||||||
friction:0.05,chase_penalty:0,evidence_score:0.60,evidence_source_count:0,quality:"sports-favorite-pilot",side,
|
friction:0.05,chase_penalty:0,evidence_score:0.60,evidence_source_count:0,quality:"sports-favorite-shadow",side,
|
||||||
market_price:+marketPrice.toFixed(4),entry_price:+modeledEntry.toFixed(4),conviction,volume:m.volume,volume_24hr:m.volume_24hr,liquidity:m.liquidity,
|
market_price:+marketPrice.toFixed(4),entry_price:+modeledEntry.toFixed(4),conviction,volume:m.volume,volume_24hr:m.volume_24hr,liquidity:m.liquidity,
|
||||||
spread:m.spread,price_change_1h:m.price_change_1h,price_change_1d:m.price_change_1d,price_change_1w:m.price_change_1w,
|
spread:m.spread,price_change_1h:m.price_change_1h,price_change_1d:m.price_change_1d,price_change_1w:m.price_change_1w,
|
||||||
momentum_strength:0,signal_strength:0.60,signal_confidence:0.60,signal_type:"sports-favorite-pilot",
|
momentum_strength:0,signal_strength:0.60,signal_confidence:0.60,signal_type:"sports-favorite-shadow",
|
||||||
trade_ready:true,entry_candidate:true,audited_observation_only:false,adaptive_promotion:false,watch_only:false,jump_risk:true,requires_live:false,
|
trade_ready:false,entry_candidate:false,audited_observation_only:true,adaptive_promotion:false,watch_only:true,jump_risk:true,requires_live:false,
|
||||||
game_start:m.game_start,hours_to_start:+lead.toFixed(2),days_to_resolution:m.days_to_resolution!=null?+m.days_to_resolution.toFixed(1):null,
|
game_start:m.game_start,hours_to_start:+lead.toFixed(2),days_to_resolution:m.days_to_resolution!=null?+m.days_to_resolution.toFixed(1):null,
|
||||||
pilot_prior:{markets:3000,event_legs:1,modeled_cost_cents:5,train_mean:0.02972,validation_mean:0.03102,holdout_mean:0.19826,strictly_promoted:false},
|
pilot_prior:{markets:3000,event_legs:1,modeled_cost_cents:5,train_mean:0.00960,validation_mean:0.15695,holdout_mean:0.00407,strictly_promoted:false},
|
||||||
drivers:["one position per sports event","60–85% pregame favorite","within three hours of the 24h checkpoint","five-cent modeled entry cost"],
|
drivers:["zero-capital forward observation","one observation per sports event","60–75% pregame favorite","within three hours of the 12h checkpoint","five-cent modeled entry cost"],
|
||||||
rationale:`Settlement pilot: ${side} is the ${Math.round(marketPrice*100)}% favorite ${lead.toFixed(1)}h before the published start. A 3,000-market chronological replay of this exact one-position-per-event rule had positive mean net returns in train, validation, and untouched holdout after a modeled five-cent cost, but early confidence bounds crossed zero. It therefore starts at 1.25% of equity, learns from every completed live position or settlement, and disables itself if those outcomes turn materially negative.`};
|
rationale:`Forward research only: ${side} is the ${Math.round(marketPrice*100)}% favorite ${lead.toFixed(1)}h before the published start. The fresh 3,000-market replay rejected the old 24-hour capital rule. This narrower 12-hour, 60–75% cohort had positive point estimates in all three chronological partitions after a modeled five-cent cost, but its confidence bounds did not establish a durable edge. It therefore uses zero cash and can earn 1.25% capital only after 30 new independent closed events produce a positive lower confidence bound.`};
|
||||||
}
|
}
|
||||||
function analyzeMarket(m,realWorldSignals={}){
|
function analyzeMarket(m,realWorldSignals={}){
|
||||||
if(m.volume<MIN_SCOUT_VOLUME||m.liquidity<MIN_SCOUT_LIQUIDITY)return null;
|
if(m.volume<MIN_SCOUT_VOLUME||m.liquidity<MIN_SCOUT_LIQUIDITY)return null;
|
||||||
@@ -1463,7 +1464,7 @@ function generateSuggestions(markets,total=SUGGESTION_TOTAL,perCategory=SUGGESTI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- Multi-agent store ---------- */
|
/* ---------- Multi-agent store ---------- */
|
||||||
function defaultPortfolio(){return {cash:STARTING_BALANCE,starting_balance:STARTING_BALANCE,positions:[],maker_quotes:[],maker_outcomes:[],closed:[],history:[],snapshots:[],stopped:{},lastDecision:null};}
|
function defaultPortfolio(){return {cash:STARTING_BALANCE,starting_balance:STARTING_BALANCE,positions:[],maker_quotes:[],maker_outcomes:[],sports_favorite_shadows:[],sports_favorite_outcomes:[],closed:[],history:[],snapshots:[],stopped:{},lastDecision:null};}
|
||||||
function defaultState(){const agents={};AGENTS.forEach(a=>agents[a.id]=defaultPortfolio());return {date:null,last_run:null,last_cycle_hour:null,
|
function defaultState(){const agents={};AGENTS.forEach(a=>agents[a.id]=defaultPortfolio());return {date:null,last_run:null,last_cycle_hour:null,
|
||||||
engine_version:BUILD_VERSION,strategy_version:SUGGESTION_ENGINE_VERSION,engine_started_at:nowIso(),build_started_at:nowIso(),agents,signal_ledger:defaultSignalLedger(),seeded:false};}
|
engine_version:BUILD_VERSION,strategy_version:SUGGESTION_ENGINE_VERSION,engine_started_at:nowIso(),build_started_at:nowIso(),agents,signal_ledger:defaultSignalLedger(),seeded:false};}
|
||||||
function reconcileStateVersions(st){
|
function reconcileStateVersions(st){
|
||||||
@@ -1505,6 +1506,8 @@ function loadState(){
|
|||||||
if(!st.agents[a.id].stopped)st.agents[a.id].stopped={};
|
if(!st.agents[a.id].stopped)st.agents[a.id].stopped={};
|
||||||
if(!Array.isArray(st.agents[a.id].maker_quotes))st.agents[a.id].maker_quotes=[];
|
if(!Array.isArray(st.agents[a.id].maker_quotes))st.agents[a.id].maker_quotes=[];
|
||||||
if(!Array.isArray(st.agents[a.id].maker_outcomes))st.agents[a.id].maker_outcomes=[];
|
if(!Array.isArray(st.agents[a.id].maker_outcomes))st.agents[a.id].maker_outcomes=[];
|
||||||
|
if(!Array.isArray(st.agents[a.id].sports_favorite_shadows))st.agents[a.id].sports_favorite_shadows=[];
|
||||||
|
if(!Array.isArray(st.agents[a.id].sports_favorite_outcomes))st.agents[a.id].sports_favorite_outcomes=[];
|
||||||
if(!("lastDecision" in st.agents[a.id]))st.agents[a.id].lastDecision=null;
|
if(!("lastDecision" in st.agents[a.id]))st.agents[a.id].lastDecision=null;
|
||||||
});
|
});
|
||||||
migrated=reconcileStateVersions(st)||migrated;
|
migrated=reconcileStateVersions(st)||migrated;
|
||||||
@@ -1518,6 +1521,8 @@ function compactPortfolioForSync(p,limits=SYNC_LIMITS){
|
|||||||
out.positions=Array.isArray(p.positions)?p.positions:[];
|
out.positions=Array.isArray(p.positions)?p.positions:[];
|
||||||
out.maker_quotes=Array.isArray(p.maker_quotes)?p.maker_quotes.slice(-MAKER_MAX_QUOTES):[];
|
out.maker_quotes=Array.isArray(p.maker_quotes)?p.maker_quotes.slice(-MAKER_MAX_QUOTES):[];
|
||||||
out.maker_outcomes=Array.isArray(p.maker_outcomes)?p.maker_outcomes.slice(-MAKER_OUTCOME_LIMIT):[];
|
out.maker_outcomes=Array.isArray(p.maker_outcomes)?p.maker_outcomes.slice(-MAKER_OUTCOME_LIMIT):[];
|
||||||
|
out.sports_favorite_shadows=Array.isArray(p.sports_favorite_shadows)?p.sports_favorite_shadows.slice(-SPORTS_FAVORITE_SHADOW_LIMIT):[];
|
||||||
|
out.sports_favorite_outcomes=Array.isArray(p.sports_favorite_outcomes)?p.sports_favorite_outcomes.slice(-SPORTS_FAVORITE_OUTCOME_LIMIT):[];
|
||||||
out.closed=Array.isArray(p.closed)?p.closed.slice(-limits.closed):[];
|
out.closed=Array.isArray(p.closed)?p.closed.slice(-limits.closed):[];
|
||||||
out.history=Array.isArray(p.history)?p.history.slice(-limits.history):[];
|
out.history=Array.isArray(p.history)?p.history.slice(-limits.history):[];
|
||||||
out.snapshots=Array.isArray(p.snapshots)?p.snapshots.slice(-limits.snapshots):[];
|
out.snapshots=Array.isArray(p.snapshots)?p.snapshots.slice(-limits.snapshots):[];
|
||||||
@@ -1618,7 +1623,7 @@ function offlineCachePolicy(ageMs){
|
|||||||
function prepareCycleSuggestions(suggestions,runMode,entriesAllowed){
|
function prepareCycleSuggestions(suggestions,runMode,entriesAllowed){
|
||||||
return (suggestions||[]).map(s=>{
|
return (suggestions||[]).map(s=>{
|
||||||
let next=s;
|
let next=s;
|
||||||
if((s.signal_type||"")==="sports-favorite-pilot"){
|
if(["sports-favorite-pilot","sports-favorite-shadow"].includes(s.signal_type||"")){
|
||||||
const lead=sportsFavoriteLeadHours(s),eligible=Number.isFinite(lead)
|
const lead=sportsFavoriteLeadHours(s),eligible=Number.isFinite(lead)
|
||||||
&&lead>=SPORTS_FAVORITE_TARGET_LEAD_HOURS-SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS
|
&&lead>=SPORTS_FAVORITE_TARGET_LEAD_HOURS-SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS
|
||||||
&&lead<=SPORTS_FAVORITE_TARGET_LEAD_HOURS+SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS;
|
&&lead<=SPORTS_FAVORITE_TARGET_LEAD_HOURS+SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS;
|
||||||
@@ -2037,6 +2042,11 @@ function buildAdaptiveProfile(p){
|
|||||||
}
|
}
|
||||||
function sportsFavoritePilotProfile(p){
|
function sportsFavoritePilotProfile(p){
|
||||||
const grouped=new Map();
|
const grouped=new Map();
|
||||||
|
(p&&p.sports_favorite_outcomes||[]).filter(outcome=>normalizedStrategyVersion(outcome.strategy_version)===SUGGESTION_ENGINE_VERSION)
|
||||||
|
.forEach((outcome,index)=>{
|
||||||
|
const key=String(outcome.event_key||outcome.market_id||`sports-shadow-${index}`);
|
||||||
|
const rows=grouped.get(key)||[];rows.push(clamp(Number(outcome.net_return||0),-1,2));grouped.set(key,rows);
|
||||||
|
});
|
||||||
(p&&p.closed||[]).filter(trade=>(trade.signal_type||"")==="sports-favorite-pilot"
|
(p&&p.closed||[]).filter(trade=>(trade.signal_type||"")==="sports-favorite-pilot"
|
||||||
&&normalizedStrategyVersion(trade.strategy_version)===SUGGESTION_ENGINE_VERSION).forEach((trade,index)=>{
|
&&normalizedStrategyVersion(trade.strategy_version)===SUGGESTION_ENGINE_VERSION).forEach((trade,index)=>{
|
||||||
const key=String(trade.event_key||trade.event||trade.market_id||`sports-pilot-${index}`);
|
const key=String(trade.event_key||trade.event||trade.market_id||`sports-pilot-${index}`);
|
||||||
@@ -2051,10 +2061,70 @@ function sportsFavoritePilotProfile(p){
|
|||||||
&&normalizedStrategyVersion(trade.strategy_version)===SUGGESTION_ENGINE_VERSION).reduce((sum,trade)=>sum+Number(trade.realized_pnl||0),0);
|
&&normalizedStrategyVersion(trade.strategy_version)===SUGGESTION_ENGINE_VERSION).reduce((sum,trade)=>sum+Number(trade.realized_pnl||0),0);
|
||||||
const lossLimit=-Math.max(1,Number(p&&p.starting_balance||STARTING_BALANCE))*0.025;
|
const lossLimit=-Math.max(1,Number(p&&p.starting_balance||STARTING_BALANCE))*0.025;
|
||||||
const demoted=(events>=SPORTS_FAVORITE_VERDICT_EVENTS&&(mean<=-0.05||upper<=0))||pnl<=lossLimit;
|
const demoted=(events>=SPORTS_FAVORITE_VERDICT_EVENTS&&(mean<=-0.05||upper<=0))||pnl<=lossLimit;
|
||||||
const promoted=!demoted&&events>=SPORTS_FAVORITE_PROMOTION_EVENTS&&lower>0.005&&pnl>0;
|
const shadowPnl=(p&&p.sports_favorite_outcomes||[]).filter(outcome=>normalizedStrategyVersion(outcome.strategy_version)===SUGGESTION_ENGINE_VERSION)
|
||||||
return {state:demoted?"demoted":(promoted?"promoted":"pilot"),allowed:!demoted,promoted,demoted,events,
|
.reduce((sum,outcome)=>sum+Number(outcome.pnl_per_100||0),0);
|
||||||
|
const forwardPositive=events>=SPORTS_FAVORITE_PROMOTION_EVENTS&&lower>0.005;
|
||||||
|
const capitalPromoted=!demoted&&forwardPositive;
|
||||||
|
return {state:demoted?"demoted":(capitalPromoted?"promoted":"shadow"),allowed:capitalPromoted,promoted:capitalPromoted,demoted,events,
|
||||||
mean:+mean.toFixed(4),lower:+lower.toFixed(4),upper:+upper.toFixed(4),pnl:+pnl.toFixed(2),
|
mean:+mean.toFixed(4),lower:+lower.toFixed(4),upper:+upper.toFixed(4),pnl:+pnl.toFixed(2),
|
||||||
position_pct:demoted?0:(promoted?SPORTS_FAVORITE_PROMOTED_POSITION_PCT:SPORTS_FAVORITE_PILOT_POSITION_PCT)};
|
shadow_pnl_per_100:+shadowPnl.toFixed(2),active_shadows:(p&&p.sports_favorite_shadows||[]).length,
|
||||||
|
position_pct:capitalPromoted?SPORTS_FAVORITE_PILOT_POSITION_PCT:0};
|
||||||
|
}
|
||||||
|
function applySportsFavoriteForwardPromotion(s,p){
|
||||||
|
if(!s||(s.signal_type||"")!=="sports-favorite-shadow")return s;
|
||||||
|
const profile=sportsFavoritePilotProfile(p);
|
||||||
|
if(!profile.promoted)return s;
|
||||||
|
return Object.assign({},s,{quality:"sports-favorite-pilot",signal_type:"sports-favorite-pilot",trade_ready:true,entry_candidate:true,
|
||||||
|
audited_observation_only:false,adaptive_promotion:true,watch_only:false,
|
||||||
|
rationale:`Forward promotion: ${profile.events} independent closed Strategy ${SUGGESTION_ENGINE_VERSION} observations produced a ${(profile.mean*100).toFixed(2)}% mean and ${(profile.lower*100).toFixed(2)}% 90% lower confidence bound after modeled cost. Capital begins at 1.25% of equity. ${s.rationale||""}`});
|
||||||
|
}
|
||||||
|
function stageSportsFavoriteShadows(p,suggestions,{execute=true}={}){
|
||||||
|
p.sports_favorite_shadows=Array.isArray(p.sports_favorite_shadows)?p.sports_favorite_shadows:[];
|
||||||
|
p.sports_favorite_outcomes=Array.isArray(p.sports_favorite_outcomes)?p.sports_favorite_outcomes:[];
|
||||||
|
if(!execute)return {active:p.sports_favorite_shadows.length,staged:0,candidates:0};
|
||||||
|
const usedEvents=new Set([...p.sports_favorite_shadows,...p.sports_favorite_outcomes]
|
||||||
|
.filter(row=>normalizedStrategyVersion(row.strategy_version)===SUGGESTION_ENGINE_VERSION)
|
||||||
|
.map(row=>String(row.event_key||row.event||row.market_id)));
|
||||||
|
const usedMarkets=new Set([...p.sports_favorite_shadows,...p.sports_favorite_outcomes]
|
||||||
|
.filter(row=>normalizedStrategyVersion(row.strategy_version)===SUGGESTION_ENGINE_VERSION).map(row=>String(row.market_id)));
|
||||||
|
const candidates=(suggestions||[]).filter(s=>(s.signal_type||"")==="sports-favorite-shadow");
|
||||||
|
let staged=0;
|
||||||
|
for(const s of candidates){
|
||||||
|
if(p.sports_favorite_shadows.length>=SPORTS_FAVORITE_SHADOW_LIMIT)break;
|
||||||
|
const eventKey=String(s.event_key||s.event||s.market_id),marketId=String(s.market_id);
|
||||||
|
if(usedEvents.has(eventKey)||usedMarkets.has(marketId))continue;
|
||||||
|
const openedAt=cycleIso();
|
||||||
|
p.sports_favorite_shadows.push({id:`sports-shadow:${marketId}:${Date.now()}:${staged}`,market_id:marketId,event_key:eventKey,
|
||||||
|
question:s.question,event:s.event||"",side:s.side,entry_price:Number(s.entry_price),market_price:Number(s.market_price),
|
||||||
|
current_price:Number(s.market_price),game_start:s.game_start,hours_to_start:s.hours_to_start,opened_at:openedAt,
|
||||||
|
strategy_version:SUGGESTION_ENGINE_VERSION,modeled_cost:0.05,url:s.url||""});
|
||||||
|
p.history.push({date:logDay(),action:"SPORTS_SHADOW",question:s.question,side:s.side,
|
||||||
|
detail:`Zero-capital forward observation recorded ${s.side} '${s.question.slice(0,40)}' at modeled ${pct(s.entry_price)} (${pct(s.market_price)} market + 5c cost) · one observation for event ${eventKey} · cash unchanged`});
|
||||||
|
usedEvents.add(eventKey);usedMarkets.add(marketId);staged++;
|
||||||
|
}
|
||||||
|
return {active:p.sports_favorite_shadows.length,staged,candidates:candidates.length};
|
||||||
|
}
|
||||||
|
function manageSportsFavoriteShadows(p,priceMap,{execute=true}={}){
|
||||||
|
p.sports_favorite_shadows=Array.isArray(p.sports_favorite_shadows)?p.sports_favorite_shadows:[];
|
||||||
|
p.sports_favorite_outcomes=Array.isArray(p.sports_favorite_outcomes)?p.sports_favorite_outcomes:[];
|
||||||
|
if(!execute)return {active:p.sports_favorite_shadows.length,completed:0};
|
||||||
|
const keep=[];let completed=0;
|
||||||
|
for(const row of p.sports_favorite_shadows){
|
||||||
|
const fresh=priceMap&&priceMap[String(row.market_id)];
|
||||||
|
if(!fresh){keep.push(row);continue;}
|
||||||
|
const price=Number(row.side==="YES"?fresh.yes_price:fresh.no_price);
|
||||||
|
if(Number.isFinite(price))row.current_price=+price.toFixed(4);
|
||||||
|
if(!marketIsSettled(fresh)){if(marketIsSuspended(fresh))row.price_status="orders-paused";keep.push(row);continue;}
|
||||||
|
const entry=Math.max(0.01,Number(row.entry_price||0)),netReturn=clamp(price/entry-1,-1,2),pnlPer100=netReturn*100;
|
||||||
|
if(!p.sports_favorite_outcomes.some(outcome=>outcome.id===row.id))p.sports_favorite_outcomes.push(Object.assign({},row,{closed_at:cycleIso(),
|
||||||
|
exit_price:+price.toFixed(4),net_return:+netReturn.toFixed(4),pnl_per_100:+pnlPer100.toFixed(2)}));
|
||||||
|
p.history.push({date:logDay(),action:"SPORTS_GRADE",question:row.question,side:row.side,
|
||||||
|
detail:`Forward sports observation settled at ${pct(price)} · modeled net return ${(netReturn*100).toFixed(2)}% after the five-cent cost · portfolio cash unchanged`});
|
||||||
|
completed++;
|
||||||
|
}
|
||||||
|
p.sports_favorite_shadows=keep;
|
||||||
|
p.sports_favorite_outcomes=p.sports_favorite_outcomes.slice(-SPORTS_FAVORITE_OUTCOME_LIMIT);
|
||||||
|
return {active:keep.length,completed};
|
||||||
}
|
}
|
||||||
function stableHash(text){
|
function stableHash(text){
|
||||||
let h=2166136261;
|
let h=2166136261;
|
||||||
@@ -3196,6 +3266,7 @@ async function runDailyCycle(){
|
|||||||
AGENTS.forEach(a=>
|
AGENTS.forEach(a=>
|
||||||
(st.agents[a.id].positions||[]).forEach(pos=>{if(pos.market_id)positionIds.add(String(pos.market_id));}));
|
(st.agents[a.id].positions||[]).forEach(pos=>{if(pos.market_id)positionIds.add(String(pos.market_id));}));
|
||||||
AGENTS.forEach(a=>(st.agents[a.id].maker_quotes||[]).forEach(quote=>{if(quote.market_id)positionIds.add(String(quote.market_id));}));
|
AGENTS.forEach(a=>(st.agents[a.id].maker_quotes||[]).forEach(quote=>{if(quote.market_id)positionIds.add(String(quote.market_id));}));
|
||||||
|
AGENTS.forEach(a=>(st.agents[a.id].sports_favorite_shadows||[]).forEach(row=>{if(row.market_id)positionIds.add(String(row.market_id));}));
|
||||||
setStatus("marking positions…",true);
|
setStatus("marking positions…",true);
|
||||||
const priceMap={};
|
const priceMap={};
|
||||||
const cachedById={};
|
const cachedById={};
|
||||||
@@ -3223,11 +3294,13 @@ async function runDailyCycle(){
|
|||||||
saveSuggestions(sugs,markets.length,analysisMarkets.length);
|
saveSuggestions(sugs,markets.length,analysisMarkets.length);
|
||||||
saveMarketCache(analysisMarkets,sugs,priceMap);
|
saveMarketCache(analysisMarkets,sugs,priceMap);
|
||||||
}
|
}
|
||||||
|
const cachePolicy=offlineCachePolicy(cacheAgeMs);
|
||||||
|
const executeTrades=runMode==="live"||cachePolicy.exitsAllowed;
|
||||||
|
const favoritePortfolio=st.agents.favorite;
|
||||||
|
const sportsShadowActivity=manageSportsFavoriteShadows(favoritePortfolio,priceMap,{execute:runMode==="live"&&executeTrades});
|
||||||
setStatus("ten strategy agents trading…",true);
|
setStatus("ten strategy agents trading…",true);
|
||||||
const preBoard=AGENTS.map(a=>({id:a.id,eq:equity(st.agents[a.id])})).sort((x,y)=>y.eq-x.eq);
|
const preBoard=AGENTS.map(a=>({id:a.id,eq:equity(st.agents[a.id])})).sort((x,y)=>y.eq-x.eq);
|
||||||
const leaderEq=preBoard[0]?preBoard[0].eq:STARTING_BALANCE;
|
const leaderEq=preBoard[0]?preBoard[0].eq:STARTING_BALANCE;
|
||||||
const cachePolicy=offlineCachePolicy(cacheAgeMs);
|
|
||||||
const executeTrades=runMode==="live"||cachePolicy.exitsAllowed;
|
|
||||||
const quoteMarketMap=Object.assign({},cachedById,freshById);
|
const quoteMarketMap=Object.assign({},cachedById,freshById);
|
||||||
const allMakerQuotes=AGENTS.flatMap(agent=>st.agents[agent.id].maker_quotes||[]);
|
const allMakerQuotes=AGENTS.flatMap(agent=>st.agents[agent.id].maker_quotes||[]);
|
||||||
if(runMode==="live"&&allMakerQuotes.length)setStatus("verifying resting quote touches…",true);
|
if(runMode==="live"&&allMakerQuotes.length)setStatus("verifying resting quote touches…",true);
|
||||||
@@ -3255,7 +3328,16 @@ async function runDailyCycle(){
|
|||||||
const decision=adaptiveDecision(cfg,p,rank,preBoard.length,leaderEq,marketLearning);
|
const decision=adaptiveDecision(cfg,p,rank,preBoard.length,leaderEq,marketLearning);
|
||||||
const occupied=occupiedStrategyMarkets(st,cfg.id);
|
const occupied=occupiedStrategyMarkets(st,cfg.id);
|
||||||
claimedMarkets.forEach(id=>occupied.add(id));
|
claimedMarkets.forEach(id=>occupied.add(id));
|
||||||
openPositions(p,cfg,cfg.rank(cycleSuggestions),focus,decision,occupied,peerMarketStats(st,cfg.id)).forEach(id=>claimedMarkets.add(id));
|
const agentCycleSuggestions=cfg.id==="favorite"
|
||||||
|
?cycleSuggestions.map(s=>applySportsFavoriteForwardPromotion(s,p)):cycleSuggestions;
|
||||||
|
openPositions(p,cfg,cfg.rank(agentCycleSuggestions),focus,decision,occupied,peerMarketStats(st,cfg.id)).forEach(id=>claimedMarkets.add(id));
|
||||||
|
if(cfg.id==="favorite"){
|
||||||
|
const shadowStage=stageSportsFavoriteShadows(p,cycleSuggestions,{execute:runMode==="live"&&entriesAllowed});
|
||||||
|
p.lastDecision=Object.assign({},p.lastDecision,{sportsShadowActive:shadowStage.active,sportsShadowStaged:shadowStage.staged,
|
||||||
|
sportsShadowCandidates:shadowStage.candidates,sportsShadowCompleted:sportsShadowActivity.completed,
|
||||||
|
sportsFavoritePilot:sportsFavoritePilotProfile(p)});
|
||||||
|
p.lastDecision.allocationStatus=`${p.lastDecision.allocationStatus||""} Sports forward learner: ${shadowStage.active} zero-capital observation${shadowStage.active===1?"":"s"} active, ${sportsShadowActivity.completed} closed outcome${sportsShadowActivity.completed===1?"":"s"} graded this cycle; no capital is allowed before the forward confidence gate promotes.`.trim();
|
||||||
|
}
|
||||||
if(runMode==="live"&&entriesAllowed){
|
if(runMode==="live"&&entriesAllowed){
|
||||||
const agentIndex=AGENTS.findIndex(agent=>agent.id===cfg.id),makerActivity=makerActivityByAgent[cfg.id];
|
const agentIndex=AGENTS.findIndex(agent=>agent.id===cfg.id),makerActivity=makerActivityByAgent[cfg.id];
|
||||||
const staged=stageMakerQuotes(p,[...makerAuditCandidates,...analysisMarkets],{profile:sharedMakerProfile,agentIndex,agentCount:AGENTS.length,
|
const staged=stageMakerQuotes(p,[...makerAuditCandidates,...analysisMarkets],{profile:sharedMakerProfile,agentIndex,agentCount:AGENTS.length,
|
||||||
@@ -3465,15 +3547,15 @@ function decisionSummary(p){
|
|||||||
}
|
}
|
||||||
const makerStats=d.makerProfile&&d.makerProfile.global;
|
const makerStats=d.makerProfile&&d.makerProfile.global;
|
||||||
const maker=d.makerQuotes!=null?` Maker learner: ${d.makerShadowActive||0} zero-capital shadow observations and ${d.makerCapitalActive||0} evidence-promoted capital quotes active; ${d.makerFills||0} verified touches and ${d.makerShadowCompleted||0} shadow outcomes completed this cycle, ${fmtUSD(d.makerReserved||0)} capital reserved.${makerStats?` Event-clustered ledger: ${makerStats.attempts} attempts / ${makerStats.events} events, ${makerStats.locked} paired touches, ${makerStats.adverse} adverse single touches, ${makerStats.unfilled} unfilled, ${fmtUSD(makerStats.shadow_pnl)} simulated shadow net and ${fmtUSD(makerStats.pnl)} actual paper net.`:""} Capital promotion requires ${MAKER_MIN_COHORT_ATTEMPTS} current-strategy events with positive confidence bounds in both category and spread cohorts. Rewards remain excluded until externally verified.`:"";
|
const maker=d.makerQuotes!=null?` Maker learner: ${d.makerShadowActive||0} zero-capital shadow observations and ${d.makerCapitalActive||0} evidence-promoted capital quotes active; ${d.makerFills||0} verified touches and ${d.makerShadowCompleted||0} shadow outcomes completed this cycle, ${fmtUSD(d.makerReserved||0)} capital reserved.${makerStats?` Event-clustered ledger: ${makerStats.attempts} attempts / ${makerStats.events} events, ${makerStats.locked} paired touches, ${makerStats.adverse} adverse single touches, ${makerStats.unfilled} unfilled, ${fmtUSD(makerStats.shadow_pnl)} simulated shadow net and ${fmtUSD(makerStats.pnl)} actual paper net.`:""} Capital promotion requires ${MAKER_MIN_COHORT_ATTEMPTS} current-strategy events with positive confidence bounds in both category and spread cohorts. Rewards remain excluded until externally verified.`:"";
|
||||||
const sportsPilot=d.sportsFavoritePilot?` Sports-favorite outcome learner: ${d.sportsFavoritePilot.state}, ${d.sportsFavoritePilot.events} independent completed 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.pnl)} realized. Position cap ${(d.sportsFavoritePilot.position_pct*100).toFixed(2)}%; it disables after material negative completed-position evidence and scales only after ${SPORTS_FAVORITE_PROMOTION_EVENTS} events with a positive lower bound.`:"";
|
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.`:"";
|
||||||
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}${exposure}${allocation}${candidates}${blockers}`;
|
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}${exposure}${allocation}${candidates}${blockers}`;
|
||||||
}
|
}
|
||||||
function renderAgentBrief(cfg,p,st){
|
function renderAgentBrief(cfg,p,st){
|
||||||
const root=$("agentBrief"); if(!root)return;
|
const root=$("agentBrief"); if(!root)return;
|
||||||
const bw=bestAndWorst(p);
|
const bw=bestAndWorst(p);
|
||||||
const risk=cfg.aggressive?"Extreme risk":cfg.maxFrac>=0.055?"Active":cfg.maxFrac<=0.04?"Broad active":"Disciplined";
|
const risk=cfg.aggressive?"Extreme risk":cfg.maxFrac>=0.055?"Active":cfg.maxFrac<=0.04?"Broad active":"Disciplined";
|
||||||
const cadence=cfg.id==="favorite"?"One 1.25% pilot position per independent sports event near the 24h checkpoint":`${cfg.maxNew||0} new trades max per cycle`;
|
const cadence=cfg.id==="favorite"?"Zero-capital 12h sports observations until 30 forward events promote 1.25% positions":`${cfg.maxNew||0} new trades max per cycle`;
|
||||||
const exitRule=cfg.id==="favorite"?"Hold the pregame favorite toward settlement unless the 18% stop or profit-lock rules fire; completed outcomes update the self-disabling learner"
|
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"
|
||||||
:`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`;
|
:`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 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("; ");
|
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("; ");
|
||||||
@@ -3723,6 +3805,7 @@ function renderPortfolioTab(){
|
|||||||
{ic:"🕒",label:"24h change",value:format24h(change24h),cls:signClass(change24h.pct)},
|
{ic:"🕒",label:"24h change",value:format24h(change24h),cls:signClass(change24h.pct)},
|
||||||
{ic:"🧪",label:"Adaptive",value:fmtPct(engineBase>0?(eq/engineBase-1)*100:0),cls:signClass(enginePnl)},
|
{ic:"🧪",label:"Adaptive",value:fmtPct(engineBase>0?(eq/engineBase-1)*100:0),cls:signClass(enginePnl)},
|
||||||
{ic:"📂",label:"Open",value:p.positions.length},
|
{ic:"📂",label:"Open",value:p.positions.length},
|
||||||
|
{ic:"◌",label:"Sports shadow",value:(p.sports_favorite_shadows||[]).length},
|
||||||
{ic:"⇄",label:"Maker shadow",value:(p.maker_quotes||[]).filter(quote=>quote.shadow_only).length},
|
{ic:"⇄",label:"Maker shadow",value:(p.maker_quotes||[]).filter(quote=>quote.shadow_only).length},
|
||||||
{ic:"Σ",label:"Maker paper net",value:fmtUSD(makerProfile.global.pnl),cls:signClass(makerProfile.global.pnl)},
|
{ic:"Σ",label:"Maker paper net",value:fmtUSD(makerProfile.global.pnl),cls:signClass(makerProfile.global.pnl)},
|
||||||
];
|
];
|
||||||
@@ -3778,7 +3861,7 @@ function agentCompetitionPlan(cfg,row,rank,leader){
|
|||||||
if(rank===1)return "Plan: press the lead through the strongest qualifying trades while keeping stop-loss and exposure limits active.";
|
if(rank===1)return "Plan: press the lead through the strongest qualifying trades while keeping stop-loss and exposure limits active.";
|
||||||
if(cfg.id==="value")return "Plan: close the gap with complete pricing bundles and paired resting bids, counting return only after both complementary legs fill below their combined payout and unwinding unmatched inventory after 24 hours.";
|
if(cfg.id==="value")return "Plan: close the gap with complete pricing bundles and paired resting bids, counting return only after both complementary legs fill below their combined payout and unwinding unmatched inventory after 24 hours.";
|
||||||
if(cfg.id==="momentum")return "Plan: attack fast-moving markets where fresh volume confirms attention, hoping speed beats slower value strategies.";
|
if(cfg.id==="momentum")return "Plan: attack fast-moving markets where fresh volume confirms attention, hoping speed beats slower value strategies.";
|
||||||
if(cfg.id==="favorite")return "Plan: take one carefully sized 60–85% sports favorite per independent event near the 24-hour pregame checkpoint, then let completed settlements decide whether the pilot stops, stays small, or earns promotion.";
|
if(cfg.id==="favorite")return "Plan: record one zero-capital 60–75% sports favorite per independent event near the 12-hour pregame checkpoint, grade only closed markets, and refuse capital until 30 new forward events establish a positive lower confidence bound.";
|
||||||
if(cfg.id==="longshot")return "Plan: keep risk small but search for one underpriced outsider that can reprice sharply and leapfrog the leaderboard.";
|
if(cfg.id==="longshot")return "Plan: keep risk small but search for one underpriced outsider that can reprice sharply and leapfrog the leaderboard.";
|
||||||
if(cfg.id==="diversifier")return "Plan: spread bets broadly, reduce single-market damage, and try to win through consistency rather than one heroic call.";
|
if(cfg.id==="diversifier")return "Plan: spread bets broadly, reduce single-market damage, and try to win through consistency rather than one heroic call.";
|
||||||
if(cfg.id==="catalyst")return "Plan: deploy quickly when fresh real-world context and measured edge align, then concentrate enough capital for a catalyst repricing to move the account.";
|
if(cfg.id==="catalyst")return "Plan: deploy quickly when fresh real-world context and measured edge align, then concentrate enough capital for a catalyst repricing to move the account.";
|
||||||
@@ -5072,6 +5155,9 @@ window.PMA_ENGINE_DIAGNOSTICS=Object.freeze({
|
|||||||
boundedStakeForRisk,
|
boundedStakeForRisk,
|
||||||
sportsFavoritePilotSuggestion,
|
sportsFavoritePilotSuggestion,
|
||||||
sportsFavoritePilotProfile,
|
sportsFavoritePilotProfile,
|
||||||
|
applySportsFavoriteForwardPromotion,
|
||||||
|
stageSportsFavoriteShadows,
|
||||||
|
manageSportsFavoriteShadows,
|
||||||
marketIsSettled,
|
marketIsSettled,
|
||||||
marketIsSuspended,
|
marketIsSuspended,
|
||||||
historicalPriceFeatures,
|
historicalPriceFeatures,
|
||||||
@@ -5101,9 +5187,10 @@ window.PMA_ENGINE_DIAGNOSTICS=Object.freeze({
|
|||||||
emotionCanIncreaseSize:false,dualPromotionPeerBoostPct:5,
|
emotionCanIncreaseSize:false,dualPromotionPeerBoostPct:5,
|
||||||
sportsFavoritePilot:{entryBand:[SPORTS_FAVORITE_MIN_ENTRY,SPORTS_FAVORITE_MAX_ENTRY],targetLeadHours:SPORTS_FAVORITE_TARGET_LEAD_HOURS,
|
sportsFavoritePilot:{entryBand:[SPORTS_FAVORITE_MIN_ENTRY,SPORTS_FAVORITE_MAX_ENTRY],targetLeadHours:SPORTS_FAVORITE_TARGET_LEAD_HOURS,
|
||||||
leadToleranceHours:SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS,pilotPositionPct:SPORTS_FAVORITE_PILOT_POSITION_PCT*100,
|
leadToleranceHours:SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS,pilotPositionPct:SPORTS_FAVORITE_PILOT_POSITION_PCT*100,
|
||||||
promotedPositionPct:SPORTS_FAVORITE_PROMOTED_POSITION_PCT*100,totalCapitalPct:SPORTS_FAVORITE_TOTAL_CAPITAL_PCT*100,
|
totalCapitalPct:SPORTS_FAVORITE_TOTAL_CAPITAL_PCT*100,shadowLimit:SPORTS_FAVORITE_SHADOW_LIMIT,
|
||||||
verdictEvents:SPORTS_FAVORITE_VERDICT_EVENTS,promotionEvents:SPORTS_FAVORITE_PROMOTION_EVENTS,modeledCostCents:5},
|
verdictEvents:SPORTS_FAVORITE_VERDICT_EVENTS,promotionEvents:SPORTS_FAVORITE_PROMOTION_EVENTS,modeledCostCents:5,
|
||||||
historicalPrior:"All broad directional and corrected settlement-calibration rules failed clean validation and remain observation-only. The one-event 60%-85% sports-favorite rule has positive point estimates in all three chronological partitions but crossed confidence bounds, so only Favorite Backer receives a capped, self-disabling paper pilot. Live-priced complete negative-risk bundles may trade; paired maker quotes remain zero-capital observations until current cohorts independently promote"}),
|
capitalRequiresForwardPromotion:true,old24HourCapitalRuleRetired:true},
|
||||||
|
historicalPrior:"All broad directional and corrected settlement-calibration rules failed clean validation and remain observation-only. The fresh 3,000-market replay rejected the Strategy 57 24-hour sports-capital rule: -11.98% train and -4.04% untouched holdout means after modeled cost. Favorite Backer now records a zero-capital 12-hour, 60%-75% forward cohort and requires 30 new independent closed events with a positive lower confidence bound before any capital. Live-priced complete negative-risk bundles may trade; paired maker quotes remain zero-capital observations until current cohorts independently promote"}),
|
||||||
});
|
});
|
||||||
function runEngineSelfTest(){
|
function runEngineSelfTest(){
|
||||||
const market=(overrides={})=>Object.assign({
|
const market=(overrides={})=>Object.assign({
|
||||||
@@ -5122,27 +5209,32 @@ function runEngineSelfTest(){
|
|||||||
const pathBarrierContract=analyzeMarket(market({id:"barrier-test",question:"Will Bitcoin reach $66,000 August 17-23?",category:"Crypto"}),news);
|
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 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 ordinaryDatedContract=analyzeMarket(market({id:"dated-test",question:"Will the policy pass on 2026-08-22?"}),news);
|
||||||
const sportsPilotStart=new Date(Date.now()+24*3600000).toISOString();
|
const sportsPilotStart=new Date(Date.now()+12*3600000).toISOString();
|
||||||
const sportsPilot=analyzeMarket(market({id:"sports-pilot",question:"Will Harbor FC win tomorrow?",event:"Harbor FC vs City FC",event_id:"sports-event-1",
|
const sportsPilot=analyzeMarket(market({id:"sports-pilot",question:"Will Harbor FC win tomorrow?",event:"Harbor FC vs City FC",event_id:"sports-event-1",
|
||||||
category:"Sports",yes_price:0.72,no_price:0.28,game_start:sportsPilotStart,days_to_resolution:1,price_change_1h:0,price_change_1d:0,price_change_1w:0}),news);
|
category:"Sports",yes_price:0.72,no_price:0.28,game_start:sportsPilotStart,days_to_resolution:1,price_change_1h:0,price_change_1d:0,price_change_1w:0}),news);
|
||||||
const sportsPilotSecond=Object.assign({},sportsPilot,{market_id:"sports-pilot-second",question:"Harbor FC first-half winner?"});
|
const sportsPilotSecond=Object.assign({},sportsPilot,{market_id:"sports-pilot-second",question:"Harbor FC first-half winner?"});
|
||||||
const sportsPilotBook=defaultPortfolio(),favoriteAgent=AGENTS.find(agent=>agent.id==="favorite");
|
const sportsPilotBook=defaultPortfolio(),favoriteAgent=AGENTS.find(agent=>agent.id==="favorite"),sportsPilotCash=sportsPilotBook.cash;
|
||||||
const sportsPilotDecision=adaptiveDecision(favoriteAgent,sportsPilotBook,1,AGENTS.length,STARTING_BALANCE,buildSignalCalibration(defaultSignalLedger()));
|
const sportsShadowStage=stageSportsFavoriteShadows(sportsPilotBook,[sportsPilot,sportsPilotSecond]);
|
||||||
openPositions(sportsPilotBook,favoriteAgent,favoriteAgent.rank([sportsPilot,sportsPilotSecond]),"All",sportsPilotDecision,new Set(),{});
|
const pausedSportsGrade=manageSportsFavoriteShadows(sportsPilotBook,{"sports-pilot":market({id:"sports-pilot",yes_price:0.72,no_price:0.28,closed:false,accepting_orders:false})});
|
||||||
|
const settledSportsGrade=manageSportsFavoriteShadows(sportsPilotBook,{"sports-pilot":market({id:"sports-pilot",yes_price:1,no_price:0,closed:true,accepting_orders:false})});
|
||||||
|
const offlineSportsBook=defaultPortfolio();stageSportsFavoriteShadows(offlineSportsBook,[sportsPilot]);
|
||||||
|
const offlineSportsGrade=manageSportsFavoriteShadows(offlineSportsBook,{"sports-pilot":market({id:"sports-pilot",yes_price:1,no_price:0,closed:true,accepting_orders:false})},{execute:false});
|
||||||
|
const offlineSportsStayedPending=offlineSportsGrade.completed===0&&offlineSportsBook.sports_favorite_shadows.length===1&&offlineSportsBook.sports_favorite_outcomes.length===0;
|
||||||
|
const compactedSportsBook=compactPortfolioForSync(Object.assign({},offlineSportsBook,{sports_favorite_outcomes:[...sportsPilotBook.sports_favorite_outcomes]}));
|
||||||
const freshOfflineSportsPilot=prepareCycleSuggestions([sportsPilot],"offline-cache",true)[0];
|
const freshOfflineSportsPilot=prepareCycleSuggestions([sportsPilot],"offline-cache",true)[0];
|
||||||
const expiredOfflineSportsPilot=prepareCycleSuggestions([Object.assign({},sportsPilot,{game_start:new Date(Date.now()+10*3600000).toISOString()})],"offline-cache",true)[0];
|
const expiredOfflineSportsPilot=prepareCycleSuggestions([Object.assign({},sportsPilot,{game_start:new Date(Date.now()+4*3600000).toISOString()})],"offline-cache",true)[0];
|
||||||
const losingSportsPilotBook=defaultPortfolio();
|
const losingSportsPilotBook=defaultPortfolio();
|
||||||
for(let i=0;i<SPORTS_FAVORITE_VERDICT_EVENTS;i++)losingSportsPilotBook.closed.push({strategy_version:SUGGESTION_ENGINE_VERSION,
|
for(let i=0;i<SPORTS_FAVORITE_VERDICT_EVENTS;i++)losingSportsPilotBook.sports_favorite_outcomes.push({strategy_version:SUGGESTION_ENGINE_VERSION,
|
||||||
signal_type:"sports-favorite-pilot",event_key:`losing-sports-event-${i}`,market_id:`losing-sports-${i}`,original_cost:100,realized_pnl:-10});
|
event_key:`losing-sports-event-${i}`,market_id:`losing-sports-${i}`,net_return:-0.10,pnl_per_100:-10});
|
||||||
const losingSportsPilotProfile=sportsFavoritePilotProfile(losingSportsPilotBook);
|
const losingSportsPilotProfile=sportsFavoritePilotProfile(losingSportsPilotBook);
|
||||||
const losingSportsPilotDecision=adaptiveDecision(favoriteAgent,losingSportsPilotBook,1,AGENTS.length,STARTING_BALANCE,buildSignalCalibration(defaultSignalLedger()));
|
const unpromotedSportsSuggestion=applySportsFavoriteForwardPromotion(sportsPilot,losingSportsPilotBook);
|
||||||
openPositions(losingSportsPilotBook,favoriteAgent,favoriteAgent.rank([sportsPilot]),"All",losingSportsPilotDecision,new Set(),{});
|
|
||||||
const promotedSportsPilotBook=defaultPortfolio();
|
const promotedSportsPilotBook=defaultPortfolio();
|
||||||
for(let i=0;i<SPORTS_FAVORITE_PROMOTION_EVENTS;i++)promotedSportsPilotBook.closed.push({strategy_version:SUGGESTION_ENGINE_VERSION,
|
for(let i=0;i<SPORTS_FAVORITE_PROMOTION_EVENTS;i++)promotedSportsPilotBook.sports_favorite_outcomes.push({strategy_version:SUGGESTION_ENGINE_VERSION,
|
||||||
signal_type:"sports-favorite-pilot",event_key:`winning-sports-event-${i}`,market_id:`winning-sports-${i}`,original_cost:100,realized_pnl:10});
|
event_key:`winning-sports-event-${i}`,market_id:`winning-sports-${i}`,net_return:0.10,pnl_per_100:10});
|
||||||
const promotedSportsPilotProfile=sportsFavoritePilotProfile(promotedSportsPilotBook);
|
const promotedSportsPilotProfile=sportsFavoritePilotProfile(promotedSportsPilotBook);
|
||||||
|
const promotedSportsSuggestion=applySportsFavoriteForwardPromotion(sportsPilot,promotedSportsPilotBook);
|
||||||
const promotedSportsPilotDecision=adaptiveDecision(favoriteAgent,promotedSportsPilotBook,1,AGENTS.length,STARTING_BALANCE,buildSignalCalibration(defaultSignalLedger()));
|
const promotedSportsPilotDecision=adaptiveDecision(favoriteAgent,promotedSportsPilotBook,1,AGENTS.length,STARTING_BALANCE,buildSignalCalibration(defaultSignalLedger()));
|
||||||
openPositions(promotedSportsPilotBook,favoriteAgent,favoriteAgent.rank([sportsPilot]),"All",promotedSportsPilotDecision,new Set(),{});
|
openPositions(promotedSportsPilotBook,favoriteAgent,favoriteAgent.rank([promotedSportsSuggestion,Object.assign({},promotedSportsSuggestion,{market_id:"sports-pilot-second"})]),"All",promotedSportsPilotDecision,new Set(),{});
|
||||||
const sportsPilotExit=exitReason({signal_type:"sports-favorite-pilot",entry_price:0.77,current_price:0.72,opened_at:nowIso(),unrealized_pnl:-5,quality:"sports-favorite-pilot"},
|
const sportsPilotExit=exitReason({signal_type:"sports-favorite-pilot",entry_price:0.77,current_price:0.72,opened_at:nowIso(),unrealized_pnl:-5,quality:"sports-favorite-pilot"},
|
||||||
market({category:"Sports",question:"Will Harbor FC win tomorrow?",game_start:sportsPilotStart,days_to_resolution:1}),null,favoriteAgent);
|
market({category:"Sports",question:"Will Harbor FC win tomorrow?",game_start:sportsPilotStart,days_to_resolution:1}),null,favoriteAgent);
|
||||||
const targets=window.PMA_ENGINE_DIAGNOSTICS.gainStopTargets(0.82);
|
const targets=window.PMA_ENGINE_DIAGNOSTICS.gainStopTargets(0.82);
|
||||||
@@ -5304,6 +5396,9 @@ function runEngineSelfTest(){
|
|||||||
const retiredFixture=accountingBook(0.45),retiredEquityBefore=equity(retiredFixture.book);
|
const retiredFixture=accountingBook(0.45),retiredEquityBefore=equity(retiredFixture.book);
|
||||||
retiredFixture.pos.strategy_version=PREVIOUS_STRATEGY_VERSION;
|
retiredFixture.pos.strategy_version=PREVIOUS_STRATEGY_VERSION;
|
||||||
markToMarket(retiredFixture.book,{[retiredFixture.pos.market_id]:market({id:retiredFixture.pos.market_id,yes_price:0.45,no_price:0.55})},AGENTS[0],{policyExits:true,executeTrades:true});
|
markToMarket(retiredFixture.book,{[retiredFixture.pos.market_id]:market({id:retiredFixture.pos.market_id,yes_price:0.45,no_price:0.55})},AGENTS[0],{policyExits:true,executeTrades:true});
|
||||||
|
const retiredSportsCapitalFixture=accountingBook(0.83),retiredSportsCapitalEquity=equity(retiredSportsCapitalFixture.book);
|
||||||
|
retiredSportsCapitalFixture.pos.strategy_version=PREVIOUS_STRATEGY_VERSION;retiredSportsCapitalFixture.pos.signal_type="sports-favorite-pilot";
|
||||||
|
markToMarket(retiredSportsCapitalFixture.book,{[retiredSportsCapitalFixture.pos.market_id]:market({id:retiredSportsCapitalFixture.pos.market_id,yes_price:0.83,no_price:0.17,category:"Sports"})},favoriteAgent,{policyExits:true,executeTrades:true});
|
||||||
const unlabeledLegacyFixture=accountingBook(0.45),unlabeledLegacyEquityBefore=equity(unlabeledLegacyFixture.book);
|
const unlabeledLegacyFixture=accountingBook(0.45),unlabeledLegacyEquityBefore=equity(unlabeledLegacyFixture.book);
|
||||||
delete unlabeledLegacyFixture.pos.strategy_version;delete unlabeledLegacyFixture.pos.signal_type;
|
delete unlabeledLegacyFixture.pos.strategy_version;delete unlabeledLegacyFixture.pos.signal_type;
|
||||||
markToMarket(unlabeledLegacyFixture.book,{[unlabeledLegacyFixture.pos.market_id]:market({id:unlabeledLegacyFixture.pos.market_id,yes_price:0.45,no_price:0.55})},AGENTS[0],{policyExits:true,executeTrades:true});
|
markToMarket(unlabeledLegacyFixture.book,{[unlabeledLegacyFixture.pos.market_id]:market({id:unlabeledLegacyFixture.pos.market_id,yes_price:0.45,no_price:0.55})},AGENTS[0],{policyExits:true,executeTrades:true});
|
||||||
@@ -5564,21 +5659,29 @@ function runEngineSelfTest(){
|
|||||||
dualIndependentPromotionAllowsBoundedPeerBoost:dualPromotionMultiplier===1.05,
|
dualIndependentPromotionAllowsBoundedPeerBoost:dualPromotionMultiplier===1.05,
|
||||||
legacyLossDoesNotFreezeCurrentEngine:legacyLossDecision.mode!=="Loss Regime Containment"},
|
legacyLossDoesNotFreezeCurrentEngine:legacyLossDecision.mode!=="Loss Regime Containment"},
|
||||||
sportsFavoritePilot:{
|
sportsFavoritePilot:{
|
||||||
identifiesTimedFavorite:Boolean(sportsPilot&&sportsPilot.trade_ready&&sportsPilot.quality==="sports-favorite-pilot"&&sportsPilot.side==="YES"),
|
identifiesTimedForwardShadow:Boolean(sportsPilot&&!sportsPilot.trade_ready&&sportsPilot.audited_observation_only
|
||||||
|
&&sportsPilot.quality==="sports-favorite-shadow"&&sportsPilot.side==="YES"),
|
||||||
chargesModeledFiveCentCost:Boolean(sportsPilot&&sportsPilot.market_price===0.72&&sportsPilot.entry_price===0.77&&sportsPilot.friction===0.05),
|
chargesModeledFiveCentCost:Boolean(sportsPilot&&sportsPilot.market_price===0.72&&sportsPilot.entry_price===0.77&&sportsPilot.friction===0.05),
|
||||||
onlyFavoriteAgentAccepts:Boolean(sportsPilot&&agentAcceptsSuggestion(favoriteAgent,sportsPilot)&&!agentAcceptsSuggestion(AGENTS.find(agent=>agent.id==="momentum"),sportsPilot)),
|
noAgentAcceptsBeforePromotion:Boolean(sportsPilot&&!agentAcceptsSuggestion(favoriteAgent,sportsPilot)
|
||||||
opensOnePositionPerEvent:sportsPilotBook.positions.length===1&&sportsPilotBook.positions[0].event_key==="sports-event-1",
|
&&!agentAcceptsSuggestion(AGENTS.find(agent=>agent.id==="momentum"),sportsPilot)),
|
||||||
startsAtOneAndQuarterPercent:sportsPilotBook.positions.length===1&&sportsPilotBook.positions[0].cost<=STARTING_BALANCE*SPORTS_FAVORITE_PILOT_POSITION_PCT+0.01,
|
stagesOneShadowPerEvent:sportsShadowStage.staged===1&&sportsPilotBook.sports_favorite_outcomes.length===1,
|
||||||
booksModeledCostImmediately:sportsPilotBook.positions.length===1&&sportsPilotBook.positions[0].unrealized_pnl<0&&equity(sportsPilotBook)<STARTING_BALANCE,
|
shadowNeverChangesCash:sportsPilotBook.cash===sportsPilotCash&&sportsPilotBook.positions.length===0,
|
||||||
freshOfflineSnapshotCanEnter:freshOfflineSportsPilot.trade_ready&&freshOfflineSportsPilot.entry_candidate,
|
tradingPauseDoesNotGrade:pausedSportsGrade.completed===0,
|
||||||
offlineTimingIsRechecked:!expiredOfflineSportsPilot.trade_ready&&!expiredOfflineSportsPilot.entry_candidate&&expiredOfflineSportsPilot.watch_only,
|
closedMarketGradesOutcome:settledSportsGrade.completed===1&&sportsPilotBook.sports_favorite_outcomes.length===1
|
||||||
completedLossesDisablePilot:losingSportsPilotProfile.demoted&&!losingSportsPilotProfile.allowed&&losingSportsPilotProfile.position_pct===0,
|
&&sportsPilotBook.sports_favorite_outcomes[0].net_return>0,
|
||||||
demotedPilotCannotOpen:losingSportsPilotBook.positions.length===0,
|
offlineSnapshotCannotInventSettlement:offlineSportsStayedPending,
|
||||||
|
forwardLearnerSurvivesCompaction:compactedSportsBook.sports_favorite_shadows.length===1&&compactedSportsBook.sports_favorite_outcomes.length===1,
|
||||||
|
freshOfflineSnapshotCannotCreateCapital:!freshOfflineSportsPilot.trade_ready&&!freshOfflineSportsPilot.entry_candidate,
|
||||||
|
offlineTimingIsRechecked:!expiredOfflineSportsPilot.trade_ready&&!expiredOfflineSportsPilot.entry_candidate&&expiredOfflineSportsPilot.watch_only
|
||||||
|
&&expiredOfflineSportsPilot.hours_to_start<SPORTS_FAVORITE_TARGET_LEAD_HOURS-SPORTS_FAVORITE_LEAD_TOLERANCE_HOURS,
|
||||||
|
completedLossesKeepCapitalDisabled:losingSportsPilotProfile.demoted&&!losingSportsPilotProfile.allowed&&losingSportsPilotProfile.position_pct===0,
|
||||||
|
unpromotedSuggestionStaysWatchOnly:!unpromotedSportsSuggestion.trade_ready&&unpromotedSportsSuggestion.signal_type==="sports-favorite-shadow",
|
||||||
positiveConfidenceCanPromote:promotedSportsPilotProfile.promoted&&promotedSportsPilotProfile.allowed
|
positiveConfidenceCanPromote:promotedSportsPilotProfile.promoted&&promotedSportsPilotProfile.allowed
|
||||||
&&promotedSportsPilotProfile.position_pct===SPORTS_FAVORITE_PROMOTED_POSITION_PCT,
|
&&promotedSportsPilotProfile.position_pct===SPORTS_FAVORITE_PILOT_POSITION_PCT,
|
||||||
promotedPilotScalesWithinCap:promotedSportsPilotBook.positions.length===1
|
promotedSuggestionBecomesTradeReady:promotedSportsSuggestion.trade_ready&&promotedSportsSuggestion.signal_type==="sports-favorite-pilot",
|
||||||
&&promotedSportsPilotBook.positions[0].cost>STARTING_BALANCE*SPORTS_FAVORITE_PILOT_POSITION_PCT
|
promotedPilotOpensOneCappedEvent:promotedSportsPilotBook.positions.length===1
|
||||||
&&promotedSportsPilotBook.positions[0].cost<=STARTING_BALANCE*SPORTS_FAVORITE_PROMOTED_POSITION_PCT+0.01,
|
&&promotedSportsPilotBook.positions[0].event_key==="sports-event-1"
|
||||||
|
&&promotedSportsPilotBook.positions[0].cost<=STARTING_BALANCE*SPORTS_FAVORITE_PILOT_POSITION_PCT+0.01,
|
||||||
ordinaryGapExitDoesNotPreemptPilot:sportsPilotExit===null,
|
ordinaryGapExitDoesNotPreemptPilot:sportsPilotExit===null,
|
||||||
},
|
},
|
||||||
riskBudget:{core:coreRiskBudget,aggressiveGap:aggressiveGapBudget,blocksExactRange:intervalContract.jump_risk&&!intervalContract.trade_ready,
|
riskBudget:{core:coreRiskBudget,aggressiveGap:aggressiveGapBudget,blocksExactRange:intervalContract.jump_risk&&!intervalContract.trade_ready,
|
||||||
@@ -5599,6 +5702,8 @@ function runEngineSelfTest(){
|
|||||||
suspendedBundleLegStaysOpen:suspendedBundleFixture.book.positions.length===1&&suspendedBundleFixture.book.closed.length===0
|
suspendedBundleLegStaysOpen:suspendedBundleFixture.book.positions.length===1&&suspendedBundleFixture.book.closed.length===0
|
||||||
&&suspendedBundleFixture.book.positions[0].price_status==="orders-paused"&&suspendedBundleFixture.book.cash===9000,
|
&&suspendedBundleFixture.book.positions[0].price_status==="orders-paused"&&suspendedBundleFixture.book.cash===9000,
|
||||||
retiredDirectionalPositionExitsAtFreshPrice:retiredFixture.book.positions.length===0&&retiredFixture.book.closed[0].close_reason.includes("retired")&&Math.abs(retiredFixture.book.cash-retiredEquityBefore)<=0.02,
|
retiredDirectionalPositionExitsAtFreshPrice:retiredFixture.book.positions.length===0&&retiredFixture.book.closed[0].close_reason.includes("retired")&&Math.abs(retiredFixture.book.cash-retiredEquityBefore)<=0.02,
|
||||||
|
rejectedStrategy57SportsCapitalExitsAtFreshPrice:retiredSportsCapitalFixture.book.positions.length===0
|
||||||
|
&&retiredSportsCapitalFixture.book.closed[0].close_reason.includes("retired")&&Math.abs(retiredSportsCapitalFixture.book.cash-retiredSportsCapitalEquity)<=0.02,
|
||||||
unlabeledLegacyPositionExitsAtFreshPrice:unlabeledLegacyFixture.book.positions.length===0&&unlabeledLegacyFixture.book.closed[0].close_reason.includes("retired")&&Math.abs(unlabeledLegacyFixture.book.cash-unlabeledLegacyEquityBefore)<=0.02,
|
unlabeledLegacyPositionExitsAtFreshPrice:unlabeledLegacyFixture.book.positions.length===0&&unlabeledLegacyFixture.book.closed[0].close_reason.includes("retired")&&Math.abs(unlabeledLegacyFixture.book.cash-unlabeledLegacyEquityBefore)<=0.02,
|
||||||
currentUnlabeledPositionIsPreserved:currentUnlabeledFixture.book.positions.length===1&¤tUnlabeledFixture.book.closed.length===0,
|
currentUnlabeledPositionIsPreserved:currentUnlabeledFixture.book.positions.length===1&¤tUnlabeledFixture.book.closed.length===0,
|
||||||
riskTrimConservesEquity:+equity(riskBook).toFixed(2)===10000,
|
riskTrimConservesEquity:+equity(riskBook).toFixed(2)===10000,
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ const evaluated = rules.map((rule) => {
|
|||||||
});
|
});
|
||||||
const selected = evaluated.filter((row) => row.validationPassed).sort((a, b) => Number(b.passesHoldout) - Number(a.passesHoldout) || b.holdout.lower - a.holdout.lower);
|
const selected = evaluated.filter((row) => row.validationPassed).sort((a, b) => Number(b.passesHoldout) - Number(a.passesHoldout) || b.holdout.lower - a.holdout.lower);
|
||||||
const baseline = evaluated.find((row) => row.rule.leadHours === 24 && row.rule.minEntry === 0.55 && row.rule.maxEntry === 0.95);
|
const baseline = evaluated.find((row) => row.rule.leadHours === 24 && row.rule.minEntry === 0.55 && row.rule.maxEntry === 0.95);
|
||||||
|
const livePilot = evaluated.find((row) => row.rule.leadHours === 24 && row.rule.minEntry === 0.60 && row.rule.maxEntry === 0.85);
|
||||||
const compact = (stats) => Object.fromEntries(Object.entries(stats).map(([key, value]) => [key, Number.isFinite(value) ? +value.toFixed(5) : value]));
|
const compact = (stats) => Object.fromEntries(Object.entries(stats).map(([key, value]) => [key, Number.isFinite(value) ? +value.toFixed(5) : value]));
|
||||||
const candidate = (row) => ({ rule: row.rule, train: compact(row.train), validation: compact(row.validation), holdout: compact(row.holdout), passesHoldout: row.passesHoldout });
|
const candidate = (row) => ({ rule: row.rule, train: compact(row.train), validation: compact(row.validation), holdout: compact(row.holdout), passesHoldout: row.passesHoldout });
|
||||||
const closest = evaluated.filter((row) => row.train.events >= 25 && row.validation.events >= 10 && row.holdout.events >= 10)
|
const closest = evaluated.filter((row) => row.train.events >= 25 && row.validation.events >= 10 && row.holdout.events >= 10)
|
||||||
@@ -175,6 +176,7 @@ console.log(JSON.stringify({ generatedAt: new Date().toISOString(), requestedMar
|
|||||||
partitionMarkets: Object.fromEntries(Object.entries(partitions).map(([key, value]) => [key, value.length])),
|
partitionMarkets: Object.fromEntries(Object.entries(partitions).map(([key, value]) => [key, value.length])),
|
||||||
trainPassed: evaluated.filter((row) => row.trainPassed).length, validationSelected: selected.length,
|
trainPassed: evaluated.filter((row) => row.trainPassed).length, validationSelected: selected.length,
|
||||||
holdoutPassed: selected.filter((row) => row.passesHoldout).length, baseline: baseline ? candidate(baseline) : null,
|
holdoutPassed: selected.filter((row) => row.passesHoldout).length, baseline: baseline ? candidate(baseline) : null,
|
||||||
|
livePilot: livePilot ? candidate(livePilot) : null,
|
||||||
closestCandidates: closest.slice(0, 15).map(candidate),
|
closestCandidates: closest.slice(0, 15).map(candidate),
|
||||||
candidates: selected.slice(0, 20).map(candidate),
|
candidates: selected.slice(0, 20).map(candidate),
|
||||||
holdoutExamples: (selected.find((row) => row.passesHoldout)?.holdoutRows || []).slice(0, 12)
|
holdoutExamples: (selected.find((row) => row.passesHoldout)?.holdoutRows || []).slice(0, 12)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const CACHE_NAME = "polymarket-arena-build-72";
|
const CACHE_NAME = "polymarket-arena-build-73";
|
||||||
const APP_SHELL = ["/", "/index.html", "/personal.html", "/cycle-worker.js"];
|
const APP_SHELL = ["/", "/index.html", "/personal.html", "/cycle-worker.js"];
|
||||||
|
|
||||||
self.addEventListener("install", event => {
|
self.addEventListener("install", event => {
|
||||||
|
|||||||
Reference in New Issue
Block a user