IB TWS – Forever up! Fixing disconnect routine

Imagine you need to create an algo tool that should work with Interactive Brokers through Trading Workstation API. Nothing complex, right – so, you develop the tool, test it using the paper account, all goes smoothly and you’re ready to go live.

However, once done you discover that TWS has a mandatory automatic disconnect once per day. You can even specify the time of an everyday shutdown using the TWS settings.

But what to do should you need your app to work Monday to Sunday and you don’t have any intention to start it manually every day?

With the use of IBController you can override and disable this TWS behaviour. So, you can set the shutdown for Friday evening through IBConnect and startup on Monday morning using the Scheduled Tasks. As easy as that!

Note that you should not disable TWS forever since shutdown is needed for regular software updates.