Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Is there a way to connect to IB only when needed to trade?

I have an algorithm in mind that only requires it to trade using EOD data at the close of the business day. Further this algorithm is restricted to trade only once a month or even less depending on market conditions. In this scenario, is there any way to connect to the broker only when a trade needs to be placed, rather than being connected all the time? I have the following in mind: The Schedule Function is setup to run once a day about 15 or 20 mins prior to close. Connection to the broker is established at that time and market data retrieved for the necessary symbols. The algorithm determines if any trades need to placed and if so it places the trades, confirms a successful execution, At the end of this connection to broker is closed and it is only re-connected the next day.

Please let me know if there is a way to do this.

4 responses

On Quantopian, the algorithm is either connected to a brokerage account, or not. There's not an in-between state. What you could do is create a sub-account from your master IB account. And use that sub-account to run your strategy, even if it only trades once per month.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Thanks Alisa. My concern here really is around how robust this would be to maintain the login and connection for long periods of time. Does this mean that the connection to IB is maintained over weekends and holidays as well? Or, do I need to login routinely to make sure this is constantly connected? Ideally, I would prefer to set this all up and not have to touch it for months.

Once you connect your algorithm, the login is maintained each day. We connect to your IB account, start up the algorithm each morning, and the code runs seamlessly. You don't need to do anything after you deploy :)

Sometimes your algorithm may get disconnected, but this is rare. For example, if your login to your IB account via TWS/Webtrader, IB does maintenance over the weekend and they log you out, or another reason. In these cases, you will immediately get an automated email to relogin. Once your relogin, your algo will resume trading and the connection is again maintained.

I am an new beginner. Could you help me ? Is there any possible for me to run the algos on quantopian for real trade? I have IB account. But .. There is no guide to teach me how to do it.