ccp: report the time-in-force that was submitted, not a plausible default (ibx#307) - #356
Closed
userFRM wants to merge 1 commit into
Closed
ccp: report the time-in-force that was submitted, not a plausible default (ibx#307)#356userFRM wants to merge 1 commit into
userFRM wants to merge 1 commit into
Conversation
…ault The wire match on tag 59 ended in `_ => "DAY"`, so every path produced a non-empty string and the fallback that knows what this client actually submitted could never run. An unrecognised code and an absent tag alike were reported as DAY — an ordinary value, so a caller reconciling its own orders got a plausible answer that disagreed with what it sent, with nothing to say so. An absent tag now leaves the string empty, which is what makes the fallback reachable, and a stated but unmapped code is reported as stated: the gateway is authoritative when it says anything, and a code this does not name is still better seen than replaced by an unrelated local value. That mirrors the order-type sibling directly above it. A recovery record with no tag 59 states no time-in-force, and the order was not placed by this session, so there is nothing to recover it from. It is recorded as unstated rather than guessed. Either guess is restated as a real instruction on the next replace — tag 59 on a `35=G` sets what the gateway is holding — and an invented DAY would expire an order that is resting until cancelled. A replace of an order with no stated time-in-force omits tag 59 and leaves the resting value in force. `decode_tif` already maps anything it does not recognise to the empty string, so an unstated time-in-force reports as unstated rather than as an ordinary value. Closes deepentropy#307.
userFRM
force-pushed
the
fix/tif-fallback-unreachable
branch
from
July 30, 2026 15:41
92afc50 to
bde8652
Compare
userFRM
added a commit
to userFRM/ibx
that referenced
this pull request
Aug 3, 2026
… the side guard, and drop tag 59 after the fields are built
Author
|
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. |
userFRM
added a commit
to userFRM/ibx
that referenced
this pull request
Aug 30, 2026
…d TIF with the side guard, and drop tag 59 after the fields are built
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The wire match on tag 59 ended in
_ => "DAY", so every path produced a non-empty string and the fallback that knows what this client actually submitted could never run.An unrecognised code and an absent tag alike were reported as
DAY. That is an ordinary value, so a caller reconciling its own orders got a plausible answer that disagreed with what it sent, and nothing said so.What this changes
An absent tag leaves the string empty, which is what makes the fallback to the tracked order reachable.
A stated but unmapped code is reported as stated. The gateway is authoritative when it says anything, and a code this does not name is still better seen than replaced by an unrelated local value. That mirrors the order-type sibling directly above it.
A recovery record with no tag 59 is recorded as unstated, not guessed. The order was not placed by this session, so there is nothing to recover it from. Either guess becomes a real instruction on the next replace — tag 59 on a
35=Gsets what the gateway is holding — and an inventedDAYwould expire an order that is resting until cancelled. A replace of an order with no stated time-in-force omits tag 59 and leaves the resting value in force.decode_tifalready maps anything it does not recognise to the empty string, so an unstated time-in-force reports as unstated rather than as an ordinary value.Tests
an_unknown_time_in_force_falls_back_to_the_one_that_was_submitted— absence uses the submitted value; a stated code is reported as stated.a_recovered_order_without_a_time_in_force_states_none— the recovered order reports unstated, and a replace of it carries no tag 59.Both fail by name against a compiling reversion of the production change they cover.
Closes #307.
Test plan
b'0'fallback failsa_recovered_order_without_a_time_in_force_states_noneby name.59=with the raw sentinel, which is worse than the value it replaced.an_unknown_time_in_force_falls_back_to_the_one_that_was_submittedcovers both directions: absence uses the submitted value, a stated code is reported as stated.cargo check --offlineclean on--lib,--lib --features python,--bins,--examples, and each integration target individually.tests/ib_paper_compatcompared against a clean checkout of the base commit — identical sorted diagnostic sets.cargo test --offline --lib— only the two knownconfig::expiry_testsfailures, which fail on the base commit for missing legacy tzdata (fixed separately in config: resolve the legacy timezone names IB states its times in (ibx#335) #336).