BrokerIB.exe: GetTradingInterface() returns null

Tags: #<Tag:0x00007f80458f42e8>



I've been using the BrokerIB.exe together with Interactive Brokers for about five years, without any problem.

This is the code I have

ibc = GetTradingInterface("IB");
for ( i = 0; i < 10 && ( ibc.IsConnected() != 2 AND ibc.IsConnected() != 3 ); i++ ) 
  ibc.Sleep( 200 );

This evening, it stopped working with the error message

COM/object handle is null

The AB log trace displays the same message. As far as I can tell, the connection between AB and the BrokerIB.exe is broken.

I have checked the IB settings on Edit -> Global Configuration -> API -> Settings, and they haven't changed.

The BrokerIB.exe itself seems to be working perfectly. It retrieves the Portfolio and Pending Orders from IB perfectly. However, it displays the messages

ID=2147483647. Error 321. Error validating request: - 'be' : cause -Invalid account code 'UxxxxxxA'.
ID=2147483647. Error 321. Error validating request: - 'be' : cause -The account code is required for this operation.
Connection established OK. Next order ID=19414
ID=-1. Error 2106. HMDS data farm connection is OK: ushmds
Connection established OK. Next order ID=19414
Available accounts: UxxxxxxA, Uxxxxxx, Uyyyyyy,
Using FA account Uxxxxxx

These messages have always been displayed, so I don't think they are related to my problem.

I have two accounts Uxxxxxx and Uyyyyyy. How does IB decide which use one to use as the FA account, with the letter 'A' appended at the end? I haven't programmed this FA account anywhere in my code. The last message seems to imply that it uses Uxxxxxx as the FA account, instead of UxxxxxxA.

Many thanks,


Most likely antivirus or other "registry cleaner" that you are running on your system unregistered BrokerIB COM server in the Windows registry (HKEY_CLASSES_ROOT). To fix that you need to right click on BrokerIB.exe and select "Run As Administrator". Just once. That should be enough to fix missing OLE registration.


Great! That solved it. Updated as a comment in my code, so that I don't forget the next time it happens.

Many thanks Tomasz.