Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running StartIBC.bat fails #1

Closed
erdewit opened this issue Mar 18, 2018 · 5 comments
Closed

Running StartIBC.bat fails #1

erdewit opened this issue Mar 18, 2018 · 5 comments

Comments

@erdewit
Copy link

erdewit commented Mar 18, 2018

On windows, with TWS 969 and IBC 3.6.0 installed at default locations, I'm getting an error when running StartIBC.bat:

C:\IBC>c:\IBC\scripts\StartIBC.bat 969

================================================================================

Starting IBC version  on Sun 03/18/2018 at 16:15:49.05

Operating system:  Microsoft Windows 10 Pro  64-bit          10.0.14393

Arguments:

TWS version = 969
Entry point = ibcalpha.ibc.IbcTws
/TwsPath =
/IbcPath =
/Config =
/Mode =
/JavaPath =
/User =
/PW =
/FIXUser =
/FIXPW =

=================================

Generating the classpath
Classpath=!IBC_CLASSPATH!C:\Jts\ibgateway\969\jars\twslaunch-install4j-1.8.jar;C:\IBC\IBC.jar

Generating the JAVA VM options
Java VM Options=!JAVA_VM_OPTIONS! -DnightlyEnabled=true

Determining the location of java.exe
Location of java.exe="C:\ProgramData\Oracle\Java\javapath"

Starting IBC with this command:
""C:\ProgramData\Oracle\Java\javapath"\java.exe" -cp  "!IBC_CLASSPATH!C:\Jts\ibgateway\969\jars\twslaunch-install4j-1.8.jar;C:\IBC\IBC.jar" !JAVA_VM_OPTIONS! -DnightlyEnabled=true ibcalpha.ibc.IbcTws "\Users\Ewald\Documents\IBC\config.ini"

Error: Could not find or load main class !JAVA_VM_OPTIONS!

TWS finished at Sun 03/18/2018 16:15:49.35

Here are the environment variables after the script failed:

ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Ewald\AppData\Roaming
ARG=969
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=TOPCAT
ComSpec=C:\WINDOWS\system32\cmd.exe
CONFIG=\Users\Ewald\Documents\IBC\config.ini
ENTRY_POINT=ibcalpha.ibc.IbcTws
ENTRY_POINT_GATEWAY=ibcalpha.ibc.IbcGateway
ENTRY_POINT_TWS=ibcalpha.ibc.IbcTws
E_CONFIG_NOT_EXIST=1006
E_IBC_PATH_NOT_EXIST=1005
E_INVALID_ARG=1003
E_NO_JAVA=1001
E_NO_TWS_VERSION=1002
E_TWS_VERSION_NOT_INSTALLED=1004
E_TWS_VMOPTIONS_NOT_FOUND=1007
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\Ewald
IBC_CLASSPATH=!IBC_CLASSPATH!C:\Jts\ibgateway\969\jars\twslaunch-install4j-1.8.jar;C:\IBC\IBC.jar
IBC_PATH=C:\IBC
INSTALL4J=C:\Jts\ibgateway\969\.install4j
JAVA_PATH="C:\ProgramData\Oracle\Java\javapath"
JAVA_VM_OPTIONS=!JAVA_VM_OPTIONS! -DnightlyEnabled=true
LOCALAPPDATA=C:\Users\Ewald\AppData\Local
LOGONSERVER=\\TOPCAT
NUMBER_OF_PROCESSORS=4
OneDrive=C:\Users\Ewald\OneDrive
OS=Windows_NT
Path=C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;c:\Python35;C:\Users\Ewald\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\coreutils\bin;C:\Program Files\Git\cmd;C:\Users\Ewald\AppData\Local\Microsoft\WindowsApps;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
PHASE=Starting IBC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3a09
PROGRAM=TWS
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\Ewald\AppData\Local\Temp
TMP=C:\Users\Ewald\AppData\Local\Temp
TOKEN=-DnightlyEnabled=true
TWS_JARS=C:\Jts\ibgateway\969\jars
TWS_PATH=C:\Jts
TWS_VERSION=969
TWS_VMOPTS=C:\Jts\ibgateway\969\ibgateway.vmoptions
USERDOMAIN=topcat
USERDOMAIN_ROAMINGPROFILE=topcat
USERNAME=Ewald
USERPROFILE=C:\Users\Ewald
VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
windir=C:\WINDOWS

The StartTWS.bat and StartGateway.bat scripts will also fail when run in this environment, but will succeed in a clean environment.

Is there any way to get the StartIBC.bat script to run?

@rlktradewright
Copy link
Member

rlktradewright commented Mar 19, 2018 via email

@erdewit
Copy link
Author

erdewit commented Mar 19, 2018

Thanks very much Richard! It works splendidly...

