Repository navigation
Conversation
The docs called End the end marker for a batch of summaries. TWS sends End once the initial snapshot is complete, then keeps pushing changed values on the same subscription as Summary rows without another End. A consumer that treats End as a per-update boundary stops refreshing after the first snapshot, or drops the subscription and cancels the request. Document this on AccountSummaryResult and on both account_summary methods.
account_summary yields one row at a time. TWS sends End once, after the initial snapshot, and then pushes only the rows whose values changed, with no further End. A consumer that wants the account as a whole has to keep the latest value of every row itself and decide when a pushed batch is finished. account_summary_snapshots wraps account_summary on both clients and yields AccountSummarySnapshot, the latest value of every row by account, tag and currency. A snapshot completes at an End, or once no row has arrived for a caller-chosen quiet period, because the rows of one push arrive within milliseconds of each other. Rows received before the subscription ends are returned as a final snapshot. Dropping the wrapper cancels the subscription. The row folding and the pending-row tracking are shared by both clients. When both features are enabled the blocking type is at accounts::blocking. AccountSummary now implements Clone and PartialEq.
Contributor
|
Some feedback in case it's helpful to hopefully smooth this being accepted, since this should probably land before my PRs. A few notes from the repo's rules
Other feedback:
If you update the commit, probably also change the CHANGELOG bullets to end with the PR number now that you have it ( |
Emit a snapshot only when a row changed a value since the previous one. An End with nothing changed is skipped once a snapshot has gone out, and the first End still emits, possibly empty, so a consumer always gets an initial snapshot. A repeated row with an unchanged value no longer counts as a change. Move the blocking type to client::blocking, as the dual-feature type rule asks, and drop the accounts::blocking module. Move the snapshot builder tests to a sibling test file. Add tests that go through Client::account_summary_snapshots on both clients with the message bus stub, and the grouping test on the blocking side. Document that notices are dropped and what IB documents about the push cadence, add examples to AccountSummarySnapshot::get and iter, and end the changelog bullets with the PR number.
Contributor
Author
|
Thanks, this was useful. I pushed 017fb89 with most of it. Done:
Not done:
|
3 tasks done
wboayue
added a commit
that referenced
this pull request
Oct 6, 2026
Two #[ignore]d async tests: - end_markers_after_initial_dump: subscribes to account_summary, account_updates(_multi), positions(_multi); optional ES round trip (END_MARKER_FILL=1) forces pushes; prints per-frame timeline + summary - account_summary_end_markers_by_tag_set: regular tags vs $LEDGER:ALL vs both, one connection per case Findings (one paper account, group "All", IB Gateway, 2026-10-05): End only after initial dump on all five streams. account_summary sent two Ends in most runs (not the first smoke run), repeating the $LEDGER block; recorder shows both arrived from TWS. Other account types, named groups and TWS untested. Context: #957.
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.
Summary
account_summaryyields one row at a time. TWS sendsEndonce, after the initial snapshot, and then pushes only the rows whose values changed, with no furtherEnd. A consumer that wants the account as a whole has to keep the latest value of every row itself and decide when a pushed batch is finished. TheEnddoc ("end marker for a batch of account summaries") reads as if it followed every push.This PR adds two commits:
AccountSummaryResult::Endand bothaccount_summarymethods now sayEndmarks the initial snapshot only and the subscription stays open.Client::account_summary_snapshots(&group, tags, quiet)on both clients. It wrapsaccount_summaryand yieldsAccountSummarySnapshot, the latest value of every row by account, tag and currency. A snapshot completes at anEnd, or once no row has arrived forquiet. Rows received before the subscription ends are returned as a final snapshot. Dropping the wrapper cancels the subscription.Design notes
account_summaryitself is unchanged. Rows of one push arrive within milliseconds of each other, so one second has been enough in practice.accounts::common::snapshotsand are shared by the sync and async wrappers.accounts::AccountSummarySnapshotswith an asyncnext. The blocking type is anIterator; with both features enabled it is ataccounts::blocking, as the other blocking types are exposed.AccountSummarynow derivesCloneandPartialEq. This is additive.Evidence
I found the behaviour while fixing an Interactive Brokers adapter that refreshed its account state only on
End. Against a paper TWS, a probe logged 74 summary rows and 2Endmarkers, allEndmarkers before the later rows, and none after them. After an ES fill, changed rows arrived on the open subscription within two seconds. I do not know why that run showed twoEndmarkers and each row twice, so the docs claim only that rows keep arriving afterEndand that noEndfollowed them.Tests: the shared row folding; async snapshots at
End, after the quiet period over a channel that stays open, grouping of one push, and a final snapshot when the subscription ends; and the blocking equivalents.cargo test --libpasses with default features (1654),synconly (1671), and both (2140).cargo clippy --all-targets -- -D warningsis clean in all three, andcargo docbuilds with warnings denied.Not included
A changelog entry is added under Unreleased. I did not add an example.