Keyboard Shortcuts
Likes
Search
Auto Restart with 2 factor auth
Hello There, ? I was reading the guide for IBC and there is specified that is possible to have the 2 factor authentication login request only once a week. I am running TWS 1022 and I have set the auto-restart at 10:15 pm, also im running on windows the scheduled task that should restart IBC every day (the one that is also included with the IBC windows version) My question is, to have to accept only once a week the 2 factor notification... I should use the included TWS auto-restart or the scehduled task or both of them? ? Thanks, Federico |
¿ªÔÆÌåÓýOk, if you start TWS using IBC once a week, either manually, or via a simple scheduled task (ie no repeats), then setting auto-restart will keep it running for the rest of the week without you needing handle the authentication alert again. ? Now suppose it fails during the week for some reason, so that your IBC/TWS process is terminated untidily. Now nothing will happen until you restart IBC again. That¡¯s where the more advanced settings of the scheduled task included with IBC comes in. This will periodically try to run IBC again, and if it¡¯s already running it won¡¯t create another instance. But if IBC/TWS has failed for some reason, then it will create a new instance, IBC will initiate login, and you¡¯ll get the authentication alert on your phone again. ? I¡¯m not quite sure whether that answers your question, but if not please clarify. ? Richard ? ? From: [email protected] <[email protected]> On Behalf Of sannasardo.fed@...
Sent: Monday, July 24, 2023 1:32 PM To: [email protected] Subject: [ibc] Auto Restart with 2 factor auth ? Hello There, ? I was reading the guide for IBC and there is specified that is possible to have the 2 factor authentication login request only once a week. I am running TWS 1022 and I have set the auto-restart at 10:15 pm, also im running on windows the scheduled task that should restart IBC every day (the one that is also included with the IBC windows version) My question is, to have to accept only once a week the 2 factor notification... I should use the included TWS auto-restart or the scehduled task or both of them? ? Thanks, Federico |
Hi, Thanks for the reply. So basically I should for example have a?scheduled task that runs every day of the week the?StartTWS.bat in the morning (I guess for the time limit of 23 hours on the scheduled tasks),? now that IBC is running it will check if TWS is running every 10 min. At the same time I should have TWS setup to auto-restart daily (for example at 10:15 pm). So the next day I will still have the IBC running and TWS is auto-restarted and still logged on from the day before. And if I have understand correctly if I have IBC running and TWS performs is integrated auto-restart the restarted TWS instance will be still linked to the already running IBC instance ? When you are talking about the auto-restart you refer to the integrated TWS auto-restart or one of the settings inside the config.ini of IBC? ? Thank you, Federico ? |
¿ªÔÆÌåÓýFederico ? For precision, I¡¯ll comment on each individual sentence of your reply. Note that references to TWS also apply to Gateway. ? ? So basically I should for example have a scheduled task that runs every day of the week the StartTWS.bat in the morning (I guess for the time limit of 23 hours on the scheduled tasks)¡ ? Yes. My preferred choice for start time is Sundays to Thursdays at 22:15. That suits me because Sunday evening is a convenient time for me to handle the 2FA prompt on my phone. With a time limit of 23 hours 55 minutes. The Thursday start plus time limit takes me to the end of the trading week on Friday evening. ? ¡now that IBC is running it will check if TWS is running every 10 min ? Note that it is not IBC that checks if TWS is running every 10 minutes. The 10-minute task repeat does this. If the task is already running, the task scheduler simply does nothing. At the same time I should have TWS setup to auto-restart daily (for example at 10:15 pm).? Yes. Note that TWS doesn¡¯t allow you to specify a timezone in the auto-restart time, so you may need to think carefully about this. For example, I¡¯m in the UK, and daylight saving time (DST) has different changeover dates than the US. At first I set the auto-restart time to 22:15 UK time, thinking that would be shortly after the US markets closed (when there is practically nothing happening in any markets in either the US or Europe). However that caused a problem during the two weeks of the year when DST was out-of-sync between US and UK. Of course it only takes a minute or two to restart TWS, so not a big issue, but it meant that some US data was not captured, which is not ideal. So now I auto-restart at 05:55, which is shortly after the end of IB¡¯s daily reset period in the UK: some data will still be lost, but it¡¯s not as important at data towards the end of the main trading session. ? So the next day I will still have the IBC running and TWS is auto-restarted and still logged on from the day before. ? Almost. When TWS restarts, the IBC instance also disappears because both IBC and TWS run in the same process. However the IBC script is still running, and it restarts both IBC and TWS (in a new process). ? And if I have understand correctly if I have IBC running and TWS performs is integrated auto-restart the restarted TWS instance will be still linked to the already running IBC instance ? ? The restarted TWS is linked to the restarted IBC. But both are still under the control of the original script invocation (ie the same scheduled task instance). ? When you are talking about the auto-restart you refer to the integrated TWS auto-restart or one of the settings inside the config.ini of IBC? ? Auto-restart is always initiated by TWS when the configured auto-restart time is reached. If the AutoRestartTime setting in config.ini is used, IBC just sets that time in the TWS configuration. So the IBC program itself isn¡¯t otherwise involved in the auto-restart process. ? However the IBC start script (as opposed to the IBC program) has some involvement when an auto-restarting TWS shuts down: it has to locate the autorestart file created by TWS and pass that location into the Java command that starts the new instance of IBC: that command makes the location accessible to the JVM, and TWS gets it from there. ? I hope that clarifies everything! ? Richard |