Skip to content

6.0: ComboLeg and delta-neutral slots are ShortSaleSlot, not i32 - #1258

Open
tradatious wants to merge 1 commit into
wboayue:mainfrom
tradatious:api_b_combo-leg-types
Open

tradatious wants to merge 1 commit into
wboayue:mainfrom
tradatious:api_b_combo-leg-types

Conversation

@tradatious

Copy link
Copy Markdown
Contributor

Description

Order::short_sale_slot is an orders::ShortSaleSlot, but the same code on a combo leg (ComboLeg::short_sale_slot) and on the delta-neutral hedge (Order::delta_neutral_short_sale_slot) was a bare i32 documented as "1 = clearing broker, 2 = third party". Both now hold the enum. An unmodeled code is ShortSaleSlot::Unknown(code) and is sent back unchanged; None is still sent as no value, so nothing changes on the wire.

Also in ComboLeg's rustdoc:

  • exempt_code said "0 = none"; it now gives the codes from ComboLeg.proto (0 does not apply the uptick rule, -1 applies it).
  • A defaulted leg has ratio: 0, which is not sent, and TWS rejects a leg without a ratio with 321 (probed 2026-11-15, what-if; entry added to docs/wire-facts/orders.md).

ComboLeg::exchange stays a String: Exchange::default() is "SMART", so typing it would make a defaulted leg send SMART where it sends nothing today.

Testing

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --no-default-features --features sync -- -D warnings
  • cargo clippy --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --no-default-features --features sync
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • cargo test --all-features
  • cargo clippy -p ibapi-integration-sync --tests -- -D warnings
  • cargo clippy -p ibapi-integration-async --tests -- -D warnings
  • ./tools/check-rules-graph.sh

The typing itself was not tested live: the encoder and decoder tests cover None, Broker, ThirdParty and an unmodeled code for both fields. What TWS echoes for either slot was not probed.

Breaking changes

Yes. Assignments and comparisons on the two fields use ShortSaleSlot variants; the compiler reports each. Not caught by the compiler: ComboLeg and Order JSON carries the variant name where it carried a number. That form follows the derive Order::short_sale_slot already has; if #1245 settles on integers for integer-coded enums, these two fields follow it. Migration §42 (numbered after #1257's §41).

ComboLeg::short_sale_slot and Order::delta_neutral_short_sale_slot
become orders::ShortSaleSlot, the enum Order::short_sale_slot holds;
serialized, each is the variant name. ComboLeg rustdoc gains the
exempt_code codes and the unsent ratio of a defaulted leg, with its
wire-facts entry (321). CHANGELOG, enum-typing ledger. Migration §42.
@tradatious
tradatious force-pushed the api_b_combo-leg-types branch from 9647454 to 3b8c912 Compare November 16, 2026 19:05
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