Skip to content

fix(transport): route order-bound notices by request id - #759

Merged
wboayue merged 2 commits into
wboayue:mainfrom
faysou:fix/order-bound-notices
Aug 27, 2026
Merged

fix(transport): route order-bound notices by request id#759
wboayue merged 2 commits into
wboayue:mainfrom
faysou:fix/order-bound-notices

Conversation

@faysou

@faysou faysou commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the originating request or order ID on Notice while keeping request‑less notices represented as None.
  • Send order‑bound error frames to the order update stream as classified notices instead of raw error frames that an order decoder cannot represent.
  • Classify code 399 as informational only when its message contains a line beginning with Warning:. Other code 399 messages remain order rejections.
flowchart LR
    TWS[TWS error frame] --> Decode[Decode error envelope]
    Decode --> Classify{Request ID and severity}
    Classify -- Order-bound warning --> Update[Order update stream: Notice]
    Classify -- Order-bound error --> Update
    Classify -- Request-scoped --> Request[Request subscription]
    Classify -- Request-less --> Global[Global notice stream]
Loading

Order consumers receive the request ID and severity without adding the intercepted error message type to any domain decoder.

Testing

  • cargo test -p ibapi --features sync.
  • Paper TWS forced‑rejection smoke: hard order errors remained terminal.
  • Paper TWS code 399 smoke: a warning‑form stop order remained active and could be cancelled.

faysou and others added 2 commits August 17, 2026 02:19
- Preserve originating IDs on request and order notices
- Deliver classified notices to the order update stream
- Keep warning-form code 399 messages informational
… data-request errors on update stream

- re-export ORDER_MESSAGE_CODE from lib.rs (rustdoc gate failed: public doc linked private item)
- changelog entries for Notice.request_id, 399 classification, update-stream notices
- order_update_stream docs: notices surface via next()/iter(), filter_data drops them; examples show the notice arm
- order-update stream skips errors owned by a data-request subscription (order_update_notice helper dedupes the sync/async guard)
@wboayue

wboayue commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Thanks @faysou — nice work. The 399 text-based classification and routing order errors to the update stream as typed notices are both solid improvements, and the paper TWS validation of both warning and rejection forms was exactly the right verification.

I pushed a few review follow-ups to your branch (9adbc1f): re-exported ORDER_MESSAGE_CODE (rustdoc gate was failing on the private link), changelog entries, doc updates showing how notices surface on order_update_stream (filter_data() drops them), and a small refinement so errors owned by data-request subscriptions don't get copied to the order-update stream. Will merge once CI is green.

@wboayue
wboayue merged commit bf15fd0 into wboayue:main Aug 27, 2026
4 checks passed
@faysou

faysou commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Great, thank you. I did a refactor of the IB adapter in nautilus_trader but some changes belonged more naturally to rust-ibapi. Happy that these changes can be merged.

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.

2 participants