Accounts, positions, portfolio, and PnL
Local state
After startup synchronization:
accounts = ib.managedAccounts()
positions = ib.positions(account="DU1234567")
portfolio = ib.portfolio(account="DU1234567")
values = ib.accountValues(account="DU1234567")
summary = ib.accountSummary(account="DU1234567")
These read synchronized memory. Position contains account, contract, position, and average cost. PortfolioItem adds market price/value and unrealized/realized PnL. AccountValue is a string-valued (account, tag, value, currency, modelCode) record; parse numerics defensively because values and availability vary by account and tag.
Account updates versus summary
reqAccountUpdates(account) creates the traditional single-account stream and is called during startup when an account is selected. reqAccountUpdatesMulti scopes updates by account/model and is better for advisors and subaccounts. MaxSyncedSubAccounts defaults to 50; above that threshold connectAsync skips automatic per-subaccount synchronization.
reqAccountSummary supplies a standardized cross-account summary. The summary subscription has its own tags and update cadence; it is not a transactional ledger and values can arrive at different times.
Positions limits
reqPositions returns all positions for supported account structures, but IBKR documents restrictions for very large introducing-broker structures. reqPositionsMulti provides account/model scoping. ib_async.IB exposes high-level multi-account-update helpers while lower-level Client exposes the full protocol calls.
PnL subscriptions
pnl = ib.reqPnL("DU1234567", modelCode="")
single = ib.reqPnLSingle("DU1234567", "", conId=265598)
# later
ib.cancelPnL("DU1234567", "")
ib.cancelPnLSingle("DU1234567", "", 265598)
PnL objects update in place and emit pnlEvent/pnlSingleEvent. Unrealized and daily PnL depend on IBKR's reset rules, instrument valuation, account configuration, and data availability. Do not recreate a financial ledger from PnL callbacks.
Multi-account orders
Set Order.account explicitly whenever more than one account is accessible. Financial-advisor allocation fields (faGroup, faMethod, faPercentage, modelCode) are mutually contextual and permission-dependent. Never rely on the currently selected TWS account for an API order.
Reconciliation principle
Positions are the result of executions and other account activity, not an order history. Persist fills by execId; reconcile stored positions against fresh IBKR positions; investigate breaks rather than overwriting the ledger silently.