开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: IBC version 3.15.0

 

i tried installing to the standard location as a test (really dont want it here). and it does not work either.

i know the error msg says it is an offline version but thats not true:? i downloaded it from?

https://download2.interactivebrokers.com/installers/ibgateway/stable-standalone/ibgateway-stable-standalone-linux-x64.sh


Re: IBC version 3.15.0

 

1. i prefer not to have Jts in the root, and i cannot put it in home as there is limited size in the drive associated with home rather than the one mounted. is there absolutely no way to have it in /mnt/efs/ibgateway/ something?
2. yes i understand tWS and ibgateway is the same under the hood, however, ibgateway is smaller to run and takes up less system resources when it is running.?


Re: IBC version 3.15.0

 

开云体育

Oops, sorry, I told you the wrong thing. It should be:

?

TWS_PATH=/mnt/efs/Jts/

?

But it also looks like you’ve installed Gateway into a non-standard location. These ‘missing’ files should be in

?

/mnt/efs/Jts/ibgateway/1021

?

This is where they will be if you install Gateway to the default location offered by the installer. The scripts depend on Gateway being installed to that default. There is no good reason to put it anywhere else.

?

So I suggest you uninstall Gateway and reinstall to the default.

?

By the way, you don’t need to install both TWS and Gateway: both installers put the same files on the system, apart from the desktop link (which IBC doesn’t use).? They install to different locations, but the IBC scripts know about this and will find whichever one is there. The User Guide does actually tell you this.


Re: IBC version 3.15.0

 

sorry heres the attachment. the error logs has the same missing options file.. although it is now in there as you can see:

[ec2-user@ip-172-31-35-164 chartsbacktest_D_20230202_zip]$ cd /mnt/efs/ibgateway/Jts/1021
[ec2-user@ip-172-31-35-164 1021]$ ls -l
total 48
drwxr-xr-x 2 ec2-user ec2-user? 6144 Feb 20 03:48 data
-rwxr-xr-x 1 ec2-user ec2-user 15008 Feb 15 04:25 ibgateway
lrwxrwxrwx 1 ec2-user ec2-user? ? 45 Feb 20 03:48 IB Gateway 10.21.desktop -> .install4j/install4j_je7c71-ibgateway.desktop
-rw-r--r-- 1 ec2-user ec2-user? ?895 Feb 20 03:51 ibgateway.vmoptions
drwxr-xr-x 2 ec2-user ec2-user? 6144 Feb 20 03:51 jars
-rwx------ 1 ec2-user ec2-user 14321 Feb 15 04:25 uninstall


Re: IBC version 3.15.0

 

unfortunately doenst seem to work. see attached.


Re: IBC version 3.15.0

 

开云体育

This line in gatewaystart_7496.sh is incorrect:

?

TWS_PATH=/mnt/efs/ibgateway/Jts/ibgateway

?

It should be:

?

TWS_PATH=/mnt/efs/ibgateway/Jts/

?

?

?

From: [email protected] <[email protected]> On Behalf Of gong@...
Sent: 19 February 2023 16:32
To: [email protected]
Subject: Re: [ibc] IBC version 3.15.0

?

hi i run TWS using ibc315 and it works fine. however, when i try ibgateway, it isnt working. both tws and ibgateway are installed on the shared network drive rather in the home folder. the msg is that?Error: Neither tws.vmoptions nor ibgateway.vmoptions could be found but they are certainly found in the drive.?


Re: IBC version 3.15.0

 

hi i run TWS using ibc315 and it works fine. however, when i try ibgateway, it isnt working. both tws and ibgateway are installed on the shared network drive rather in the home folder. the msg is that?Error: Neither tws.vmoptions nor ibgateway.vmoptions could be found but they are certainly found in the drive.?


Re: IBC Version 3.16.0

 

Hi Richard,

The issue is resolved now. There were older restart folders under ~/Jts existed. After removing them, i did fresh login, it created new folder within ~/Jts and then restart worked as expected.?

Thank you!


Re: "IBC closing because login has not completed after Second Factor Authentication"

 

开云体育

I did notice that you said you’d changed the value to 100s, and that it didn’t help. Let me explain a bit more about this setting.

?

