Skip to content

Conversation

@AlstonLi007
Copy link
Owner

Summary

  • add high-level IBKRClient helpers for bracket and OCA orders, order modification, streaming trades, market data, permission checks, rate-limit configuration, and health reporting based on ib_insync
  • normalize contract and order models including time-in-force mapping for consistent OrderTicket identifiers
  • document the new entry points and provide pytest usage stubs for connecting to IBKR

Testing

  • python -m compileall openbb_lab

https://chatgpt.com/codex/tasks/task_e_68e7c68a59448321a395d92f930f4184

Copy link

@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.

ℹ️ 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

Comment on lines +176 to +191
def to_dict(self) -> Dict[str, Any]:
"""Return a serializable payload of the ticket."""

return {
"order_id": self.order_id,
"client_id": self.client_id,
"perm_id": self.perm_id,
"status": self.status,
"filled": self.filled,
"remaining": self.remaining,
"avg_fill_price": self.avg_fill_price,
"last_fill_price": self.last_fill_price,
"identifier": self.identifier,
"contract": self.contract.__dict__,
"order": self.order.__dict__,
"fills": [fill.__dict__ for fill in self.fills],

Choose a reason for hiding this comment

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

P1 Badge Serialize slotted models without relying on dict

OrderTicket.to_dict builds its payload with self.contract.__dict__, self.order.__dict__, and fill.__dict__, but every model in this module is declared with @dataclass(slots=True). Slotted dataclasses do not expose __dict__, so calling to_dict() raises AttributeError and the helper cannot be used. Consider using dataclasses.asdict or manually constructing dictionaries from the fields instead.

Useful? React with 👍 / 👎.

Comment on lines +217 to +224
contract_model = (
ContractModel.from_ib(ticker.contract)
if getattr(ticker, "contract", None)
else ContractModel.from_ib(contract)
)
return {
"contract": contract_model.__dict__,
"last": getattr(ticker, "last", None),

Choose a reason for hiding this comment

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

P1 Badge Avoid dict when returning market-data contract payloads

In req_market_data the returned mapping uses contract_model.__dict__, but ContractModel was declared with slots=True so it lacks a __dict__ attribute. This call path will raise AttributeError before any market data is returned. Use dataclasses.asdict or construct the contract dictionary field by field to avoid the exception.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants