Git Product home page Git Product logo

ib-controller's Introduction

Download the latest official release here

IBController provides hands-free operation of Interactive Brokers Trader Workstation. It's especially useful for developers of automated trading systems who use IB API. Features include:

  • Automates Trader Workstation (TWS) and IB Gateway (including the FIX mode)
  • Completes login dialog with credentials from an .ini file or command line
  • Handles dialog boxes which TWS presents during programmatic trading activities
  • Keeps TWS running indefinitely by handling TWS time-based exits
  • Allows TWS to be terminated at a specified time on a specified day of the week
  • Dismisses various dialog messages (eg version updates, daily tips, IB API connections etc)
  • Exposes a telnet control protocol to STOP the GUI or ENABLEAPI for IB API client access

Downloads

If you just want to use IBController without modifying it, you should download the latest official release ZIP which you can find here.

Should you ever need to revert to an earlier IBController release, they are also available here.

A docker container with a working IBController and IBGateway combination is available from [QuantConnect] (https://github.com/QuantConnect/Lean/blob/master/DockerfileLeanFoundation).

If you use Arch Linux you can install the ib-controller package from AUR: it includes lots of server-oriented features such as multiple daemons, systemd units, headless/virtual framebuffer support, Monit monitoring etc.

Developers may wish to embed IBController for integration testing convenience (eg see projects GoIB and IB Connect)

User Guide

Please see the IBController User Guide for installation and usage instructions. The User Guide is also included as a PDF file in the download ZIP.

Support

IMPORTANT By far the most common problem that users have when setting up IBController is the result of trying to use it with the self-updating version of TWS.

IBController DOES NOT WORK with the self-updating version of TWS.

You must install the offline version of TWS for use with IBController.

Note however that there is no self-updating version of the Gateway, so the normal Gateway installer will work fine if you only want to use the Gateway.

If you need assistance with running IBController, or have any queries or suggestions for improvement, you should join the IBController User Group.

If you're convinced you've found a bug in IBController, please report it via either the IBController User Group or the GitHub Issue Tracker.

Please provide as much evidence as you can, especially the versions of IBController and TWS/Gateway you're using and a full description of the incorrect behaviour you're seeing.

Note that IBController creates a log file that records a lot of useful information that can be very helpful in diagnosing users' problems. The location of this log file is prominently displayed in the window that appears when you run IBController. It is helpful to attach this log file to any problem reports.

Contributing

We welcome your involvement and contributions! Please read the contributor guidelines, and send us a pull request.

We also thank past contributors to the original SourceForge project: Richard King, Steven Kearns and Ken Geis. Plus of course all those on our GitHub contributor list.

License

IBController is licensed under the GNU General Public License version 3.

ib-controller's People

Contributors

benalexau avatar jaredbroad avatar rlktradewright avatar shanecastle avatar skoschnicke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ib-controller's Issues

IbAutoClosedown=no

I have the configuration set to IbAutoClosedown=no, however TWS still keeps shutting down once a day despise having the setting ON. Can you please help?

Using ssh forwarding - The remote host closed the connection

Hi,

I know this is strictly speaking not relative to ibcontroller but since you mention this tip in the README itself, maybe you already tried this method and already stumbled and overcomed the problem I have.

So I would like to connect to the ibgateway running on a remote server thanks to ssh forwarding. On the client where I want to connect the API, I run this command:

$ ssh -L 4001:localhost:4001 [email protected] -N

The ssh connection is established but when trying to connect the API, I get an error (retrieved by the EWrapper method "error"):

id: -1, errorCode: 502, errorString: The remote host closed the connection

To debug this, I tried:

  • connecting to the ibgateway from the server itself and it works.
  • forwarding something else like the webserver running on the server machine and it works:
$ ssh -L 4001:localhost:80 [email protected] -N
$ curl localhost:4001

This outputs the correct html page.
So for me, the ssh tunnel works as expected and the ibgateway also. But there must be something I'm missing. Do you have any idea what could it be?

Here is my .ini, in case it could help:

LogToConsole=yes
FIX=no
PasswordEncrypted=no
FIXLoginId=
FIXPassword=
FIXPasswordEncrypted=yes
StoreSettingsOnServer=no
MinimizeMainWindow=yes
ExistingSessionDetectedAction=primary
AcceptIncomingConnectionAction=accept
ShowAllTrades=no
IbAutoClosedown=no
ClosedownAt=
AllowBlindTrading=yes
DismissPasswordExpiryWarning=yes
DismissNSEComplianceNotice=yes
IbControlFrom=
IbBindAddress=127.0.0.1
CommandPrompt=
SuppressInfoMessages=no

Additional prompt needs closing for Paper Trading accounts

In the latest version of TWS (954.2a), there is a new popup that forces you to acknowledge that you're using a paper trading account before TWS will connect to the API:

screen shot 2015-11-28 at 9 00 57 pm

Ideally, IBController will automatically press the "I understand and accept" button to complete the login process

add 'want to exit' dialog handler

image

package ibcontroller;

import java.awt.Window;
import java.awt.event.WindowEvent;
import javax.swing.JDialog;

class WantToExitDialogHandler implements WindowHandler {
    public boolean filterEvent(Window window, int eventId) {
        switch (eventId) {
        case WindowEvent.WINDOW_OPENED:
        case WindowEvent.WINDOW_ACTIVATED:
            return true;
        default:
            return false;
        }
    }

    public void handleWindow(Window window, int eventID) {
        if (Utils.clickButton(window, "Yes")) {
            Utils.logToConsole("dismissed 'want to exit' dialog");
        } else {
            Utils.logError("could not dismiss 'want to exit' dialog");
        }
    }

    public boolean recogniseWindow(Window window) {
        if (!(window instanceof JDialog))
            return false;

        if (Utils.findLabel(window, "want to exit") != null)
            return true;

        return false;
    }

}

IBControllerStart.sh not working unless you provide username and password in .sh file

HI,

Thanks for this great utility. I tried to set it up this morning, but failed.

To me it looks that on Ubuntu the only way to make this work is provide Id nad password "hardcoded" in IBControllerStart.sh. If you leave them blank they are not red from .ini file and the application does not start. This is the error message:

"IBController: 2 arguments passed, but args[0] is not 'encrypt'. quitting..."

Apllication starts fine if I provide username and password in IBControllerStart.sh file...

How is two-factor auth handled?

How does this software behave if two-factor authentication is enabled on an IB account? I see that it handles usernames + passwords, but I don't see any mention of handling additional authentication.

Login with a security code card?

Is there any plan to support the security code card login window?

It would require a custom config of course that would represent the whole security code card...

so this window can be handled :

Security code check

It is normally used with such a card :

Security code card

Thanks!

Using with docker

Struggling trying to get this thing propped up in a docker container. Followed the IBGo testserver, but no luck.

tws_gateway is a successfully built object from a clone of the this.

docker run -P username/tws_gateway

I then copy the boot2docker ip and the port listed under docker ps for the container built from the tws_gateway image. I tried modifying the local ip used in the testserver scripts to reference 0.0.0.0 and injected the latest version of the unixmacosx.jar standalone from IB itself (953 I think?). I also tried editing the user account to use the edemo (individual) vs the provided fdemo (advisor account).

I then try to run my automated trading python script from the host machine (read: not from a docker container) and it fails to connect with the error:

<error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>

My goal in running the script locally was to simulate running the gateway on a standalone server so that I could set up an automated trading system in a cloud setup. Any help for getting this set up?

Issue with latest version - cannot start

Hello,

I used to play with ibcontroller 2.12.0 and it works fine with latest version, however, when I try to upgrade to 2.12.2, I got this error: Unsupported major.minor version 51.0

When to target Java 8

Java 8 has been out for a good long time now, and Java 7 is very much deprecated (Oracle stopped issuing public updates for it back in May 2015). However IBController is still targeted on Java 7, which means that the source code can't take advantage of any of the new features in Java 8. (Whether these new features provide anything of real value for IBController is another matter, and I might create a branch to investigate this.)

The reasons for continuing to target Java 7 are:

  • TWS (as far as I'm aware) still works on Java 7
  • I've wanted to avoid forcing users to move to Java 8 (there may be some valid reason why this would cause them problems)

But perhaps it's time to review this stance?

I would imagine that the majority of TWS users have upgraded to Java 8 by now, though I have no evidence to support that view. But if they haven't, and we retarget IBController to Java 8, then there's nothing to stop them continuing to use their current version of IBController (at least until IB issues a version of TWS that breaks IBController: however this is not a common occurrence).

So does anyone have any particular views on this, or should just go for it?

IBGateway Server Not Starting For Live Trading user.

Hi,
I'm getting following message while trying to run IBControllerGatewayStart.sh and IBController does start listening but IBGateway server does not start up.
JTS-Fuse-sd-63: Reset transferrable socket:ushmds cdc1.ibllc.com:4000

Can anyone tell me what's the exact issue and how do i get over it?

However, everything works fine when i use demo user. But using my secondary user of the live trading account tend to cause the above issue. The security card login is disabled for secondary user. And im using IBGatway version: 939.5c and IBController 2.13.1

Cannot disable Read-Only mode

hello

I'm using IBController 3.0.0 and IB Gateway Build 952.1e, Oct 27, 2015

It seems like read-only mode is enabled by default and I cannot disable it.

Inside IBController.ini I set:

ReadOnlyLogin=no

But still I'm getting the following error when trying to place an order:

client: 0; request id: 25; error code: 321; error message: Error validating request:-'td' : cause - The API interface is currently in Read-Only mode.

I noticed that once the IBGateway is started up for the first time and properly shut-down (by sending "STOP" to port 7462) a new directory daryk... (the last few letters change every time) is created. This directory contains a file named ibg.xml. This file has some settings regarding the API:

<ApiSettings varName="api" dde="false" readOnlyApi="true" allowOnlyLocalhost="true" socketClient="false" autoOpenOrdDonwload="true" port="4001" includeFxPositions="true" includeContinuousUpdateChanges="true" sendMessagesInEnglish="false" sendMessagesTranslated="true" logLevel="2" useNegativeAutoRange="true" overridePrecautionaryConstraints="false" bypassBondWarning="false" bypassYtwWarning="false" bypassCalledBondWarning="false" masterClientID="-1" acceptLargeSize="false" showApiMsg="false" includeMktData="false" createApiMsgLogFile="false" showIBGConsole="false" aPINotAllowedShownAfterDenyAPI="false" slowBufferTimeout="30" syncAccounts="false" multichartNetDoNotShowTime="0" multichartDoNotShowTime="0" verifiedAppPortRangeStart="7000" verifiedAppPortRangeEnd="8000" timeOfVerifiedAppShutdown="0" portOfVerifiedAppShutdown="0">

As you can see there is a setting related to the readOnly:

readOnlyApi="true"

But obviously modifying the file manually does not sound like a good idea. Is there something that can be done through the IBController to disable the readOnlyApi?

Thanks
Andy Flury

IBController doesn't work with OpenJDK 8 on Ubuntu 15.04

Installed OpenJDK 8 on my Ubuntu 15.04 VM, and now IBController fails immediately with a SecurityException when it tries to print out the Java system properties.

My immediate reaction is that Ubuntu has decided to include a default security manager for all Java applications, and the default security policy doesn't allow this action. (Normally desktop applications run with no security manager, but they can implement one for their own purposes if required.)

I need to verify this, and consider the best workaround, probably one of the following:

  • implement a security manager in IBController (however this may be a non-starter as the default security policy may not allow IBController to install a security manager!)
  • include a local security policy file in the IBController setup
  • somehow defeat the default security manager!

In the meantime, if you want to run IBController on Ubuntu 15.04, revert to OpenJDK 7.

Is there any way to change IB gateway default config?

Hi, I want run IB gateway on headless server, but I could not change the default config, It will read config file from a random directory when IB gateway starting. I don't know this dir's name. when I restart it, it will create new dir. so, ib-controller can control it ๏ผŸ

What are possible values of IBBindAddress?

I am running IBGateway in a server whose ip is x.x.x.x and i'm trying to connect to this IBGateway from another server y.y.y.y. In IBBindAdress, i tried putting y.y.y.y but it gives me following exception:

13:55:07:804 IBController: exception:
java.net.BindException: Cannot assign requested address

Does this parameter only takes 127.0.0.1? Is there any way i can achieve the above thing?

IBController does not start

Hi,
If this place is not the right to ask for help, please point to another
the message I receive when starting is: IBController: IBController: ini file "~/IBController/IBController.ini" either does not exist, or is a directory. quitting...
The IBController.ini is in home directory ~/IBController, the owner is the user with no admin rights
the shell file is in /opt/IBController
System: Ubuntu 14.04LTS,
this message support only images, I can't upload the .ini file to check

TWS 954.2a: Sometimes fails to send login information

After upgrading to the latest TWS, it would appear that there's some kind of race condition that SOMETIMES (around 20% of the time) logs you in correctly, but most of the time does not.

Here's the console log from a failed login attempt:

------------------------------------------------------------
01:50:05:050 IBController: ini file is /opt/IBController/IBController.ini
01:50:05:061 IBController: IBControllerServer is started.
01:50:05:074 IBController: IBControllerServer listening on address: 3054251e0512/172.17.0.2 port: 7462
01:50:05:169 IBController: TWS settings directory is /opt/IBJts/jars 
01:50:05:804 JTS-Main: dayInit: new values: dayOfTheWeek: 1 (Sun), YYYYMMofToday: 201511, YYYYMMDDofToday: 20151129
01:50:05:908 JTS-Main: getFileFromUrl: dest=/opt/IBJts/jars/locales.jar empty sourceSize=61859
01:50:06:970 JTS-Main: Build 954.2a, Oct 30, 2015 4:07:54 PM 
01:50:08:393 AWT-EventQueue-0: Login failed - Failed send NSMsg - java.lang.NullPointerException

And here's what TWS looks like:
screen shot 2015-11-28 at 8 54 41 pm

Something important to note is that if you move the error box, your credentials appear to be correctly entered:
screen shot 2015-11-28 at 8 55 51 pm

I've seen this behavior with both demo accounts and personal paper trading accounts.

error starting IBController

Hello,

First, thank you for this nice application.

I downloaded the zip file and try to run IBController (with Ubuntu 15.04 and IB Gateway 939.5b) :
$ cd ~/ib-controller-master/resources
$ bash IBControllerGatewayStart.sh
...
17:14:44:090 IBController: TWS settings directory is /home/jack/ib-controller-master/IBJts
17:14:44:588 JTS-Main: dayInit: new values: dayOfTheWeek: 2 (Mon), YYYYMMofToday: 201504, YYYYMMDDofToday: 20150427
17:14:44:986 JTS-Main: LOCALE: needToUpdate dest=/home/jack/ib-controller-master/IBJts/locales.jar sourceMod=2014-08-07 20:45:00 destMod=2014-08-07 20:45:00 sourceSize=61859 destSize=61859 conditions=[NEWER_REMOTE, LOCAL_IN_FUTURE, SIZE_DIFFERS] download=false
17:14:45:519 JTS-Main: Build 939.5b, Jan 5, 2015 7:04:29 PM
17:14:45:828 AWT-EventQueue-0: Error
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:514)
at javax.swing.JEditorPane.registerEditorKitForContentType(JEditorPane.java:1245)
at javax.swing.JEditorPane.registerEditorKitForContentType(JEditorPane.java:1227)
at javax.swing.JEditorPane.loadDefaultKitsIfNecessary(JEditorPane.java:1305)
at javax.swing.JEditorPane.getKitTypeRegistry(JEditorPane.java:1262)
at javax.swing.JEditorPane.getEditorKitClassNameForContentType(JEditorPane.java:1258)
at javax.swing.JTextPane.(JTextPane.java:93)
at twslaunch.jtscomponents.html.d.a(d.java:230)
at twslaunch.jtscomponents.html.d.a(d.java:210)
at twslaunch.jtscomponents.html.d.a(d.java:194)
at twslaunch.jclient.tc.(tc.java:397)
at ibgateway.dc.(Unknown Source)
at ibgateway.eb.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

I don't know how to mange this error.
Any clue ?
Thanx.
++

Jack

Set trusted IP

Hello,

Is there a way to set the trusted IP? I'd like to run remotely and by default, only 127.0.0.1 is accepted.

add "log in as a client" dialog handler

image

package ibcontroller;

import java.awt.Window;
import java.awt.event.WindowEvent;

import javax.swing.JDialog;

class LoginAsClientDialogHandler implements WindowHandler {

    static final String LABEL = "log in as a client";

    public boolean filterEvent(Window window, int eventId) {
        switch (eventId) {
        case WindowEvent.WINDOW_OPENED:
        case WindowEvent.WINDOW_ACTIVATED:
            return true;
        default:
            return false;
        }
    }

    public void handleWindow(Window window, int eventID) {
        if (Utils.clickButton(window, "Close")) {
            Utils.logToConsole("dismissed " + LABEL + " dialog");
        } else {
            Utils.logError("could not dismiss " + LABEL + " dialog");
        }
    }

    public boolean recogniseWindow(Window window) {
        if (!(window instanceof JDialog))
            return false;

        if (Utils.findLabel(window, LABEL) != null)
            return true;

        return false;
    }

}

Set datafarm

First a BIG thanks for this excellent job!

Tiny question I couldn't figure out Is there a way to set the datafarm used by the IBgateway?
On the interface we can use usfarm, eufarm and asia if i'm not mistaken.

2.14.0 fails to run on windows 10

Fatal Error: one of the following jar files is missing from the classpath:
jfreechart-1.0.9.jar
jcommon-1.0.12.jar
Please make sure you run the application from the shortcut that was
installed on your desktop or on the Start menu when you upgraded.

The application will now terminate.

Tried with 2.13.1, no such problem have been found

ReadOnlyLogin Parameter in ini FIle does not work

Dear Developers!

I would like to use the IBController on a headless ubuntu machine and I would like to bypass the tokenlogin with the ReadOnlyLogin parameter. Unfortunately this does not work although I have set

ReadOnlyLogin=yes

When testiing it on my local workstation with TWS Build 952.1e, the Login procedure stops at the security token entry, and I need to click the button ReadOnly manually.

Is there something that can be done?

With regards
Markus

ExistingSessionDetectedAction=primary not working with TWS 950.2g

Hey,

I am using ib-controller 2.13.1 and tws 950.2g and experience problems with setting ExistingSessionDetectedAction to primary. When starting tws with ibcontroller and another session is currently active the setting works as expected and grabs the existing session. But when tws with ibcontroller is already running and I start another session the upcoming relogin dialog is not handled at all and the session is not reconnected. This is not the behavior stated in the ini files comment.

I can confirm that the setting works as expected with TWS 948.3c. Therefore I think the problem is that the reconnect dialog has changed in a recent version of tws:
tws_reconnect

Error running shell script IBGateway

Hello,

I get the following error when running this script

/opt/IBController/IBControllerGatewayStart.sh: line 49: -XX:MaxPermSize=128M: command not found

I think it's due to missing quotes

I would replace
JAVAOPTS=-Xmx512M -XX:MaxPermSize=128M
with
JAVAOPTS='-Xmx512M -XX:MaxPermSize=128M'

Regards,
Nicolas

Read-Only API

Hello,

In the newest version of the Gateway, there is a new option Read-Only API.
As it was unexpectedly checked last time I used the Gateway and as orders wouldn't pass for that reason, I'd like a new property to set this setting.
I think it should be false by default.
Could this be achieved in this task : ConfigureTwsApiPortTask ?

Kind regards,
Nicolas.

Suggestion for better error tracking

First a huge appreciation for your amazing work !

In TwsListener the function
private static void logWindow(Window window,int eventID)
might call Utils.logWindowComponents(window)
if JLabel is "null" even if LogComponents is not set to yes
but that mightnot be a very good idea in fact

OR BETTER

the LogComponents option could be part of the IBController.ini template with some explanation.

In my case, trying to run IBGateway on a headless server, it took me a while understanding why the gateway was hanging until I browsed the code and found this great LogComponents option. Then I could just find out in the log file.

For your information my problem was ๐Ÿ‘ 12:02:31:531 IBController: | | | null(javax.swing.JOptionPane){JOptionPane: Fatal Error: one of the following jar files is missing from the classpath:
rss.jar
Please make sure you run the application from the shortcut that was
installed on your desktop or on the Start menu when you upgraded.

The application will now terminate.}

Under linux it seems that installed java is never used

The user guide states

This means that it is not necessary to ensure that Java is installed on your computer. It doesn't matter if it is already installed, but the IBController scripts won't use it.

However, the help of the IBController.sh says that the installed oracle java may be used:

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

And the part of the script which should find the java installation tests only for java included in TWS (twice).

I think it is not enough to only use the java included in TWS, because the IBGateway download does not include java (at least I didn't find it).

An error of the directory of TWS in windows 10.

Hi๏ผŒ
I downloaded and run ib-controller. I had the following print out. The error is the line of

08:56:24:484 IBController: TWS settings directory is C:\programs\Jts

while my configuration is

C:\IBController>set TWSDIR=C:\Jts\

Thanks

/////////////////////////////////////////////////////////////////////////////
C:\IBController>IBControllerStart.bat

C:\IBController>set TWSUSERID=xxxxx

C:\IBController>set TWSPASSWORD=xxxxx

C:\IBController>set IBCDIR=C:\IBController

C:\IBController>set IBCINI="C:\IBController\IBController.ini"

C:\IBController>set TWSDIR=C:\Jts\

C:\IBController>set TWSCP=jts.jar;total.2015b.jar

C:\IBController>set JAVAOPTS=-Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx1024M -XX:MaxPermSize=256M

C:\IBController>pushd C:\Jts\

C:\Jts>setlocal

C:\Jts>set JAVA_TOOL_OPTIONS=

C:\Jts>C:\programs\Java\jdk1.7.0_79\bin\java.exe -cp jts.jar;total.2015b.jar;C:\IBController\IBController.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx1024M -XX:MaxPermSize=256M ibcontroller.IBController "C:\IBController\IBController.ini" xxxxx xxxxx

System Properties

swing.boldMetal = false
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = C:\programs\Java\jdk1.7.0_79\jre\bin
java.vm.version = 24.79-b02
java.vm.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
path.separator = ;
java.vm.name = Java HotSpot(TM) Client VM
file.encoding.pkg = sun.io
user.country = US
user.script =
sun.java.launcher = SUN_STANDARD
sun.os.patch.level =
java.vm.specification.name = Java Virtual Machine Specification
user.dir = C:\Jts
java.runtime.version = 1.7.0_79-b15
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs = C:\programs\Java\jdk1.7.0_79\jre\lib\endorsed
os.arch = x86
java.io.tmpdir = C:\Users\xyang\AppData\Local\Temp
line.separator =

java.vm.specification.vendor = Oracle Corporation
user.variant =
os.name = Windows 8.1
sun.java2d.noddraw = true
sun.jnu.encoding = GBK
java.library.path = C:\programs\Java\jdk1.7.0_79\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\programs\Java\jdk1.7.0_79\bin;.
java.specification.name = Java Platform API Specification
java.class.version = 51.0
sun.management.compiler = HotSpot Client Compiler
os.version = 6.3
user.home = C:\Users\xyang
user.timezone = America/New_York
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = Cp1252
java.specification.version = 1.7
java.class.path = jts.jar;total.2015b.jar;C:\IBController\IBController.jar
user.name = xyang
java.vm.specification.version = 1.7
sun.java.command = ibcontroller.IBController C:\IBController\IBController.ini xxxxx xxxxx
java.home = C:\programs\Java\jdk1.7.0_79\jre
sun.arch.data.model = 32
user.language = en
java.specification.vendor = Oracle Corporation
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode
java.version = 1.7.0_79
java.ext.dirs = C:\programs\Java\jdk1.7.0_79\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
sun.boot.class.path = C:\programs\Java\jdk1.7.0_79\jre\lib\resources.jar;C:\programs\Java\jdk1.7.0_79\jre\lib\rt.jar;C:\programs\Java\jdk1.7.0_79\jre\lib\sunrsasign.jar;C:\programs\Java\jdk1.7.0_79\jre\lib\jsse.jar;C:\programs\Java\jdk1.7.0_79\jre\lib\jce.jar;C:\programs\Java\jdk1.7.0_79\jre\lib\charsets.jar;C:\programs\Java\jdk1.7.0_79\jre\lib\jfr.jar;C:\programs\Java\jdk1.7.0_79\jre\classes
java.vendor = Oracle Corporation
file.separator =
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
sun.desktop = windows
sun.locale.formatasdefault = true

sun.cpu.isalist = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86

08:56:24:437 IBController: ini file is C:\IBController\IBController.ini
08:56:24:437 IBController: IBControllerServer is started.
08:56:24:453 IBController: IBControllerServer listening on address: zhuji/192.168.1.117 port: 7462
08:56:24:484 IBController: TWS settings directory is C:\programs\Jts
Exception in thread "main" java.lang.NoClassDefFoundError: jclient/LoginFrame
at ibcontroller.IBController.startTws(Unknown Source)
at ibcontroller.IBController.startTwsOrGateway(Unknown Source)
at ibcontroller.IBController.load(Unknown Source)
at ibcontroller.IBController.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: jclient.LoginFrame
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 4 more

A plugin architecture for IBController

As time goes by, IBController is becoming increasingly complex. Up till early 2010 it was two Java source code files, and was rather difficult to follow. Then I refactored it into about 18 separate files, which in my opinion greatly improved the overall structure. Now there are over 40 source code files (and I'm sure some would say it's even more difficult to understand than it was originally!).

Over the years people have suggested quite a few enhancements that I've felt it necessary to refuse. Mostly this is because the enhancement is specific to their needs, or to only a small potential number of users. But anything that gets into the IBController code base essentially becomes my responsibility (as the principal contributor to IBController) to maintain for ever.

However, I recognise that people have valid reasons for wanting these 'niche' enhancements, and it would be nice to be able to provide a way to accommodate them without assuming responsibility for them. Of course they can easily run their own private enhanced version of IBController, and this is even easier now that IBController's source code is hosted on GitHub. But having a private copy makes it much more difficult to share the enhancement with others, should it turn out to be more widely useful.

So I'm considering the possibility of introducing a 'plugin' facility to IBController. This would enable people to develop their own enhancements and configure them into IBController without needing the 'official' IBController source code to be modified in any way (I'm sure you're all familiar with this concept). They would then be free to publicise and promote their plugins in any way they choose (which might include being documented on a Wiki page here in the IBController repository). They would be responsible for the ongoing maintenance and support of their plugins.

I've actually been thinking about this possibility for a number of years, but have never thought it worthwhile to pursue until now. So there's a lot more I could write about how it would work. However I won't bother with that just now: I'd rather just get input as to whether others think this would be a useful idea, or whether the potential benefits would be outweighed by the effort involved in developing a robust, secure, adequately functional mechanism.

Any comments please?

Headless IBControllerGatewayStart

I use IBControllerGatewayStart on Raspberry Pi. I would like to run it without monitor or X11 screen available. I found a good working solution and would like to share this. I also check for running Gateway and if not I start it and log date and time. This for easier logging and crontab setup.

You need to install Xvfb before you can use this extension. Put it in the first lines of
IBControllerGatewayStart.sh

This is to check for running IBGW process

IBGWLOGFILE="/home/trader/IBcontroller/ibgw_process.log"
PID=pidof java

now=$(date +"%y%m%d%H%M")

if [ -n "$PID" ]; then
echo "IBGW is already running"
exit
else
printf "$_now IBGW started \n" >> $IBGWLOGFILE
fi

The command Xvfb opens a virtual frame buffer to output headless X11 output from TWS program

PID2=pidof Xvfb
if [ -n "$PID2" ]; then
kill $PID2
fi

Xvfb :9 -ac -screen 1 640x480x8 &
export DISPLAY=:9

Small mistake in UserGuide.pdf

There seems to be a mistake in the UserGuide.pdf (or, alternately, the behavior of IBController with respect to the default value of the IbDir setting is incorrect on the Windows platform):

For the "IbDir" setting in the IBController.ini file, UserGuide.pdf says "You will need to set this if you are using Unix". However, that's misleading because even if you are using Windows, it seems you still need to set it. I ran into an error about not being able to find "jts.ini". After I set IbDir to "C:\Jts" the error went away. (Note that IbDir was set to nothing in the original IBController.ini file.) Other than that, everything in the UserGuide.pdf seemed to work for me.

From my reading, the UserGuide.pdf seems to imply that as long as the standalone TWS (Trader WorkStation) software is installed in C:\Jts, then you don't need to set IbDir. However, by default, the IbDir setting in IBController.ini is blank, which seems to translate to the root directory "" on Windows, which would probably never be a good place to install the standalone TWS software.

I and at least one other person I know encountered this problem, so I thought it best to report the issue as others are likely to encounter it as well.

Thanks for making this great solution available!

unknown problem

hello
after uppdating java and using the latest and than the stable one i get the whole time the same error..

image

may sombody have the same issue ?

best regards

Recent change to TWS prevents scripted use of API with edemo account

In the latest version (952) IB changed TWS so that it always uses default configuration upon login to the 'edemo' account. Since the default setting for "Enable ActiveX and Socket Clients" is disabled, TWS isn't listening. I use a scripted IBController->TWS environment with the edemo account in my regression tests. To get this working with the latest TWS release, I've forked and patched to support auto-config of API settings when running with the edemo account. @rlktradewright, would you consider a pull request with these changes? (They are all controlled by INI file settings which default to disabled.)

From the patched IBController.ini:

# ForceTwsApiEnable may be set to 'enable' 'disable' or 'manual' 
# to configure the "Enable ActiveX and Socket API Clients" setting
# 'enable' - set the "ActiveX and Socket Client" checkbox
# 'disable' - clear the "ActiveX and Socket Client" checkbox
# 'manual' (the default) - don't modify; use the TWS saved setting

#ForceTwsApiEnable=enable


# ForceTwsApiReadOnly may be set to 'enable' 'disable' or 'manual' 
# to configure the "Read-Only API" setting
# 'enable' - set the "Read-Only API" checkbox
# 'disable' - clear the "Read-Only API" checkbox
# 'manual' (the default) - don't modify; use the TWS saved setting

#ForceTwsApiReadOnly=disable


# ForceTwsApiBypassPrecautions may be set to 'enable' 'disable' or 'manual' 
# to configure the "Bypass Order Precautions for API Orders" setting
# 'enable' - set the checkbox
# 'disable' - clear the checkbox
# 'manual' (the default) - don't modify; use the TWS saved setting

#ForceTwsApiBypassPrecautions=disable

# DemoApiEnable may be set to 'enable' to configure API connections
# using the edemo/demouser account.
# Recent versions of TWS initialize to default configuration 
# settings upon login to the demo account.  To allow use of the
# API with the edemo account for automated or scripted testing,
# this setting may be set to 'enable'
# If the setting is anything else or not set, the default is no action.
# 'enable' - autoconfigure edemo API 
# anything else: no actions

#DemoApiEnable=enable

java.lang.IllegalStateException in TwsListener.java

I'm running ibcontroller.IBGatewayController on Java 1.7.0_76. it throws this exception . Comments on getMainWindow read "Calling this method from the Swing event dispatch thread results in an IllegalStateException being thrown." How do i avoid this exception. Appreciate your help!!

03:56:35:238 IBController: Found Gateway main window
03:56:35:240 AWT-EventQueue-0: Error
java.lang.IllegalStateException
at ibcontroller.TwsListener.getMainWindow(TwsListener.java:216)
at ibcontroller.TwsListener.getMainWindow(TwsListener.java:260)
at ibcontroller.GatewayMainWindowFrameHandler.handleWindow(GatewayMainWindowFrameHandler.java:38)
at ibcontroller.TwsListener.eventDispatched(TwsListener.java:81)
at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2444)
at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2335)
at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2335)
at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2335)
at java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2294)
at java.awt.Component.dispatchEventImpl(Component.java:4768)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:740)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:699)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:713)
at java.awt.EventQueue$4.run(EventQueue.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:710)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

IBController: 2 arguments passed, but args[0] is not 'encrypt'. quitting...

Hi all,

Thank you for putting in the time to create this tool. It looks exceptional. First, I already read issue #16, and have done everything that you advised to do there, to no avail. I am running windows 8.1 on a 64-bit Intel based Mac via bootcamp. I installed the entire operating system today, and have done nothing besides install Java, TWS, Python, IBController, Dropbox and Chrome on the machine. I've installed everything to their default directories. I have not attempted to modify any of the files to include my username / password, I am simply trying to get the edemo/demouser login to work. I have tried running IBControllerStart.bat by double clicking and also running in the command prompt.

First, I will copy/paste the .bat file I am running. Second, I will copy/paste the .ini file. Third, I will copy/paste the feedback given. Here's the .bat file:

:: If your TWS user id and password are not included in the IBController
:: configuration file, set them here (do not encrypt the password):

set TWSUSERID=
set TWSPASSWORD=

:: The folder containing the IBController files:

set IBCDIR=C:\IBController

:: The location and filename of the IBController configuration file. This file should
:: be in a folder in your personal filestore, so that other users of your computer can't
:: access it. This folder and its contents should also be encrypted so that even users
:: with administrator privileges can't see the contents. Note that you can use the HOMEPATH
:: environment variable to address the root of your personal filestore (HOMEPATH is set
:: automatically by Windows):

