Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Going live on IB with this algo.. any advice?

So this will be the first time I trade live on IB with an algorithm.. not quite sure what to expect. I've paper traded this for a while and have gone through many iterations before settling on this one. I'm trading in an IRA so I cannot short or use leverage. Are there any rules to the road or things I should look out for?

Thanks in advance,
Jamie

**Also, need to give credit to Market Tech for some of the trading logic.

10 responses

JL>> Are there any rules to the road or things I should look out for?

Yes, I wouldn't immediately trade in your IRA. Set aside some risk capital in a brokerage account to test out the algo first.

Also frequent trading in a cash account (typical for IRAs) can lead to violations of the 3 day trade settlement rule.
In the case of IB, they have a special IRA accounts.

When you make some coin, come back and let the community know you findings and how you did with IB.

Interactive Brokers IRA Account Types

Can I Day Trade Using My IRA?

Yes - Please let us know how your system does on live trading!

I have a system or two that I am running live on another platform (Also used a smaller amount to test the algo on live first) - as soon as I can duplicate those systems here - I want to run them live on IB via Quantopian but it would be great to get some feedback from another live user.

All the Best Jamie - looks like a great system!!

I've been discretionary trading an IB IRA account for years. You need to be sure that it is set up as a so-called IRA "margin" account if you wish to avoid violating the pattern trading rules. I don't know how they structure it, but it works. You can't leverage / borrow on margin. However, you can trade as frequently as you wish as long as you have the required $25,000 minimum account size.

Congratulations on getting close to going live! I have made several tweaks to your code, to make it more robust for live trading:

  • Add 'trading_freq' and 'n' variables to context. This helps save the state of the variables and is more robust to algo start/stops
  • Use schedule_function to trade at the beginning of each month, at market open, instead of hard-coding the day/time
  • Check for open orders before placing your next orders with order_target_percent.

I've run a backtest (see attached), but double check that the code makes sense and the algo is behaving as you expect.

Cheers,
Alisa

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 everyone for your input! Alisa, your updates are super helpful!

Good luck! I am about to go live soon as well. I should probably get someone to proofread my code too...

Hi Jamie,

In addition to Alisa's comments I'd also suggest you set up an IB demo account, if you don't have one they'll set one up for free. This will give you yet another sanity check that your algo is behaving as you expect before you invest capital.

I'd also suggest
1. adding logging to your algo so that it's easier for you to monitor what it's doing from the live trading dashboard
2. launching a Quantopian paper trading version of your algo simultaneously with your IB deploy so you can monitor any divergence between your models expected and actual results.
3. double check we haven't missed any other items from this list that Alisa shared recently of our on-boarding checks for contest algos.

Best, Jess

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.

What does the line

p10 = p.iloc[-10:]

produce? An numpy data structure (whatever it is called)? Or a pandas DataFrame?

What is the structure of the df returned by history? What are the "columns" names?

Thanks in advance!

Tim

Jamie,
Thanks for sharing this algo. Who are "Market Tech"?
Thanks

Jamie,

How did your algo work out?