Add plugin metadata and IBKR option support#69
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86d72631c7
ℹ️ 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".
| str(metadata.get("asset_class") or "").strip().lower() == "option" | ||
| and str(metadata.get("intent_type") or "").strip() == "multi_leg_option" |
There was a problem hiding this comment.
Route BAG/multi-leg intents to combo builder
When callers identify a combo with metadata["security_type"] == "BAG" or only metadata["intent_type"] == "multi_leg_option", _is_option_intent() recognizes it as an option, but this narrower check returns false unless asset_class is also exactly option. Those intents then fall through to _build_option_contract() and fail on missing top-level right/strike instead of building the legs, so IBKR-style BAG orders are not submitable unless they include an extra, undocumented asset_class field.
Useful? React with 👍 / 👎.
| def _ticker_delta(ticker: Any) -> float | None: | ||
| for greeks_name in ("modelGreeks", "bidGreeks", "askGreeks", "lastGreeks"): | ||
| greeks = getattr(ticker, greeks_name, None) | ||
| delta = _coerce_positive_price(abs(getattr(greeks, "delta", 0.0))) if greeks is not None else None |
There was a problem hiding this comment.
For put contracts IBKR greeks report negative deltas, but this converts every delta to a positive number before publishing it in the chain snapshot. Any strategy that selects puts with signed thresholds such as -0.30 <= delta <= -0.15 will see no matching contracts or may confuse calls and puts; keep the raw signed value here and let callers take abs() when they want magnitude.
Useful? React with 👍 / 👎.
Summary:\n- Add guarded strategy plugin metadata attachment for portfolio snapshots\n- Add IBKR option chain and order translation support\n- Extend tests for plugin metadata and IBKR option paths\n\nValidation:\n- ./.venv/bin/python -m pytest tests/test_strategy_plugins.py tests/test_ibkr_execution.py tests/test_ibkr_market_data.py tests/test_ibkr_portfolio.py -q\n- git diff --check HEAD~1..HEAD\n\nNote:\n- Ruff is not installed in this repo venv.