Skip to content

6.0: account_updates_multi takes a LedgerOnly - #1183

Merged
wboayue merged 3 commits into
wboayue:mainfrom
tradatious:api_b_account-updates-multi-ledger
Nov 5, 2026
Merged

wboayue merged 3 commits into
wboayue:mainfrom
tradatious:api_b_account-updates-multi-ledger

Conversation

@tradatious

@tradatious tradatious commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer update: the third argument is now ledger_only: accounts::LedgerOnly (Yes / No) instead of ledger_and_nlv: bool, so call sites read account_updates_multi(Some(&a), None, LedgerOnly::Yes) rather than a bare true. This follows SmartDepth / IgnoreSize. LedgerOnly::Yes is wire true. There is no Default, so the caller picks. Below, true = LedgerOnly::Yes, false = LedgerOnly::No.

Description

Client::account_updates_multi (async and blocking) takes a third argument, ledger_and_nlv: bool, the flag of TWS's reqAccountUpdatesMulti. true delivers only the per-currency $LEDGER-* keys ($LEDGER-CashBalance, $LEDGER-NetLiquidationByCurrency, ..., one set per currency and for BASE), TWS's light-weight request; false delivers those plus the account-level keys without the prefix (NetLiquidation, BuyingPower, AvailableFunds, ...). Previously the encoder always sent true, so the account-level keys could not be requested. The flag is encoded like the crate's other request flags (some_bool: set only when true, as the official client does).

Verified against a live gateway (read-only, server 226, one account, no model code): true returned the 75 $LEDGER-* values (25 keys × 3 currencies) and nothing else; false returned those plus 72 values of 70 account-level keys. IB's doc page describes true as "returns light-weight request; only currency positions as opposed to account values and currency positions" (interactivebrokers.com/docs/tws-api/doc/account-portfolio-data/account-update-by-model/requesting-account-update-by-model); the proto field comment ("Set as True if currency and net liquidation values should be delivered with updates") reads as if true adds data, so the rustdoc, migration section and CHANGELOG say which keys arrive instead of using either phrasing. Entry in docs/wire-facts/accounts.md. The blocking account_updates_multi rustdoc also drops the sentence copied from account_updates ("All account values and positions will be returned initially ... every 3 minutes"), which describes that request's cadence; the async doc never had it.

Testing

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings (default, --no-default-features --features sync, --all-features)
  • cargo doc --no-deps with RUSTDOCFLAGS="-D warnings" (same three configurations)
  • cargo test (same three configurations)
  • cargo build --examples (same three configurations)
  • cargo build -p ibapi-integration-sync --tests, cargo build -p ibapi-integration-async --tests
  • cargo clippy -p ibapi-integration-sync --tests -- -D warnings, cargo clippy -p ibapi-integration-async --tests -- -D warnings

All pass on the change. After the rebase onto current main: cargo clippy --all-targets --all-features -- -D warnings and cargo test --all-features; the later docs-only amends: cargo fmt --check and cargo doc --no-deps --all-features with RUSTDOCFLAGS="-D warnings".

Breaking changes

Yes. Callers of account_updates_multi add a third argument; LedgerOnly::Yes keeps the previous behavior. Migration §16.

@tradatious
tradatious force-pushed the api_b_account-updates-multi-ledger branch 2 times, most recently from db9ad8c to 53cd7b0 Compare November 5, 2026 20:44
`Client::account_updates_multi` (async and blocking) takes
`ledger_and_nlv: bool`: `true` delivers only the per-currency
`$LEDGER-*` keys, `false` those plus the account-level keys. Previously
the request always sent `true`. Rustdoc, example, CHANGELOG, migration
guide, wire-facts.
@tradatious
tradatious force-pushed the api_b_account-updates-multi-ledger branch from 53cd7b0 to 29020f2 Compare November 5, 2026 21:46
A bare bool after two positional Options reads as
account_updates_multi(Some(&a), None, true); LedgerOnly::Yes/No names
the choice, following SmartDepth/IgnoreSize. No Default: the caller
picks, as the migration section already says. Converted to the wire
bool at the client boundary, so encoder and test builder are unchanged.

Also: "behaviour" -> "behavior" in CHANGELOG; capitalized arg doc.
@wboayue wboayue changed the title 6.0: account_updates_multi takes ledger_and_nlv: bool 6.0: account_updates_multi takes a LedgerOnly Nov 5, 2026
… integration tests

Conversion to the wire bool now lives once in the shared encoder instead
of in both the sync and async client methods.
@wboayue
wboayue merged commit 485f5d5 into wboayue:main Nov 5, 2026
7 checks passed
@tradatious
tradatious deleted the api_b_account-updates-multi-ledger branch November 6, 2026 04:27
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