Run TWS automatically

Hello,
I was wondering if Amibroker has a functionality to open / login to Trader Workstation automatically? I am hoping to avoid getting two software labelled "IBController", as I'd have to run them both at once. I've looked across the web a little bit so far, but if anyone has the knowledge or even a recommendation to pair with Interactive and Ami-broker, I'd like to be open.

  1. There is slight confusion due to the fact that some other people named their software "IBController". And AmiBroker has it is OWN, completely unrelated IBController.

  2. You do NOT need to open AmiBroker's IBController. It is opened AUTOMATICALLY by AmiBroker as soon as you call GetTradingInterface("IB") in your formula.

  3. You can start TWS automatically by just adding a batch that starts it

  4. Logging into TWS is completely other story because for security reasons it needs security device for two-factor authorization and as such it is manual. User/password alone can be auto-typed using many 3rd party tools that help storing passwords securely like Keepass.

  5. I do NOT use third-party IBController (completely unrelated to AmiBroker's one)

Hmmm, good to know. I remember some issues with some Password storage services and IB's attempts to make everything harder for computers via graphics. Thank you Tomasz!

A few additions to @Tomasz great answer:

  • IBController is an old automation software, do not use it, it's probably not maintained anymore. The original author forked it and now it is called IBC For more info about what happened read twsapi@groups.io | Important Notice About IBController

  • It seems it's possible to opt out of two-factor authorization in your IBKR user account, and/or with a second user for the same account. I'm not sure it's possible everywhere as two-factor is a mandatory requirement for banking apps in some regions. I wouldn't do it anyway...In particular if you account is hacked this could potentially remove financial guarantees/insurances (depends on your local regulator).

  • In case you decide to opt out, you can increase security by adding IP restrictions in your account Security considerations following SLS opt out | staging

  • Last TWS has an auto-restart option (in General settings) which logs-in back automatically, so you only need to reconnect once a week. I don't use it though so I can't comment if it works nicely with Amibroker and IBController (they should reconnect automatically)

1 Like

If you are just trying to get around the daily logout that TWS does, there are settings for that in TWS. You can set the time that it happens, and you can even have it auto log back in without the need for 2 factor. No addons necessary.

I am not using TWS at the moment so I can't point you to the exact settings. Maybe someone else can chime in.

The stipulation is, your trading computer will need to run 24/7. When I was running this setup I would do all of my windows updates etc. over the weekend.

knipsel

1 Like

Yeye, I somewhat decided that if I'm not doing intraday trades, I didn't really need it to run all day, which could get expensive on amazon servers.