• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Managed Accounts

A single user name can handle more than one account. As mentioned in the Connectivity section, the TWS will automatically send a list of managed accounts once the connection is established. The list can also be fetched via the IBApi.EClient.reqManagedAccts method:

  • client.reqManagedAccts();
  • client.reqManagedAccts();
  • client.reqManagedAccts()
  • m_pClient->reqManagedAccts();
  • 1  self.reqManagedAccts()

The above will result in a comma separated list of account Ids delivered through IBApi.EWrapper.managedAccounts

  • public class EWrapperImpl : EWrapper
    {
    ...
    public virtual void managedAccounts(string accountsList)
    {
    Console.WriteLine("Account list: "+accountsList);
    }
  • public class EWrapperImpl implements EWrapper {
    ...
    @Override
    public void managedAccounts(String accountsList) {
    System.out.println("Account list: " + accountsList);
    }
  • Public Class EWrapperImpl
    Implements EWrapper
    ...
    Public Sub managedAccounts(accountsList As String) Implements IBApi.EWrapper.managedAccounts
    Console.WriteLine("ManagedAccounts - AccountsList [" & accountsList & "]")
    End Sub
  • class TestCppClient : public EWrapper
    {
    ...
    void TestCppClient::managedAccounts( const std::string& accountsList) {
    printf( "Account List: %s\n", accountsList.c_str());
    }
  • 1 class TestWrapper(wrapper.EWrapper):
    ...
    1  def managedAccounts(self, accountsList: str):
    2  super().managedAccounts(accountsList)
    3  print("Account list:", accountsList)

Important: whenever your TWS user name handles more than a single account, you will be forced to specify the account Id to which the order needs to be allocated. Failure to do so will result in the order being rejected since the TWS cannot assign the order to a default account.