The reason the setting is there at all is that on rare occasions, TWS doesn’t start up properly after 2FA. Without this mechanism, IBC would just sit there forever waiting for TWS, and if the user was remote with no access to the computer running TWS, there would be nothing they could do to get things going again. Moreover, they would be unaware that anything was wrong, because they had actually successfully completed the 2FA. So this mechanism enables IBC to be automatically restarted in these circumstances.

?

(By the way, I’ve no idea whether this failure to start still happens, but it certainly did at the time I introduced the setting.)

?

It’s also the case that the time taken to start TWS can sometimes be much longer than usual, but it does actually still start eventually if left long enough. Presumably this is due to some condition in the IB servers, and this is what I’ve been experiencing recently. But in the past it has not been common for this condition to persist for long periods. So there’s a trade-off between making the setting very large (say 5 minutes) which should capture the cases where it really isn’t going to start, and making it fairly short so that a retry happens reasonably quickly. The current default of 40 seconds has been a reasonable compromise so far, but maybe something has changed permanently at IB’s end and it’ll need to be raised.

?

So having set my value to 100 secs, I’ll be watching carefully to see how long it’s actually taking in future. This is easy to see in the logfile. Here’s an extract from a successful login last night, after I had upped the setting to 100s:

?

2023-02-13 23:05:23:702 IBC: Click button: Log In

2023-02-13 23:05:24:042 IBC: Button now disabled: Log In

2023-02-13 23:05:34:320 IBC: Detected dialog entitled: Second Factor Authentication; event=Closed

2023-02-13 23:05:34:333 IBC: Duration since login: 10 seconds

2023-02-13 23:05:34:334 IBC: If login has not completed, IBC will exit in 100 seconds

LogModuleConfigurator-Init: Log4j Ver2.x found on classpath

LogModuleConfigurator-Init: LogModuleConfigurator initialized with Log4j Verd.x

2023-02-13 23:06:22:010 IBC: Detected frame entitled: Login; event=Lost focus

2023-02-13 23:06:22:011 IBC: Detected frame entitled: Login; event=Deactivated

2023-02-13 23:06:22:203 IBC: Detected frame entitled: U95482 Interactive Brokers; event=Activated

2023-02-13 23:06:22:222 IBC: Detected frame entitled: U95482 Interactive Brokers; event=Focused

2023-02-13 23:06:22:222 IBC: Detected frame entitled: U95482 Interactive Brokers; event=Opened

2023-02-13 23:06:22:223 IBC: Found TWS main window

2023-02-13 23:06:22:223 IBC: Login has completed

?

IBC detected that the Second Factor Authentication dialog was closed (by TWS) at 23:05:34:320 – this is just after the acknowledgement of the alert on the phone. At 23:05:34:334, IBC starts its wait for the main window to appear, and as the message says, it wants this to happen within 100 seconds.

?

The main window (with the title “U95482 Interactive Brokers”) actually notified its ‘Opened’ event at 23:06:22:222 and IBC recognised this as meaning that login had completed. So in this case it took about 46 seconds from the time of 2FA acknowledgement to the main window being opened. Had I not changed the setting value from the default of 40 secs, this attempt would have failed.

?

I suspect that in your case, the IB server was in one of those conditions that causes the long delay, so if the setting was high enough TWS would eventually have loaded. Or it might have been a ‘never going to happen’ case. The only certain thing is that TWS hadn’t loaded the main window within 40 seconds.

?

Richard


Re: IBC Version 3.16.0

 

开云体育

I’m not entirely clear what you’re asking.

?

Please can you clarify. Also attach a sample IBC logfile so I can see what settings you’re using.

?

IBC works exactly the same on Linux as on Windows. You can use cron to provide a backstop restart capability to protect against certain types of failure: but the daily auto-restart governed by the AutoRestartTime setting in config.ini doesn’t need anything additional. For usage of cron with IBC, see the section on ‘Running with crontab (Linux only)’ towards the back of the User Guide.

?

I won’t be responding further tonight as it’s getting late here in the UK, but will follow up tomorrow if need be.

?

?

From: [email protected] <[email protected]> On Behalf Of nkhetia@...
Sent: 13 February 2023 23:31
To: [email protected]
Subject: Re: [ibc] IBC Version 3.16.0