set IBCINI=%HOMEPATH%\Documents\IBController\IBController.ini

:: The folder where TWS is installed:

set TWSDIR=C:\Jts\

:: The classpath for TWS. The value below is correct for version
:: 942 (you can verify which version of TWS you are using by going
:: to the Help | About Trader Workstation menu in TWS).
::
:: For other versions of TWS, the information needed may change.
:: You can find the required information in the shortcut created when you
:: installed TWS.
::
:: To locate this in Windows 7, right click on the start menu entry for
:: TWS and click Properties. In Windows 8, locate the tile for TWS in
:: the start screen, right click it, and select 'Open file location' on the menu
:: bar at the bottom of the screen.
::
:: In the field labelled 'Target', select everything after "-cp " up to the
:: first subsequent space character, then press Ctrl-C to copy it to the
:: clipboard, then paste it into the following command, replacing everything
:: after the "=" character:

set TWSCP=jts.jar;total.2012.jar

:: Other Java VM options for TWS. You can find this information in the
:: shortcut created when you installed TWS. (Note that in the shortcut,
:: jclient/LoginFrame is NOT part of the Java options, nor is anything
:: that comes after it, so don't include that here):

set JAVAOPTS=-Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx1024M -XX:MaxPermSize=256M

pushd %TWSDIR%
java.exe -cp %TWSCP%;%IBCDIR%\IBController.jar %JAVAOPTS% ibcontroller.IBController %IBCINI% %TWSUSERID% %TWSPASSWORD%
popd

Here is the .ini file

Note that in the comments in this file, TWS refers to either the Trader

Workstation or the Gateway for the IB API.

IBController may also be used to start the FIX CTCI Gateway. All settings

relating to this have names prefixed with FIX.

The IB API Gateway and the FIX CTCI Gateway share the same code. Which

gateway actually runs is governed by an option on the initial gateway

login screen. The FIX setting described under IBController Startup

Settings below controls this.

#1. IBController Startup Settings

----------------------------------

IBController logs information during operating that can be useful when

diagnosing problems. If set to 'yes', all logging output from

IBController is to the console and may be directed into a file using

the standard > or >> command line redirection operators. If set to 'no',

output from IBController that is logged after it has loaded TWS appears

in the TWS logfile: this helps to correlate IBController log entries with

TWS activity. The default is 'no'.

LogToConsole=no

IBController may be used to start the IB Gateway for the FIX CTCI. This

setting must be set to yes if the FIX CTCI gateway is to be run. The default

is no.

FIX=no
#2. Authentication Settings

----------------------------

TWS and the IB API gateway require a single username and password

For them, you can specify the username and password as the second and

third arguments in the command to start IBController. Alternatively

you may specify the username and password using the following settings:

IbLoginId

IbPassword

If you don't specify them, you will be prompted for them in the usual

login dialog when TWS starts (but whatever you have specified will be

included in the dialog automatically: for example you may specify the

username but not the password, and then you will be prompted for the

password via the login dialog).

The FIX CTCI gateway requires one username and password for FIX order

routing, and optionally a separate username and password for market

data connections. You can specify the FIX username and password as the

second and third arguments in the command to start IBController. You

can specify the market data username and password as the fourth and

fifth arguments in the command to start IBController. Alternatively

you may specify the usernames and passwords using the following settings:

FIXLoginId

FIXPassword

IbLoginId (optional)

IbPassword (optional)

If you don't specify them, you will be prompted for them in the usual

login dialog when FIX CTCI gateway starts (but whatever you have

specified will be included in the dialog automatically: for example

you may specify the usernames but not the passwords, and then you will

be prompted for the password via the login dialog).

Passwords may be specified in an 'encrypted' form. This makes

it tricky (but by no means impossible) for someone looking at this

file to know what your password is. Use these settings to indicate

whether the password(s) are encrypted:

PasswordEncrypted

FIXPasswordEncrypted

If you want to use the encrypted form, set the relevant setting to 'yes',

otherwise set it to 'no'. If you omit this setting, 'yes' is assumed.

To get the encrypted form, edit the IBControllerEncrypt.bat file

and replace "aaaaa" with your password; then run

IBControllerEncrypt.bat to display the encrypted version of

your password.

IB API Settings

---------------

Your TWS username:

IbLoginId=edemo

Your TWS password (encrypted if appropriate):

IbPassword=demouser
PasswordEncrypted=no

FIX CTCI Settings

-----------------

Your FIX CTCI username:

FIXLoginId=

Your FIX CTCI password (encrypted if appropriate):

FIXPassword=
FIXPasswordEncrypted=yes
#3. TWS Startup Settings

-------------------------

Path to the directory where TWS should store its settings. This is

normally the folder in which TWS is installed. However you may set

it to some other location if you wish (for example if you want to

run multiple instances of TWS with different settings).

It is recommended for clarity that you use an absolute path. The

effect of using a relative path is undefined.

Linux and OS X users should use the appropriate path syntax.

Note that, for Windows users, you MUST use double separator

characters to separate the elements of the folder path: for

example, IbDir=C:\IBLiveSettings is valid, but

IbDir=C:\IBLiveSettings is NOT valid and will give unexpected

results. Linux and OS X users need not use double separators,

but they are acceptable.

The default is the current working directory when IBController is

started.

IbDir=

If you wish to store your TWS settings on IB's servers rather

than locally on your computer, set this to 'yes'

StoreSettingsOnServer=no

Set to 'yes' to minimise TWS when it starts:

MinimizeMainWindow=no

When TWS logs on it checks to see whether the account is already

logged in at another computer. If so it displays a dialog: this

setting instructs TWS how to proceed. If set to 'primary', TWS

ends the existing session and continues with the new session. If

set to 'secondary', TWS exits so that the existing session is

unaffected. If set to 'manual', the user must handle the dialog.

Note that when set to 'primary', if another TWS session is

started and manually told to end the primary session, the primary

session is automaticallyreconnected. Also note that if two

primary sessions are started, they will both keep reconnecting

and disconnecting the other: therefore care needs to be exercised

in the use of this setting. The default is 'manual'.

ExistingSessionDetectedAction=manual

If set to 'accept', IBController automatically accepts incoming

API connection dialogs. If set to 'reject', IBController

automatically rejects incoming API connection dialogs. If

set to 'manual', the user must decide whether to accept or reject

incoming API connection dialogs. The default is 'accept'.

NB: it is recommended to set this to 'reject', and to explicitly

configure which IP addresses can connect to the API in TWS's API

configuration page, as this is much more secure (in this case, no

incoming API connection dialogs will occur for those IP addresses).

AcceptIncomingConnectionAction=accept

If this is set to yes, IBController causes TWS to display the

Trades log at startup, and sets the 'All' checkbox to ensure that

the API reports all executions that have occurred during the past

week. Moreover, any attempt by the user to change any of the

'Show trades' checkboxes is ignored; similarly if the user closes

the Trades log, it is immediately re-displayed with the 'All'

checkbox set. If set to 'no', IBController does not interact with

the Trades log, and only the current session's executions are

returned via the API (unless the user changes the Trades log

checkboxes). The default is no.

ShowAllTrades=no

If ForceTwsApiPort is set to an integer, it forces IBController to

change the TWS API Socket Port to that number shown shortly after

startup. This setting is most commonly required if you are running

multiple IBController instances for different accounts and would

like different ports to be configured automatically (ie without you

needing do this manually in the TWS window that IBController would

open). Leaving the setting blank will make no change, so 4001 or

#7496 would be the usual default (or whatever you manually change

the port number to).

