This documentation provides instructions on how to set ZeroLine Trader/ZeroLine SimTrader to trade with multiple TWS.
- Open Multiple TWS
- Define the Connections to the Multiple TWS
- Define Allocation Profile
- Trade with Multiple TWS
You can try ZLT's multiple TWS capability with IB demo accounts first. Here is the instruction how to open two demo TWS.
The screen shots in this document is based on two individual TWS opened on two computers.
1. Add the multiple TWS into the Connections. In the ZLT main window, select Configure -> Markets ....
2. In the Connections table, right click and select New.
3. Note a new connection row is inserted.
Double click on a field to edit it.
Name: the connection name. Just make sure the name is unique from other connections.
Broker: the broker name. For now, it is only IB.
Account: the IB account name, such as U255432.
IP Address is the IP Address of the computer where the TWS is running.
If the TWS is running on the same computer as ZLT is. You can use 127.0.0.1 as the IP address.
Otherwise, you can find the IP address by typing "ipconfig" in a DOS command window.
To open a DOM command window, click Start->Run ...
Then type cmd in the Run window:
Click OK and in the DOS window type ipconfig:
The Port Number should be the same as the number in the TWS's Configure->API->Socket Port ....
If you are running multiple TWS on the same computer, please make sure the TWS have different Port Numbers.
The Client ID can be any positive integer number. If you make multiple connections to one TWS, each connection has to have different client ID.
Auto Connect: check it if you want the connection to be connected at the ZLT startup.
Data Source: check it if you want ZLT to get market data for this connection.
1. If you are connecting ZLT, for example, which is on Computer A to a TWS on a different computer (Computer B), please make sure Computer B is able to accept connection from Computer A. Please check the fireware settings on Computer B.
A simple way to check the connection is to use the ping command. Just type ping <IP Address> in the DOS command window.
In following example, it shows that it fails to connect to the computer at IP address 192.168.0.100.
Now we need to define the allocation profile which determine how shares or contracts are allocated to different TWS, or more accurately, to different accounts in different TWS. The TWS may have multiple accounts if it is a Financial Advisor TWS.
1. From ZLT main window, click Configure->Allocation Profiles ... to open the Allocation Profiles dialog:
Note: ZLT automatically create Sub Account allocation profile for each account. The Sub Account allocation profile's name is in the format of AccountName:ConnectionName, for example, U163:TWS-C. If an order has this allocation profile, all the contracts/shares will be allocated to the account U163 in TWS-C.
2. Right click on the profiles table and select New Absolute Shares Profile ...:
3. The New Allocation Profile dialog pops up:
4. Enter the profile name and shares as following:
5. Click OK to dismiss the New Allocation Profile dialog. Note in the Allocation Profiles dialog, the new profile we just created is listed:
6. Click OK to close the Allocation Profiles dialog.
Now we are back to the ZLT main window and ready to send orders to multiple TWS.
1. If the Allocation column is not shown, just right click on the column header and check the Allocation checkbox in the popup menu.
2. Select a data line and click in its Allocation cell and select the ALL-ONE profile.
3. Click on the Ask Price to generate a Buy order line. Note the order quantity is 2.
4. Click the "T" Transmit cell to transmit the order
5. Right click on the parent data line with "ALL-ONE" allocation profile and select Close. Notice the positions in account U163 and U151 are all closed.
Note: You may have different account numbers instead of U163 and U151.
If you have any question or comment, feel free to email email@example.com