?

Thanks Richard for this awesome tool.?

I've been using latest version for more last few weeks now but i couldn't see any automated restart of TWS session after scheduled restart in TWS every day.? Probably coz i am on Ubuntu. i just want to clarify what kind of cron i need to setup on that ubuntu host. would it be just a shell script to keep checking tws process or something more than that??

Thank you again.?


Re: "IBC closing because login has not completed after Second Factor Authentication"

 

Thanks Richard for your reply! I couldnt find the log file anymore since I re-ran the bat and it overwrote it.

Using IBC 3.16 and TWS 10.21. I actually did change it from 40-100seconds as stated in original post but it still killed it off at the 100th second. Will re-test again with a higher value and/or when it happens again I'll send the log file, thank you!


Re: IBC Version 3.16.0

 

Thanks Richard for this awesome tool.?

I've been using latest version for more last few weeks now but i couldn't see any automated restart of TWS session after scheduled restart in TWS every day.? Probably coz i am on Ubuntu. i just want to clarify what kind of cron i need to setup on that ubuntu host. would it be just a shell script to keep checking tws process or something more than that??

Thank you again.?


Re: "IBC closing because login has not completed after Second Factor Authentication"

 

开云体育

Ok, this is just a result of TWS taking a long time to display the main form after a 2FA login.

?

The way to avoid this is to set SecondFactorAuthenticationExitInterval in config.ini to a larger value. The default value for this is 40 seconds. IBC expects TWS’s main form to be loaded before this time has expired after IBC has detected the 2FA completion. But for whatever reason, TWS seems to be taking longer than this to load on my computer so far this week. So I set mine to:

?

SecondFactorAuthenticationExitInterval=100

?

and then it worked fine.

?

(By the way, don’t confuse this setting with SecondFactorAuthenticationTimeout, which has a completely different function and should not be changed.)


Re: "IBC closing because login has not completed after Second Factor Authentication"

 

开云体育

I experienced the same issue last night.

?

I’ll try to investigate this later today.

?

By the way, for future reference, it’s always helpful to give as much information as possible. For example, you don’t say which version of IBC and TWS you’re using.

?

The easiest way to do this is to attach the IBC logfile, which contains a ton of information that can save me hours in diagnosing issues. That’s why the file exists!

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of alvinneo.w@...
Sent: 13 February 2023 07:59
To: [email protected]
Subject: [ibc] "IBC closing because login has not completed after Second Factor Authentication"

?

Ive manually checked and realised even after logging in successfully with 2FA mobile, the app/tws closes after 40 seconds. I've also set the timeout to be 100s and still no differences, kills both at 100s, what could be the reason?
The TWS is operational and live 100%.?


"IBC closing because login has not completed after Second Factor Authentication"

 

Ive manually checked and realised even after logging in successfully with 2FA mobile, the app/tws closes after 40 seconds. I've also set the timeout to be 100s and still no differences, kills both at 100s, what could be the reason?
The TWS is operational and live 100%.?


Re: IBC Version 3.16.0

 

开云体育

Fair enough, thanks!


On 1 Feb 2023, at 23:15, Richard L King <rlking@...> wrote:

?

Just create a socket connection, send the command, read the response, close the connection. I’m not a Pythonista, but I imagine this will be pretty straightforward.

?

?

From: [email protected] <[email protected]> On Behalf Of Mark Murari
Sent: 01 February 2023 22:31
To: [email protected]
Subject: Re: [ibc] IBC Version 3.16.0

?

Just saw this, thanks. Need to figure out how to send telnet commands from python now…



On 29 Jan 2023, at 19:08, Richard L King <rlking@...> wrote:

?

Oops, sorry, forgot to reply…

?

The restart script is Windows-only (though the target TWS/Gateway can be anywhere).

?

I don’t bother providing a script for Linux because it’s easy to script telnet on Linux, as it reads input from stdin. This is not the case for Windows, hence the klunky mix of batch and vbs.

?

For example on Linux:

?

(echo restart; sleep 1; echo "quit" ) | telnet 10.252.0.7 7462

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Mark Murari
Sent: 28 January 2023 10:49
To: [email protected]
Subject: Re: [ibc] IBC Version 3.16.0

?

