I keep getting
"During the algorithm initialization, the following exception has occurred: Error connecting to brokerage: InteractiveBrokersBrokerage.Connect(): An existing session was detected and will not be automatically disconnected. Please close the existing session manually.. This may be caused by incorrect login credentials or an unsupported account type.InteractiveBrokersBrokerage.Connect(): An existing session was detected and will not be automatically disconnected. Please close the existing session manually." while deploying algo live to IB. I'm sure login details are correct and auth set up correct at IB side. Has anyone run through this?
Alexandre Catarino
One of the possible causes is incorrect login credentials, but, as stated, the main reason cause is another existing session. Maybe you are logged in IB Trader Workstation (TWS).
If this issue persists, please contact Interactive Brokers and ask them about any existing connection and to close it.
Yanki Margalit
Does it mean that while I have an algorithm live trading on IB I cannot use TWS?
Alexandre Catarino
Hi Yanki Margalit,
Unfortunately no, not at the same time. This restriction is imposed by Interactive Brokers. However, if there were no restrictions, it would still be problematic because Lean only synchronizes the portfolio on initialization, so it would not recognize the trades that were manually placed with TWS.
If you want to intervene in your account using TWS, you need to stop the algorithm, place the trades, and redeploy.
Let me point out that it is possible to place manual trades using the Web IDEÂ by clicking on the security line in the table shown in the Holdings Tab.
Artem Seredyuk
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!