Normalize TQQQ benchmark close history#55
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbe63d6618
ℹ️ 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".
| elif isinstance(history, pd.Series): | ||
| frame = history.to_frame(name="close") | ||
| else: | ||
| frame = pd.DataFrame(list(history)) |
There was a problem hiding this comment.
Preserve mapping-shaped benchmark history inputs
Converting non-DataFrame/Series inputs via pd.DataFrame(list(history)) breaks valid mapping-shaped payloads (for example {"close": [...], "high": [...], "low": [...]}) that previously worked with pd.DataFrame(qqq_history). For mappings, list(history) yields only keys, so normalization later coerces strings to NaN and raises a ValueError, causing runtime failures for callers/adapters that provide benchmark history as a dict-of-arrays.
Useful? React with 👍 / 👎.
Summary\n- normalize benchmark history input for tqqq_growth_income\n- accept DataFrame/Series/list inputs and case-insensitive close columns\n- raise a clear ValueError when close history is genuinely missing\n\n## Validation\n- pytest tests/test_strategy_plans.py -q -k 'tqqq_growth_income'\n- py_compile on modified files