-
Notifications
You must be signed in to change notification settings - Fork 0
Expose combo regime diagnostics in runtime reports #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,8 @@ def map_strategy_decision_to_allocation( | |
|
|
||
| def map_strategy_decision_to_rotation_plan(decision: StrategyDecision) -> dict[str, Any]: | ||
| diagnostics = dict(decision.diagnostics) | ||
| metadata = diagnostics.get("metadata") if isinstance(diagnostics.get("metadata"), Mapping) else {} | ||
| combo_meta = metadata.get("combo") if isinstance(metadata.get("combo"), Mapping) else {} | ||
| selected_candidates = { | ||
| str(symbol): { | ||
| "weight": float(payload.get("weight", 0.0)), | ||
|
|
@@ -78,4 +80,16 @@ def map_strategy_decision_to_rotation_plan(decision: StrategyDecision) -> dict[s | |
| "rotation_pool_last_month": diagnostics.get("rotation_pool_last_month"), | ||
| "artifact_contract": dict(diagnostics.get("artifact_contract", {})), | ||
| "risk_flags": tuple(str(flag) for flag in decision.risk_flags), | ||
| "combo_diagnostics": { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the active strategy is not the combo profile, or a combo decision lacks Useful? React with 👍 / 👎. |
||
| "base_btc_weight": float(combo_meta.get("base_btc_weight", 0.0) or 0.0), | ||
| "base_trend_weight": float(combo_meta.get("base_trend_weight", 0.0) or 0.0), | ||
| "effective_btc_weight": float(combo_meta.get("btc_weight", 0.0) or 0.0), | ||
| "effective_trend_weight": float(combo_meta.get("trend_weight", 0.0) or 0.0), | ||
| "dynamic_regime_mode": str(combo_meta.get("dynamic_regime_mode", "")), | ||
| "regime_tier": str(combo_meta.get("regime_tier", "")), | ||
| "regime_off": bool(metadata.get("regime_off", False)), | ||
| "btc_sma200_ratio": metadata.get("btc_sma200_ratio"), | ||
| "ma200_slope": metadata.get("ma200_slope"), | ||
| "gross_exposure": float(metadata.get("gross_exposure", 0.0) or 0.0), | ||
| }, | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the sell leg changes balances or cash, this writes
diagnostics.combofrom the first strategy plan even though the function immediately resolves and executes a secondpost_sell_planwith the updated portfolio. For combo runs where fields such asgross_exposureare derived from current holdings, a cycle that rotates out positions can archive stale pre-sell diagnostics that disagree with the buy plan actually used; update the report frompost_sell_planafter the second resolve.Useful? React with 👍 / 👎.