ForceTwsApiPort=
#4. TWS Auto-Closedown

-----------------------

Set to yes or no (lower case):

yes means allow TWS to shut down automatically at its

specified shutdown time, which is set via the TWS

configuration menu.

no means TWS never shuts down automatically.

NB: IB recommends that you do not keep TWS running

continuously. If you set this setting to 'no', you may

experience incorrect TWS operation.

IbAutoClosedown=yes
#5. TWS Tidy Closedown Time

----------------------------

To tell IBController to tidily close TWS at a

specified day of the week and time, set this value

to

for example:

ClosedownAt=Friday 22:00

Note that the day of the week must be specified using your

default locale. Also note that Java will only accept

characters encoded to ISO 8859-1 (Latin-1). This means that

if the day name in your default locale uses any non-Latin-1

characters you need to encode them using Unicode escapes

(see http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

for details). For example, to tidily close TWS at 12:00 on

Saturday where the default locale is Simplified Chinese,

use the following:

#ClosedownAt=\u661F\u671F\u516D 12:00

ClosedownAt=
#6. Other TWS Settings

-----------------------

If you attempt to place an order for a contract for which

you have no market data subscription, TWS displays a dialog

to warn you against such blind trading.

yes means the dialog is dismissed as though the user had

clicked the 'Ok' button: this means that you accept

