Skip to content

Handle missing TQQQ account hash metadata#52

Merged
Pigbibi merged 1 commit into
mainfrom
fix/tqqq-account-hash-optional
May 11, 2026
Merged

Handle missing TQQQ account hash metadata#52
Pigbibi merged 1 commit into
mainfrom
fix/tqqq-account-hash-optional

Conversation

@Pigbibi
Copy link
Copy Markdown
Contributor

@Pigbibi Pigbibi commented May 11, 2026

Summary

  • make the TQQQ growth-income plan tolerate portfolio snapshots without Schwab-style account_hash metadata
  • keep account_hash populated when present, and use None when the platform does not provide it
  • add regression coverage for IBKR-style portfolio metadata that only includes account_ids

Verification

  • python3 -m unittest tests.test_strategy_plans.StrategyPlanMetadataTest.test_tqqq_growth_income_exposes_live_dual_drive_metadata tests.test_strategy_plans.StrategyPlanMetadataTest.test_tqqq_growth_income_accepts_portfolio_without_account_hash -v (skipped locally because numpy is not installed)
  • python3 -m py_compile src/us_equity_strategies/strategies/tqqq_growth_income.py tests/test_strategy_plans.py
  • git diff --check

@Pigbibi Pigbibi merged commit 0ca3ec4 into main May 11, 2026
1 check passed
@Pigbibi Pigbibi deleted the fix/tqqq-account-hash-optional branch May 11, 2026 19:56
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9d27598cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

sell_order_symbols = ("TQQQ", unlevered_symbol, "SPYI", "QQQI", "BOXX")
buy_order_symbols = ("SPYI", "QQQI", "TQQQ", unlevered_symbol)
snapshot_metadata = getattr(snapshot, "metadata", {}) or {}
account_hash = snapshot_metadata.get("account_hash") if isinstance(snapshot_metadata, dict) else None
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve account_hash from any Mapping metadata

The new extraction only reads account_hash when snapshot.metadata is a concrete dict, so snapshots that provide metadata as another Mapping type (e.g., MappingProxyType or custom mapping wrappers) will now silently lose account_hash even when the key is present. This is a regression from the prior snapshot.metadata["account_hash"] behavior and can break downstream execution metadata routing for environments that pass non-dict mappings; elsewhere in this repo metadata is normalized via isinstance(..., Mapping) (for example _metadata_mapping in entrypoints/_portfolio_dashboard.py), so this narrower type check is inconsistent.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant