Skip to content

Add plugin metadata and IBKR option support#69

Merged
Pigbibi merged 1 commit into
mainfrom
codex/strategy-plugin-ai-runtime-20260528
May 28, 2026
Merged

Add plugin metadata and IBKR option support#69
Pigbibi merged 1 commit into
mainfrom
codex/strategy-plugin-ai-runtime-20260528

Conversation

@Pigbibi

@Pigbibi Pigbibi commented May 28, 2026

Copy link
Copy Markdown
Contributor

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.

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

Copy link
Copy Markdown

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: 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".

Comment on lines +100 to +101
str(metadata.get("asset_class") or "").strip().lower() == "option"
and str(metadata.get("intent_type") or "").strip() == "multi_leg_option"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve signed option deltas

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 👍 / 👎.

@Pigbibi Pigbibi merged commit 77d439f into main May 28, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/strategy-plugin-ai-runtime-20260528 branch May 28, 2026 06:41
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