the risk and want the order to be submitted.

no means the dialog remains on display and must be

handled by the user.

AllowBlindTrading=no

Indian versions of TWS may display a password expiry

notification dialog and a NSE Compliance dialog. These can be

dismissed by setting the following to yes. By default the

password expiry notice is not dismissed, but the NSE Compliance

notice is dismissed.

Warning: setting DismissPasswordExpiryWarning=yes will mean

you will not be notified when your password is about to expire.

You must then take other measures to ensure that your password

is changed within the expiry period, otherwise IBController will

not be able to login successfully.

DismissPasswordExpiryWarning=no
DismissNSEComplianceNotice=yes

Since TWS 906, orders placed using the BookTrader have to be confirmed

via a dialog box (this was due to a legal dispute between IB and Trading

Technologies who claimed IB were infringing a patent). If

AutoConfirmOrders=yes, then when orders are placed using the BookTrader,

the confirmation dialog is automatically handled, thereby effectively

restoring the one-click trading. The default is 'no', requiring the user

to manually confirm each trade.

NB: this setting has been removed as the dispute has been resolved and

TWS users now have the option to request the order confirmation dialog

to not be displayed.

AutoConfirmOrders=no

#6. IBController Server Settings

---------------------------------

Do NOT CHANGE THE FOLLOWING SETTINGS unless you

intend to issue commands to IBController (for example

using telnet). Note that these settings have nothing to

do with running programs that use the TWS API.

The port that IBController listens on for commands

such as "STOP". DO NOT set this to the port number

used for TWS API connections. There is no good reason

to change this setting unless the port is used by

some other application.

IbControllerPort=7462

A comma separated list of ip addresses, or host names,

which are allowed addresses for sending commands to

IBController. Commands can always be sent from the

same host as IBController is running on.

IbControlFrom=

Specifies the IP address on which the IBController Server

is to listen. For a multi-homed host, this can be used

to specify that connection requests are only to be

accepted on the specified address. The default is to

accept connection requests on all local addresses.

IbBindAddress=

The specified string is output by the server when

the connection is first opened and after the completion

of each command. This can be useful if sending commands

using an interactive program such as telnet. The default

is that no prompt is output.

For example:

CommandPrompt=>

CommandPrompt=

Some commands can return intermediate information about

their progress. This setting controls whether such

information is sent. The default is that such information

is not sent.

SuppressInfoMessages=yes

And here is what the system returns:

Microsoft Windows Version 6.3.9600 2013 Microsoft Corporation. All rights reserved.

C:\Users\Jacob Fishman>cd C:\IBController

C:\IBController>IBControllerStart.bat

