Gamestudio Links
Zorro Links
Newest Posts
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
Z9 getting Error 058
by k_ivan. 06/10/26 14:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (1 invisible), 1,229 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to select between IB accounts by script? #489466
06/12/26 23:17
06/12/26 23:17
Joined: Jan 2021
Posts: 8
Austin, TX, USA
J
Jack_Zodiac Offline OP
Newbie
Jack_Zodiac  Offline OP
Newbie
J

Joined: Jan 2021
Posts: 8
Austin, TX, USA
Hi,

I am trying to either a) switch between IB accounts programmatically, or b) make a fixed selection of account in the script by e.g. a #define literal.

Currently I have set up an Accounts.csv with distinct names, account ids, and renamed copies of the IB DLL. And then I try:

#define SELECTED_ACCOUNT "IB-ACCT2"
#define ACCOUNT_ID "U1234567"

DLLFUNC void main()
{
Account = SELECTED_ACCOUNT; // with or without this
var *pBalance, *pTradeVal, *pMarginVal;
brokerAccount (SELECTED_ACCOUNT, ACCOUNT_ID, pBalance, pTradeVal, pMarginVal);
printf("Selected account %s, id %s\n", SELECTED_ACCOUNT, ACCOUNT_ID);
...
}

The above executes, but the value shown in the Zorro window corresponds to the default account instead of the selected account, and I get some warning/error messages depending on exactly what variation I'm trying ("BrokerAccount: No Data!" or from IB, "!Unable to subscribe to account as the following clients are subscribed to a different account....")

Declaring a string variable = SELECTED_ACCOUNT and passing in the variable name doesn't work either.

How should this be done? Using Zorro S, by the way.

Thanks very much for any insights!

Re: How to select between IB accounts by script? [Re: Jack_Zodiac] #489470
06/13/26 15:44
06/13/26 15:44
Joined: Feb 2017
Posts: 1,819
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,819
Chicago
If I remember correctly, you can use a Family Advisor account to trade with multiple accounts from one endpoint.


Moderated by  Petra 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1