Stop the losses of the first portfolio: re-evaluate at today's price, trust Jev less - #20
Merged
Merged
Conversation
… trust Jev less The first real portfolio lost 24% in a day and a half, almost all on crypto price markets. Six changes: 1. The blend is recomputed at the current price (calibrated Jev pooled with the price of now) instead of reusing the stored one, pooled with the price of the forecast. Forecasts older than FORECAST_MAX_AGE_HOURS or whose price moved more than FORECAST_MAX_PRICE_MOVE (log-odds) need a new one before buying. The signal is recomputed at the current price too. 2. Minimum hours to the end per preset (72/24/12): no bets when the price already knows the outcome. Uses the real hours, not days rounded up to 1. 3. Markets decided by an asset's price are recognised (markets/kinds.py) and excluded (EXCLUDE_PRICE_MARKETS): no bets, and automatic forecasts, «Assess all» and alerts skip them. 4. MODEL_WEIGHT_MAX 0.5 -> 0.25, and Jev's weight shrinks beyond MODEL_DISAGREEMENT_LOGIT (2) log-odds from the price, inside pool() so forecasts, buy/sell levels and backtests agree. 5. The uncertainty is narrowed only when the blend beats the market price on resolved markets (paired Brier gain, two standard errors). 6. Minimum prudent return per bet (10/6/3%), since annualised returns of short bets always passed. Existing tests keep the earlier forecast parameters; tests/test_trust.py covers the new behaviour with the real losing cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLWZrfy12imc6dQRsEtFjj
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.
Why
The first real simulated portfolio lost $11.86 of $50 (−24 %) in about 30 hours over 13 bets. $10.99 of the loss came from 7 crypto price markets. The analysis of the exported workbook found structural causes, not bad luck; this PR fixes them. The new section "What went wrong in the first portfolio" in
docs/strategy.mdsummarises it.Changes
portfolio.evaluate_prediction,plans.signal_at)FORECAST_MAX_AGE_HOURS(6); orFORECAST_MAX_PRICE_MOVEsince the forecast (0.5 in log-odds, so moves near the extremes count more).too_close).days_to_endrounds up to one day.backend/markets/kinds.pyrecognises markets decided by an asset's price («Bitcoin above $84,000 on…», «ETH reach $2,800», «gold hit $3,000», «Up or Down»).EXCLUDE_PRICE_MARKETS=truethey get no bets (the plan shows «Avoid»).MODEL_WEIGHT_MAXgoes from 0.5 to 0.25.MODEL_DISAGREEMENT_LOGIT(2) log-odds from the price.pool(), so forecasts, buy/sell levels, backtests and the plan agree.forecast_ofnow starts from the base weight, so the reduction is not applied twice.roi_too_low). Annualised returns of short bets always passed the old time check.The UI shows the new reasons, the reduced weight in «Why this signal» and «How it works», the new parameters in Settings, and the preset limits. Docs (EN and IT) and
.env.exampleare updated.Tests
tests/test_trust.py, using the real losing cases:tests/conftest.py, since they test the mechanics, not the values.test_strategy.pynow includes the minimum return in its hand-rebuilt check.After merging
🤖 Generated with Claude Code
https://claude.ai/code/session_01JLWZrfy12imc6dQRsEtFjj
Generated by Claude Code