C:\IBController>set TWSUSERID=

C:\IBController>set TWSPASSWORD=

C:\IBController>set IBCDIR=C:\IBController

C:\IBController>set IBCINI=\Users\Jacob Fishman\Documents\IBController\IBControl
ler.ini

C:\IBController>set TWSDIR=C:\Jts\

C:\IBController>set TWSCP=jts.jar;total.2012.jar

C:\IBController>set JAVAOPTS=-Dsun.java2d.noddraw=true -Dswing.boldMetal=false -
Dsun.locale.formatasdefault=true -Xmx1024M -XX:MaxPermSize=256M

C:\IBController>pushd C:\Jts\

C:\Jts>java.exe -cp jts.jar;total.2012.jar;C:\IBController\IBController.jar -Ds
un.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true
-Xmx1024M -XX:MaxPermSize=256M ibcontroller.IBController \Users\Jacob Fishman\D
ocuments\IBController\IBController.ini
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=256M; support wa
s removed in 8.0

System Properties

swing.boldMetal = false
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = C:\Program Files (x86)\Java\jre1.8.0_45\bin
java.vm.version = 25.45-b02
java.vm.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
path.separator = ;
java.vm.name = Java HotSpot(TM) Client VM
file.encoding.pkg = sun.io
user.country = US
user.script =
sun.java.launcher = SUN_STANDARD
sun.os.patch.level =
java.vm.specification.name = Java Virtual Machine Specification
user.dir = C:\Jts
java.runtime.version = 1.8.0_45-b15
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs = C:\Program Files (x86)\Java\jre1.8.0_45\lib\endorsed
os.arch = x86
java.io.tmpdir = C:\Users\JACOBF~1\AppData\Local\Temp
line.separator =

java.vm.specification.vendor = Oracle Corporation
user.variant =
os.name = Windows 8.1
sun.java2d.noddraw = true
sun.jnu.encoding = Cp1252
java.library.path = C:\ProgramData\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;
C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\sy
stem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell
\v1.0;C:\Anaconda;C:\Anaconda\Scripts;.
java.specification.name = Java Platform API Specification
java.class.version = 52.0
sun.management.compiler = HotSpot Client Compiler
os.version = 6.3
user.home = C:\Users\Jacob Fishman
user.timezone = America/Los_Angeles
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = Cp1252
java.specification.version = 1.8
java.class.path = jts.jar;total.2012.jar;C:\IBController\IBController.jar
user.name = Jacob Fishman
java.vm.specification.version = 1.8
sun.java.command = ibcontroller.IBController \Users\Jacob Fishman\Documents\IBCo
ntroller\IBController.ini
java.home = C:\Program Files (x86)\Java\jre1.8.0_45
sun.arch.data.model = 32
user.language = en
java.specification.vendor = Oracle Corporation
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode
java.version = 1.8.0_45
java.ext.dirs = C:\Program Files (x86)\Java\jre1.8.0_45\lib\ext;C:\Windows\Sun\J
ava\lib\ext
sun.boot.class.path = C:\Program Files (x86)\Java\jre1.8.0_45\lib\resources.jar;
C:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar;C:\Program Files (x86)\Java\j
re1.8.0_45\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jre1.8.0_45\lib\jsse.j
ar;C:\Program Files (x86)\Java\jre1.8.0_45\lib\jce.jar;C:\Program Files (x86)\Ja
va\jre1.8.0_45\lib\charsets.jar;C:\Program Files (x86)\Java\jre1.8.0_45\lib\jfr.
jar;C:\Program Files (x86)\Java\jre1.8.0_45\classes
java.vendor = Oracle Corporation
sun.stderr.encoding = cp437
file.separator =
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
sun.stdout.encoding = cp437
sun.desktop = windows
sun.locale.formatasdefault = true

sun.cpu.isalist = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86

IBController: 2 arguments passed, but args[0] is not 'encrypt'. quitting...

C:\Jts>popd
C:\IBController>

Please let me know if there is any additional info I can provide you with. Thanks for taking the time to look at this.

Security code card authentication

Do you know how to handle Security code card authentication?

Jun 24 19:36:17 me xvfb-run[625]: 19:36:17:654 IBController: detected dialog entitled: Security Code Card Authentication; event=Opened
Jun 24 19:36:17 me xvfb-run[625]: 19:36:17:730 IBController: detected dialog entitled: Security Code Card Authentication; event=Activated

ExistingSesionDetection problems

I have a problem with ExistingSesionDetection=secondary I used it with the idea that when I would like to login TWS main program that it stops automatic the script and when I am ready I could start every hour a crontab and connect when it is needed. This unfortunately does not work for me?? Maybe I need to set something in Windows 8.1 TWS configuration??

IBController not preventing autologoff on 952.1a

running english TWS 952.1a via IBController 2.14 on a XP virtual machine.
I set the autologoff time 30 sec ahead and TWS happily logoff without messages...
this is the log:

ialTokenType=SOFT authenticationType=FARM_AUTH identityHashcode=4749666
06:53:45:630 JTS-cashfarmDispatcherS6-101: NS_AUTH_START version=7 pwd=0 soft=2 token=0 tokenSubtype=0 init
ialTokenType=SOFT authenticationType=FARM_AUTH identityHashcode=29968752
06:53:51:989 JTS-usfarmDispatcherS7-110: NS_AUTH_START version=7 pwd=0 soft=2 token=0 tokenSubtype=0 initia
lTokenType=SOFT authenticationType=FARM_AUTH identityHashcode=15176952
06:53:51:999 JTS-ushmdsDispatcherS8-114: NS_AUTH_START version=7 pwd=0 soft=2 token=0 tokenSubtype=0 initia
lTokenType=SOFT authenticationType=FARM_AUTH identityHashcode=28743942
06:55:45:382 AWT-EventQueue-0: Trader Workstation
Copyright ? 2000 LICENSOR to Interactive Brokers<
br>ALL RIGHTS RESERVED

Build 952.1a, Aug 18, 2015 3:38:07 PM
Jolt Build 1.3.0, Jul 31, 2015 04:11:
05 PM
Nia Build 2.4.3, Aug 7, 2015 02:26:49 PM
ModelNav Build 1.4.3, Jul 28, 2015 02:33:29 PM
Riskf
eed Build 2.7.1, Aug 10, 2015 09:11:37 AM

Java Version: 1.8.0_60, OS: Windows XP (x86, 5.1), Memory:
heap
max 989Mb, current 138Mb

This software is covered by U.S. Patent No. 7.827.092.

This
software uses JFreeChart class library from
Object Refinery Limited under the terms of the GNU
Lesser
General Public Licence, which can be found here:
http://www.object-refinery.com/lgpl.html.

This pr
oduct includes software developed by the JDOM
(http://www.jdom.org/) and ROME (http://rome.dev.java.net)<
br>projects.

This software includes software developed by Hypersonic
SQL Group under its licence w
hich can be found here
http://hsqldb.org/web/hsqlLicense.html.

This product includes unmodified so
ftware developed by
Pentaho Corporation (Mondrian 3.9.0.0-213) under its license
that can be found at
http://www.pentaho.com/license.

This product uses the "Secure Remote Password" cryptographic
authe
ntication system developed by Tom Wu ([email protected]).

This software includes unmodified Apache
HttpComponents class library from
Apache Software Foundation under the terms of Apache License,
which
can be found here: http://www.apache.org/licenses/LICENSE-2.0

This software includes unmodified Apach
e Commons Logging class library from
Apache Software Foundation under the terms of Apache License,
whi
ch can be found here: http://www.apache.org/licenses/LICENSE-2.0

This software uses JSON reference im
plementation under JSON license,
which can be found at http://www.json.org/license.html

Interactive Brokers Home Page
06:56:07:114 JTS-CommonScheduler-57: Disconnecting usfarm.us when checking activity
06:56:22:596 JTS-ActivityBus-27: Terminating async queue thread
06:56:22:596 JTS-RecordNotifier-30: Terminating async queue thread
06:56:22:596 JTS-AsyncNonLocked-26: Terminating async queue thread
06:56:22:646 JTS-Async-25: Terminating async queue thread
06:56:23:077 JTS-EServerSocket-61: [99:51:76:1:0:0:0:ERR] Socket connection for client{99} has closed.
06:56:23:097 JTS-EServerSocket-72: [23140:45:76:1:0:0:0:ERR] Socket connection for client{23140} has closed.

06:56:23:097 JTS-EServerSocketNotifier-73: Terminating async queue thread
06:56:23:097 JTS-EServerSocketNotifier-62: Terminating async queue thread
06:56:24:152 JTS-onReceiveUploadSignature-141: S3: Starting tws.wlist settings upload
06:56:24:362 JTS-onReceiveUploadSignature-141: S3: Uploaded settings : 300 1049
06:56:28:868 JTS-onReceiveUploadSignature-145: S3: Starting tws.xml settings upload
06:56:30:330 JTS-ShutdownTask-Uploading_Settings-144: Waiting upload timeout failed
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at jclient.login.u.j(u.java:614)
at jclient.login.kb.b(kb.java:511)
at jclient.login.jb.run(jb.java:174)
at java.lang.Thread.run(Unknown Source)
06:56:31:192 JTS-ExecNotifier-32: Terminating async queue thread
06:56:31:272 JTS-Order-Audit-17: Terminating async queue thread

C:\Jts>popd

IBController - login from real money account

From IBController.ini:

" # If ReadOnlyLogin is set to 'yes', and the user is enrolled in IB's

account security programme, the user will not be asked to supply

the security code, and login to TWS will occur automatically in

read-only mode: in this mode, placing or managing orders is not

allowed. If set to 'no', and the user is enrolled in IB's account

security programme, the user must supply the relevant security

code to complete the login. If the user is not enrolled in IB's

account security programme, this setting is ignored. The default

is 'no'.

ReadOnlyLogin=no"

I have IBController working on demo account, but as I read this it will not be possible to use Windows Scheduler to automatically open TWS and trade (via an API connection between TradingBlox and Interactive Brokers) on a real money account.

If ReadOnlyLogin is set to yes and user is enrolled in IB's account security programme (I am, don't think there was a choice) you are logged into read-only mode. If ReadOnlyLogin is set to no, I would have to manually enter the 2 codes corresponding to the different number sets displayed each time I log in.

Hopefully I have misunderstood this or there is a workaround.

Hope this is the right place to post this.

Thanks very much,

Bob

Does it work on version 954.2q

I could not locate the jts.jar and total.jar in my 954.2q installation of tws
wonder if IB have some big change on its jar file which prevent ibcontroller to start?

Change IBController licence?

I've been toying with the idea of changing the IBController licence from GPL v3 to something more permissive, such as the MIT licence (http://opensource.org/licenses/MIT).

To be frank, I've never been comfortable with the philosophy behind GPL (I understand the Stallman point of view, but I don't agree with it at all).

And the fact is, I'm certainly not in a position to enforce the licence: for all I know there may be any number of people out there who are using the IBController code in ways that infringe the GPL. I don't know, and I don't really care. So I see no reason not to open it up with a licence that essentially lets anyone do anything with the code, provided the copyright statements are preserved.

Does anyone have any particular view on this?

Not working with TWS version 949.3d (latest)?

Hi,

I managed to make the controller work until I get this window :

Error

It looks like the error is because of a newer version of TWS than the one supported..?

Thanks for your great contribution

Request: Telnet Command that confirms that TWS/Gateway has started

I am automating my trading process and came across IBController. It is a very helpful tool!

After I execute the BATCH file I would like to know whether the TWS/Gateway has loaded/started or not.

It would be great to have a Telnet command that gives you the information whether the TWS/Gateway has started.

Example:
Telnet command: ISTWSUP
Reply: TRUE/FALSE, OK/NOK, YES/NO

Would it be possible to implement something like this? Is there maybe another way to determine the current execution state?

Many thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.