Interactive Brokers TWS trading-shim Frequently Asked Questions
  Current time: 02:58   
trading-shim Frequently Asked Questions
Certain recurring questions tend to come up in mailing list and support contexts; the links below address or point to further resources about the most common areas of inquiry.
 Show Categories 

Interactive broker's TWS

The TWS from Interactive Brokers is used in the operation of the trading shim.

In order to have an archive of TWS binary .jar to test between, and because of the fact that IB sometimes updates the *nix release web page content before placing new binary releases in place, we follow this procedure:
[ ! -d /opt/home/herrold/trender/ib/ ] && \
	mkdir -p  /opt/home/herrold/trender/ib/
cd /opt/home/herrold/trender/ib/
mkdir temp
cd temp
wget http://www.interactivebrokers.com/download/unixmacosx.jar
cd ..
md5sum `find -name 'unix*.jar'`| sort
#
#	inspect the md5sum result - is the version in ./temp/ new?
#
#	if stale
rm -rd temp
... but occasionally a new release appears. When it does, we need to find out what it thinks its version is. File permissions note: The directory hierarchy in which the TWS is run needs to be writable by the Linux userid in which it is started, to create a sub-directory tree, which sub-directory name is a 'hashed' value of the IB username in which the login to IB occurs certain persistent settings, and configuration files, such as chart parameters (which are shared between the various usernames of that TWS instance).
cd temp
jar xf unixmacosx.jar 
cd IBJts
java -cp \
	jts.jar:jcommon-1.0.0.jar:jfreechart-1.0.0.jar:jhall.jar:other.jar:rss.jar \
	jclient.LoginFrame .
and note the version information in the banners in the console window (one need not supply credentials and authenticate):
[herrold@centos-4 IBJts]$ java -cp \
jts.jar:jcommon-1.0.0.jar:jfreechart-1.0.0.jar:jhall.jar:other.jar:rss.jar \
jclient.LoginFrame .
12:33:30:235 JTS-Main: Build 857.7, Apr 3, 2006 6:08:33 PM
[herrold@centos-4 IBJts]$                                    
and them move back up into ./temp/ and rename the file more descriptively:
cd ..
mv unixmacosx.jar unixmacosx-857.7.jar
mv unixmacosx-857.7.jar ..
#
#	clean up for a future pull
cd ..
rm -rf ./temp

Once one has a new version which one wishes to test, it is useful to set up a sub-directory to hold the candidate and its output:
mkdir tws_ver_857.7
mv unixmacosx-857.7.jar tws_ver_857.7
cd tws_ver_857.7
jar xf tws_ver_857.7
#
#	this will make the subdirectories IBJts and META-INF
cp ../README .

The script README is a special script, which is quite straightforward, having as its purposes moving into the proper directory, and starting the Java TWS-API:
[herrold@centos-4 tws_ver_857.7]$ cat README
#!/bin/sh
#
#       http://www.interactivebrokers.com/download/unixmacosx.jar
#
#      jar xf unixmacosx.jar
#
JFREE="1.0.0"
JCOMM="1.0.0"
#       rss.jar new at 856.5
JREST="jhall.jar:other.jar:rss.jar"
#
cd IBJts
java -cp \
        jts.jar:jcommon-${JCOMM}.jar:jfreechart-${JFREE}.jar:${JREST} \
	jclient.LoginFrame .
#
[herrold@centos-4 tws_ver_857.7]$
We use the script to act as a 'target' for another (more complex) script, in the regular executable path, and which attends to keeping debugging logs, and such on an automatic basis:
[herrold@centos-4 tws_ver_857.7]$ cat ~/bin/run-tws
#!/bin/sh
#
YMD=` date +%Y%m%d `
cd /opt/home/herrold/trender/ib/
# cd tws_ver_857
#
cd tws_ver_856.5
#       pbm 060412 w 857.7 charting
# cd tws_ver_857.7
WHR=` pwd `
#
echo "$YMD"
echo "start ${YMD} ${WHR} "
#
date >> transcript-${YMD}.txt
echo "start ${YMD} ${WHR} "  >> transcript-${YMD}.txt
echo " -- view with fmt -tcs (file)"  >> transcript-${YMD}.txt
( ./README 2>&1 ) | tee -a transcript-${YMD}.txt
date >> transcript-${YMD}.txt
echo "end"    >> transcript-${YMD}.txt
echo " "      >> transcript-${YMD}.txt
#
#
[herrold@centos-4 tws_ver_857.7]$
This permits substituting various testing versions in and out with little effort, and also has logging collection within it. This does NOT however move over a live set of debugging configuration. We manually prepare those configuration (see the files: log.filter and subscribe in the tarball, in the ./bin/ subdirectory).


Avoiding the 'newer version available' message
Edit jts.ini in the [communication] stanza to add the line:
checkVersion=0
A revised sample file might look like this:
[Logon]
UseSSL=false

[communication]
Peer=gw4.ibllc.com:4000
checkVersion=0

TWS, API, and FIX quick links at IB

Summary pointer page into current release notes
Beta API release notes Production API release notes
TWS, [Proprietary] API, and FIX (CTCI) compared

JumpLinks

version ] [ quick ]
Last modified: Fri, 20 Apr 2007 21:08:04 -0400

HomeSearchInterior documentationProgram documentationFAQDownloadPDFsScreen shots ]  [ Contact UsSite MapBugzillaMailman |  Mailing List Archives: (MainLicenseAboutPressCopyright ]

Copyright (c) 2006 ... 2009 trading-shim.com, LLC, Columbus, OH