Skip to navigation

Model Account Update

View as MarkdownOpen in Claude

Introduction

EClient.reqAccountUpdatesMulti can be used in any account structure to create simultaneous account value subscriptions from one or multiple accounts and/or models. As with EClient.reqAccountUpdates, the data returned will match that displayed within the TWS Account Window.


Requesting Account Update by Model

EClient.reqAccountUpdatesMulti(reqId, account, modelCode, ledgerAndNLV)

Requests account updates for account and/or model.

EClient.reqAccountUpdatesMulti cannot be used with account="All" in IBroker accounts with more than 50 subaccounts. A profile name can be accepted in place of group in the account parameter for Financial Advisors.
reqId
int

Identifier to label the request.

account
string

Account values can be requested for a particular account.

modelCode
string

Values can also be requested for a model.

ledgerAndNLV
bool

Returns light-weight request; only currency positions as opposed to account values and currency positions.


self.reqAccountUpdatesMulti(reqId, self.account, "", True)

Receiving Account Updates by Model

The resulting account and portfolio information will be delivered via EWrapper.accountUpdateMulti and EWrapper.accountUpdateMultiEnd.

EWrapper.accountUpdateMulti

EWrapper.accountUpdateMulti(requestId, account, modelCode, key, value, currency)

Provides the account updates.

requestId
int

The id of request.

account
string

The account with updates.

modelCode
string

The model code with updates.

key
string

The name of parameter.

value
string

The value of parameter.

currency
string

The currency of parameter.


def accountUpdateMulti(self, reqId: int, account: str, modelCode: str, key: str, value: str, currency: str):
print("AccountUpdateMulti. RequestId:", reqId, "Account:", account, "ModelCode:", modelCode, "Key:", key, "Value:", value, "Currency:", currency)

EWrapper.accountUpdateMultiEnd

EWrapper.accountUpdateMultiEnd(requestId)

Indicates all the account updates have been transmitted.

requestId
int

The id of request.


def accountUpdateMultiEnd(self, reqId: int):
print("AccountUpdateMultiEnd. RequestId:", reqId)

Cancel Account Updates by Model

EClient.reqAccountUpdatesMulti(reqId, account, modelCode, ledgerAndNLV)

To cancel account update subscriptions, call EClient.reqAccountUpdatesMulti with ledgerAndNLV set to false.

reqId
int

Identifier to label the request.

account
string

Account values can be requested for a particular account.

modelCode
string

Values can also be requested for a model.

ledgerAndNLV
bool

Specify false to cancel your subscription.


self.reqAccountUpdatesMulti(reqId, self.account, "", False)