Hi Richard,

I may have jumped the gun on this :). Is the restart script only available for windows in this version or am I being thick again?


Re: IBC Version 3.16.0

 

开云体育

Just create a socket connection, send the command, read the response, close the connection. I’m not a Pythonista, but I imagine this will be pretty straightforward.

?

?

From: [email protected] <[email protected]> On Behalf Of Mark Murari
Sent: 01 February 2023 22:31
To: [email protected]
Subject: Re: [ibc] IBC Version 3.16.0

?

Just saw this, thanks. Need to figure out how to send telnet commands from python now…



On 29 Jan 2023, at 19:08, Richard L King <rlking@...> wrote:

?

Oops, sorry, forgot to reply…

?

The restart script is Windows-only (though the target TWS/Gateway can be anywhere).

?

I don’t bother providing a script for Linux because it’s easy to script telnet on Linux, as it reads input from stdin. This is not the case for Windows, hence the klunky mix of batch and vbs.

?

For example on Linux:

?

(echo restart; sleep 1; echo "quit" ) | telnet 10.252.0.7 7462

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Mark Murari
Sent: 28 January 2023 10:49
To: [email protected]
Subject: Re: [ibc] IBC Version 3.16.0

?

Hi Richard,

I may have jumped the gun on this :). Is the restart script only available for windows in this version or am I being thick again?


Re: IBC Version 3.16.0

 

开云体育

Just saw this, thanks. Need to figure out how to send telnet commands from python now…


On 29 Jan 2023, at 19:08, Richard L King <rlking@...> wrote:

?

Oops, sorry, forgot to reply…

?

The restart script is Windows-only (though the target TWS/Gateway can be anywhere).

?

I don’t bother providing a script for Linux because it’s easy to script telnet on Linux, as it reads input from stdin. This is not the case for Windows, hence the klunky mix of batch and vbs.

?

For example on Linux:

?

(echo restart; sleep 1; echo "quit" ) | telnet 10.252.0.7 7462

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Mark Murari
Sent: 28 January 2023 10:49
To: [email protected]
Subject: Re: [ibc] IBC Version 3.16.0

?

Hi Richard,

I may have jumped the gun on this :). Is the restart script only available for windows in this version or am I being thick again?


Re: TWS asks for 2FA every 24 hours even though "Auto restart" for one week enabled

 

Thank you Richard.? I modified the scheduled task?
from
Start TWS Live (daily)
to
Start TWS Live (weekly)
starting Sunday and running for 6 days, checking if it runs every 10 minutes


Re: TWS asks for 2FA every 24 hours even though "Auto restart" for one week enabled

 

开云体育

The screenshot shows that the first task is being stopped at 03:36:57 because it reaches its timeout. That means that when the next schedule start arrives at 03:42:01, it is no longer running, so a new task is started and this will be a new launch of TWS, and hence a full login.

?

There shouldn’t be any time limits to the tasks. If you think about the normal case where the thing loads up on Sunday and keeps running (and auto-restarting daily) all week, that is all the one task (the task being the instance of the batch file, not the instance of TWS which of course is reloaded each day at restart).

?

You don’t need the task start time and the auto-restart time to be the same. It won’t help if the task has a defined timeout.

?

By the way, launcher.log is not really relevant, as it contains no information relevant to IBC. The IBC logfile is much more useful.

?

?

?

?

From: [email protected] <[email protected]> On Behalf Of Mark Dabrowski via groups.io
Sent: 31 January 2023 14:12
To: [email protected]
Subject: Re: [ibc] TWS asks for 2FA every 24 hours even though "Auto restart" for one week enabled

?

As seen in the attached scheduled task history, it's the culprit..? I guess I need to disable it and enable it at exactly 2:32am, my first trigger time?

Again, as per today's C:\Jts\launcher.log
it does the 2:30 restart as expected without 2FA:
2023-01-31 02:30:24.899 [GU] INFO? [JTS-Main] - ------------------------------- TWS RESTART --------------------------------

but then the scheduled task launches at 3:42am (when I must have originally enabled the scheduled task) asking for 2FA every day:
2023-01-31 03:42:06.828 [PF] INFO? [JTS-Main] - ------------------------------- TWS RESTART --------------------------------