orders: send the security type in the spelling the gateway uses (ibx#328) - #346
orders: send the security type in the spelling the gateway uses (ibx#328)#346userFRM wants to merge 1 commit into
Conversation
…328) Order messages put the API-facing security type on tag 167. The gateway answers every execution report with the wire spelling — `167=CS` for a stock, against the `167=STK` that went out — and the rest of the client already converts before sending: the market-data subscribe maps it, and `SecurityType::to_fix` exists for the purpose. The order path was the one place that put the caller's word on the wire. `order_routing` returns the value every caller writes to tag 167 and nothing else, so it converts there rather than at each of the thirty-eight call sites. The conversion goes through the existing security-type mapping, which means an unrecognised type is now sent empty rather than passed through as itself. That is the behaviour that mapping already documents: an instrument the engine could not classify must not masquerade as something the gateway will accept, because the misrouting is silent (ibx#223). This is latent today — order submission is restricted to stocks, and the gateway resolves `STK` for those — and it stops being latent as soon as another security type can be submitted. Verified against a live session: a limit order carrying `167=CS` is accepted as before. The other half of ibx#328 is not addressed here. A submit still carries no ContractID while a replace does, so the two disagree about how a contract is named; adding it touches every submit arm and is worth its own change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
8dbaacb to
61ae1bd
Compare
|
Updated in Doc comment corrected. The block above One item left as is. The changed test exercises Verification beyond the diff:
802 pass plus the two |
|
Closing this. It's in #409 along with the rest of the fork, which is easier to take in one piece than sixty separate branches. |
Summary
Order messages put the API-facing security type on tag 167. The gateway answers every execution report with the wire spelling:
The rest of the client already converts before sending — the market-data subscribe maps it, and
SecurityType::to_fixexists for exactly this. The order path was the one place putting the caller's word on the wire.Closes #328.
Change
order_routingreturns the value every caller writes to tag 167 and nothing else — confirmed across all thirty-eight call sites — so it converts there rather than at each one.It goes through the existing security-type mapping, which means an unrecognised type is now sent empty rather than passed through as itself. That is what the mapping already documents: an instrument the engine could not classify must not masquerade as something the gateway accepts, because that misrouting is silent (#223).
Why now, if it is latent
Order submission is restricted to stocks and the gateway resolves
STKfor those, so nothing is broken today. It stops being latent the moment another security type can be submitted, and the fix is one line at one place while that is still true.Verified against a live session — a limit order carrying
167=CSis accepted exactly as before:Not addressed here
The other half of #328: a submit carries no ContractID while a replace does, so the two disagree about how a contract is named. Adding it touches every submit arm and deserves its own change — I have left the issue open for that reason rather than closing it on a half fix.
cargo test --lib: 802 pass. The twoconfig::expiry_testsfailures are pre-existing and unrelated (timezone data — fixed separately in #336).Test plan
cargo test --offline --lib— 802 passed. The 2 failures areconfig::expiry_tests::{named_zone_converts_with_dst, instant_round_trips_to_wire}, which fail on the base commit too: the host has no legacy timezone files (fixed separately in config: resolve the legacy timezone names IB states its times in (ibx#335) #336).cargo check --offline --features python— clean.engine::market_state::tests::order_routing_rulesby name.🤖 Generated with Claude Code