Activate edge + spread gate values (forward-test) — companion to #999#1001
Merged
Conversation
Companion to the edge/spread bet-selection gates (#999). Sets the Polymarket-only activation values found most consistent in the maxedge analysis, on top of the default-OFF gate machinery: strategies_kwargs.min_edge : 0.01 -> 0.05 strategies_kwargs.max_edge : (1.0) -> 0.10 (new band upper bound) POLYMARKET_SPREAD_MIN : 0.0 -> 0.02 POLYMARKET_SPREAD_MAX : 1.0 -> 0.05 These are FORWARD-TEST LEADS, not validated production settings: - Neither knob is statistically significant (edge p~0.10, spread p~0.14). - The analysis measured edge as |p_yes - market_prob| and spread from the Gamma snapshot; the live gates filter `p_oracle - best_ask` and live-CLOB `best_ask - best_bid` respectively, so the lifts may not transfer. - min_edge 0.01 -> 0.05 sharply tightens bet selection (lower volume). Polymarket-only (polymarket_trader/service.yaml); Omen untouched. Open as DRAFT pending a paper/live forward-test before merge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Correct the activation values to match the analysis: the min_edge FLOOR is a dead knob (raising it does nothing for ROI); the lever is the CAP. min_edge : 0.05 -> 0.01 (revert — keep the floor low, as in prod) max_edge : 0.10 (cap — the actual ROI lever, kept) POLYMARKET_SPREAD_MIN : 0.02 -> 0.0 (revert — no spread floor) POLYMARKET_SPREAD_MAX : 0.05 (cap — reject wide/illiquid spreads, kept) Net vs #999: add max_edge=0.1 and cap spread at 0.05. No floors raised. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…0.10 Supply check on the data lake showed the tight caps (max_edge 0.10 + spread_max 0.05) cut bet volume from ~142/day fleet to ~2-3/day — the spread cap especially (median Polymarket spread is 0.15, so <=0.05 keeps only 27%). Loosen to keep enough markets while still capping the tails: min_edge : 0.01 (unchanged — floor is not the constraint) max_edge : 0.10 -> 0.15 (~38 bets/day fleet vs ~24) spread_min : 0.0 (unchanged) spread_max : 0.05 -> 0.10 (keeps ~43% vs 27%; still rejects widest books) Staking KPI unaffected (edge/spread are post-mech; predictions unchanged). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…activation-values
OjusWiZard
previously approved these changes
Jun 30, 2026
DIvyaNautiyal07
previously approved these changes
Jun 30, 2026
dagacha
reviewed
Jun 30, 2026
dagacha
left a comment
Contributor
There was a problem hiding this comment.
Found one issue that prevents the new edge cap from taking effect.
…gy CID dagacha's P1: file_hash_to_strategies still mapped kelly_criterion to the pre-999 CID (bafybeididlci...), whose strategy ignores max_edge — so the max_edge=0.15 cap added by this PR was inert at runtime (the deployed agent downloads the strategy by hash, not the repo file). Repoint to the #999 CID (bafybeidme2u...) and re-lock. - polymarket_trader/service.yaml: activates the max_edge cap (functional) - trader_pearl/service.yaml: consistency only — Omen is FPMM, max_edge is CLOB-only and unset there, so behaviour is unchanged; this just stops Omen deploying the stale pre-999 strategy - aea-config.yaml: agent default (the merged #999 left this stale too) autonomy packages lock --check passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
036297a
Contributor
|
Re-reviewed the latest diff at 036297a. The previous |
dagacha
approved these changes
Jun 30, 2026
bennyjo
approved these changes
Jun 30, 2026
bennyjo
left a comment
Contributor
There was a problem hiding this comment.
LGTM — edge cap is now correctly wired and the spread cap was already live. One non-blocking note inline on the strategy repoint.
jmoreira-valory
added a commit
that referenced
this pull request
Jul 1, 2026
The "Update branch" merge combined #1001's kelly re-lock with this branch's fixed_bet re-lock without recomputing the resulting package hashes, so `autonomy packages lock --check` failed on the merge commit. Re-locked; check now passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ships the Polymarket edge + spread caps as committed defaults and wires them in at runtime (companion to #999, which added the gate machinery default-OFF). The backing analysis was re-run on the live execution measure (
edge_ask = p_side − best_ask, 100% coverage) and independently re-verified by 5 agents; the rationale is summarized inline below. Decision: ship as a monitored production trial (reversible, KPI-safe) — see Rollout below.Changes
(a) The caps —
polymarket_trader/service.yaml, pure caps, no floors raisedThe analysis is explicit that the
min_edge/spread_minfloors are dead knobs; the ROI lever is the upper cap. So this PR only adds caps:strategies_kwargs.min_edgestrategies_kwargs.max_edgePOLYMARKET_SPREAD_MINPOLYMARKET_SPREAD_MAX(b) Runtime activation — repoint the
kelly_criterionstrategy CID (resolves the P1 from review)The
max_edgecap is enforced insidekelly_criterion, which the agent loads at runtime by the CID infile_hash_to_strategies— not from the repo file. That map still pointedkelly_criterionat the pre-999 CIDbafybeididlci…(whose strategy ignoresmax_edge), so the new cap was inert in deployment — a CLOB bet with edge > 0.15 would still pass. Repointedkelly_criterion→ the #999 CIDbafybeidme2u…:polymarket_trader/service.yaml— functional: activates themax_edgecap.trader_pearl/service.yaml(Omen) — consistency only, behaviour unchanged: Omen is FPMM,max_edgeis CLOB-only and unset there, and feat(polymarket): edge-band + spread-band bet-selection gates (default no-op) #999 did not touch the FPMM edge path. This just stops Omen deploying the stale pre-999 strategy.aea-config.yaml(agent default) — the merged feat(polymarket): edge-band + spread-band bet-selection gates (default no-op) #999 left this stale too; now aligned.Re-locked agent + both services;
autonomy packages lock --checkpasses. The spread gate itself lives in the agent-package behaviour (decision_receive.py, runs from the repo), so it was already live — only the kelly strategy needed repointing. Caps remain env-overridable (STRATEGIES_KWARGS,POLYMARKET_SPREAD_MAX) for instant rollback.Why this wasn't caught in #999 or the pre-merge smoke tests
Honest postmortem, because the gap is subtle and worth recording:
#999. It added the
max_edgemachinery tokelly_criterion.pyand re-locked (new CID), but shipped it default-OFF (max_edge=1.0, inert) and never repointedfile_hash_to_strategies. The strategy runs at runtime from the configured CID, so #999's new code — correct and fully unit-tested — was never wired into any deployment. Because the default was inert there was zero observable behaviour change, so nothing (CI, unit tests, reviewers) had a signal to expose the dangling wiring: by design, #999 changed nothing at runtime.The local smoke tests all ran blind to it, for compounding reasons:
make run-agentloads whatever CIDfile_hash_to_strategiesnames (the old kelly) — the new code never executed in any run.min_edge=0.99;min_edgeis read by both the old and new kelly, so it rejected regardless — proving nothing about the new path.max_edge(the only discriminating knob) was never exercised with a gating value.max_edge=1.0is inert — a defaults-based smoke run can't engage the cap regardless of which kelly loads.mech_informationmarketplace-enumeration step.max_edgeis CLOB-only), and themax_edge=1.0line in the BET-DECISION log is printed by thedecision_receivebehaviour (which does run from the repo) — not the kelly strategy (which runs from IPFS). It looked like confirmation; it wasn't.kelly_criterion.pyby direct import — orthogonal to which CID the runtime loads.Root cause / takeaway: strategy customs are deployment-decoupled from the repo — loaded by hash. A strategy-code change isn't live until its CID is (i) published to IPFS and (ii) referenced by
file_hash_to_strategies; and it must be validated against the runtime strategy with a value that actually gates, not just unit-tested. This PR adds the repoint; the outstanding validation is the forward-test below.Outstanding validation
A live forward-test (run with
max_edgebelow the live edge and confirm the strategy rejects, reading kelly'sinfo/rejection lines — not the behaviour's print) is still pending. It needs the new CID published to IPFS (on release) and a Polymarket run that reaches the decision (themech_informationenumeration was intermittently empty during testing). The wiring is verified by the lock; runtime gating is unit-tested.What the analysis found
p_oracle − best_ask; re-deriving on exactly that (edge_ask = p_side − fill, 100% coverage) reproduces the band — [0.05,0.10] is the best, only positive-ROI bucket (+0.6%).min_edgedoes nothing (ROI stays −5.4%). Capping high edge helps because high-edge bets are overconfident: the gap betweenp_sideand realized win-rate rises monotonically to +0.52 (adverse selection, not a price artifact — independently verified).Volume / supply (on LIVE Polymarket data)
Checked the live candidate universe (Gamma
/events/keyset, ≤4-day window, + per-market CLOB book — not fleet bets): 675 markets, 294 with a 2-sided book, median live CLOB spread 0.02, ~215 passspread ≤ 0.10(~193 at ≤ 0.05). The spread gate is not supply-constraining. The edge cap is forecast-dependent (p_sideper market), so its bet-volume effect is forward-test only. Staking KPI is unaffected — edge/spread are post-mech gates; the agent still makes every prediction, only bet volume changes.Rollout — monitored production trial (not a validated profit claim)
This is not a "fixes ROI" change; it caps bets where the forecaster is provably overconfident, with an expected loss-reducing-to-break-even effect. Ship it as a live forward-test with a safety net:
POLYMARKET_SPREAD_MAX/STRATEGIES_KWARGS), but a Pearl release reaches all end-user instances, so its rollback is a follow-up release (days). Ship to Pearl knowing the safety net is a release cycle. (Defensive change → bounded downside, so all-users is still acceptable.)The durable ROI fix remains upstream — calibrate the forecaster so a high
p_sideis actually right.🤖 Generated with Claude Code