-
Notifications
You must be signed in to change notification settings - Fork 181
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
Comments
Ewald
Apologies for taking so long to reply.
The problem with StartIBC.bat is that it assumes that it’s called from an environment that has called SETLOCAL ENABLEDELAYEDEXPANSION. This command used to be included at the start of this script, but I removed it at some point for a reason that is no longer valid and forgot to put it back. Normally StartIBC.bat is not called directly from the command line, and the supplied script that calls it (DisplayBannerAndLaunch.bat) does indeed call SETLOCAL as required, which is why I didn’t notice the problem you’re having (note to self – test more thoroughly!).
So I’ve pushed an updated version to the repo, or you could add this line directly yourself:
setlocal enableextensions enabledelayedexpansion
after the @echo off statement.
The second problem is simply a hangover from the first: because SETLOCAL is missing, the JAVA_VM_OPTIONS variable retains its value between successive invocations of the script and screws things up. My fix also initialises this variable, though it’s not strictly necessary.
By the way, is there a particular reason why you want to call StartIBC.bat directly rather than via the higher level scripts?
Richard
From: Ewald de Wit <notifications@github.com>
Sent: 18 March 2018 16:20
To: IbcAlpha/IBC <IBC@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [IbcAlpha/IBC] Running StartIBC.bat fails (#1)
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?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, <#1> view it on GitHub, or <https://github.com/notifications/unsubscribe-auth/AHCuTz93bOe7v8nDTYVC9A10Dex6XJXnks5tfokkgaJpZM4SvQ2S> mute the thread. <https://github.com/notifications/beacon/AHCuT8VHumConxy1tmiQqxgSGvSDMVCCks5tfokkgaJpZM4SvQ2S.gif>
|
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. |
Ewald
Thanks for the explanation, I thought it would probably be something like that.
I’m aghast to hear that IBC on groups.io has already been taken! Shucks. I did check a while back and it was still free then, but that group was started on Feb 20 so I guess it must have been longer ago than I thought. It’s a bit embarrassing being pipped at the post by a group with 2 members and only 1 post. Oh well, I’ll have to think again…
By the way, thanks for reminding me that I was supposed to be announcing the change of group name today, and I clean forgot. It’ll have to wait till tomorrow now.
Regarding moving back to the TWSAPI list, others have also suggested this. I’ll consider it – there are pros and cons. One of the cons is that many users are not programmers and have no interest in the API, so they might prefer a list that’s more focused. Perhaps I’ll post a poll to canvass opinion.
Richard
From: Ewald de Wit <notifications@github.com>
Sent: 19 March 2018 23:10
To: IbcAlpha/IBC <IBC@noreply.github.com>
Cc: Richard L King <rlking@aultan.com>; Comment <comment@noreply.github.com>
Subject: Re: [IbcAlpha/IBC] Running StartIBC.bat fails (#1)
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 <https://github.com/erdewit/ib_insync/blob/master/ib_insync/ibcontroller.py> . 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.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHCuT1pWx-p2eM3Tvgn0PRsakeZFigayks5tgDqzgaJpZM4SvQ2S> . <https://github.com/notifications/beacon/AHCuT70UDMrBxXP4qk3XPI6zAWm5icSpks5tgDqzgaJpZM4SvQ2S.gif>
|
For Ubuntu 20.04 version, should I run (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 |
It's recommended that you use the higher-level scripts But you can use |
On windows, with TWS 969 and IBC 3.6.0 installed at default locations, I'm getting an error when running StartIBC.bat:
Here are the environment variables after the script failed:
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?
The text was updated successfully, but these errors were encountered: