Questions on automating IB

Discussion in 'Interactive Brokers' started by alf111, Feb 13, 2023.

  1. alf111

    alf111

    1. I hear it's possible to do the 2FA only once per week, how is this possible? Even using IBController to open the TWS daily will prompt a 2FA command. And there's no way to disable the auto-restart/logoff daily.

    2. If I want to use subaccount1 (U1111111) on VPS1 and subaccount2 (U2222222) on VPS2 - both belonging to the same account main account, how do I do so without interuptting the access on subaccount1 when I run subaccount2 on a separate VPS with diff strategies?
     
  2. About question #1: I don’t use TWS but Gateway. It can be set such that it restarts every day automatically. Only on Saturday will I be logged out. After that I need to log in manually on Sunday.
     
    rb7 and d08 like this.
  3. d08

    d08

    Why would you use a different VPS but even if you do, you'd use different clientIds to connect which provides some separation. For certain portfolio level commands you can also specify the account. Signals can also be separated with orderRef.
     
    edge1 and rb7 like this.
  4. Re point 1...Take a look at IBC. That will automate most of the stuff for you.

    And yes use IB Gateway instead of TWS. Unless of course for technical reasons you need TWS. But if not, Gateway will be more lightweight and you can save on compute costs (regardless whether you run it on the cloud or in your garage).

    I have fully automated this and get the MFA notif only on a Sunday evening (UK time), the day I start IB Gateway. Every other MFA notif I get during the week it means IB Gateway has crashed and IBC restarted it automatically (and I don't care, I don't do HFT or intraday stuff at the moment).

    Re point 2, also as pointed out by @d08, no need for that I think. Just use a third account maybe? I have a read-only mode one I use for my phone 4 example.

    Hope this helps
     
  5. alf111

    alf111

    Wait Gateway can bypass the 2FA function? Basically main issue right now is that VPS sometimes MIGHT log me out due to connectivity issues (or whatever) and if it logs me out during the live trading session and Im not around my phone for 2FA I'm basically out. Using IBController doesnt fix the 2FA, it just force re-opens / login IB after a connection drop and still requires a 2FA
     
  6. Yes. There is a menu where you specify at what time you should be logged off. This can be set at a time outside market hours. Then there is a check box to enable automatic re-logon. If you select this you first will get a warning message. Click that away and all is set. It will automatically re-logon on weekdays.
     
  7. d08

    d08

    Why would your VPS log you out? Use a different VPS provider if that's the case.
    As @HobbyTrading stated, under normal circumstances you won't be asked for 2FA during the week during auto-restarts. But if Gateway should crash or any other technical issue like a permanent data freeze, you will be asked for 2FA. That's a significant problem and will one day cause a lot of havoc.

    PS. IBController is discontinued, use IBCAlpha.