Search code examples
excelinteractive-brokers

Interactive Brokers Excel subscribe to positions from multiple accounts


I have one Interactive Brokers username with access to multiple accounts.

I want to subscribe using their Excel DDE API to positions for multiple accounts. How can I do this?

All of the Excel DDE examples and API documentation only show how to subscribe to positions for one account. I can see that their sample DDE constructs a portsControl string of the form S{portsServer}|ports!id0?req?{portsCode}. I am hoping there is support for multiple portsCodes or something like that.


Solution

  • You would need to use the newer DDE Socket Bridge API for full TWS API capabilities. It is provided in the current TWS API versions on the IBKR website along with a sample spreadsheet which demonstrates subscribing to position updates from multiple accounts.

    The legacy IBKR DDE API only has the capability to subscribe to aggregate updates for Friends and Family Account (and not other structures) by appending the letter 'A' to the end of the account number in the request. E.g. if your account number is F12345 you can request position updates for account 'F12345A'.