The reason for StartIBC is to use it in a Python wrapper for IBC. IBC then becomes a 'component' that can be started and stopped at will, with the arguments of choice. The code is here. There are some advantages to this over using IBC as a 'service' that has to be running when the API software starts. For example, the API software can start IBC itself and monitor/restart it if required (watchdog). Also there is only one config file needed (with the real password) and with the arguments one can select between TWS or gateway, live or paper, real or edemo etc.

Thanks again and congratulations on the successful launch of the IBC project. It's too bad that the IBC name on group.io is already taken by a book club, but I for one would not mind to see the official IBC discussion on the TWSAPI list like it always was for ibcontroller up until some years ago.

@rlktradewright
Copy link
Member

rlktradewright commented Mar 19, 2018 via email

@yezhengli-Mr9
Copy link

yezhengli-Mr9 commented Feb 12, 2024

For Ubuntu 20.04 version, should I run ./ibcstart.sh to start IBC?

(base) <username>@Ubuntu:/opt/ibc/scripts$ ./ibcstart.sh 

Runs IBC, thus loading TWS or the IB Gateway

Usage:

ibcstart twsVersion [-g \| --gateway] [--tws-path=twsPath]
             [--tws-settings-path=twsSettingsPath] [--ibc-path=ibcPath]
             [--ibc-ini=ibcIni] [--java-path=javaPath]
             [--user=userid] [--pw=password]
             [--fix-user=fixuserid] [--fix-pw=fixpassword]
             [--mode=tradingMode]
             [--on2fatimeout=2fatimeoutaction]

  twsVersion              The major version number for TWS

  -g or --gateway         Indicates that the IB Gateway is to be loaded rather
                          than TWS

  twsPath                 Path to the TWS installation folder. Defaults to
                          ~/Jts on Linux, ~/Applications on OS X

  twsSettingsPath         Path to the TWS settings folder. Defaults to
                          the twsPath argument

  ibcPath                 Path to the IBC installation folder.
                          Defaults to /opt/ibc

  ibcIni                  The location and filename of the IBC 
                          configuration file. Defaults to 
                          ~/ibc/config.ini

  javaPath                Path to the folder containing the java executable to
                          be used to run IBC. Defaults to the java
                          executable included in the TWS installation; failing 
                          that, to the Oracle Java installation

  userid                  IB account user id

  password                IB account password

  fixuserid               FIX account user id (only if -g or --gateway)

  fixpassword             FIX account password (only if -g or --gateway)

  tradingMode             Indicates whether the live account or the paper 
                          trading account will be used. Allowed values are:

                              live
                              paper

                          These values are not case-sensitive.

  2fatimeoutaction       Indicates what to do if IBC exits due to second factor
                         authentication timeout. Allowed values are:

                              restart
                              exit

or

(base) <username>@Ubuntu:/opt/ibc$ ./scripts/ibcstart.sh 

Runs IBC, thus loading TWS or the IB Gateway

Usage:

ibcstart twsVersion [-g \| --gateway] [--tws-path=twsPath]
             [--tws-settings-path=twsSettingsPath] [--ibc-path=ibcPath]
             [--ibc-ini=ibcIni] [--java-path=javaPath]
             [--user=userid] [--pw=password]
             [--fix-user=fixuserid] [--fix-pw=fixpassword]
             [--mode=tradingMode]
             [--on2fatimeout=2fatimeoutaction]

  twsVersion              The major version number for TWS

  -g or --gateway         Indicates that the IB Gateway is to be loaded rather
                          than TWS

  twsPath                 Path to the TWS installation folder. Defaults to
                          ~/Jts on Linux, ~/Applications on OS X

  twsSettingsPath         Path to the TWS settings folder. Defaults to
                          the twsPath argument

  ibcPath                 Path to the IBC installation folder.
                          Defaults to /opt/ibc

  ibcIni                  The location and filename of the IBC 
                          configuration file. Defaults to 
                          ~/ibc/config.ini

  javaPath                Path to the folder containing the java executable to
                          be used to run IBC. Defaults to the java
                          executable included in the TWS installation; failing 
                          that, to the Oracle Java installation

  userid                  IB account user id

  password                IB account password

  fixuserid               FIX account user id (only if -g or --gateway)

  fixpassword             FIX account password (only if -g or --gateway)

  tradingMode             Indicates whether the live account or the paper 
                          trading account will be used. Allowed values are:

                              live
                              paper

                          These values are not case-sensitive.

  2fatimeoutaction       Indicates what to do if IBC exits due to second factor
                         authentication timeout. Allowed values are:

                              restart
                              exit

@rlktradewright
Copy link
Member

@yezhengli-Mr9

It's recommended that you use the higher-level scripts twsstart.sh and gatewaystart.sh, which make life easier.

But you can use ibcstart.sh if you have some particular reason to. For example some Docker images use ibcstart.sh because they don't want the banner window displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants