Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Multi-SID Example Algorithm w/ SPY only

I modified the "Multi-SID Example Algorithm" on the help page:

  • Commented out logging lines (to prevent errors)
  • Used SPY only, sid(8554)

I was curious how the algorithm would perform against the benchmark, in an "apples-to-apples" test (rather than with four presumably hand-picked stocks). Perhaps someone can provide an interpretation of the results and suggestions to improve the algorithm (or recommend a better one to use on SPY).

3 responses

Hi @Grant - your question gets to the heart of an important theme in our forums and in our product development. Should a human choose the instruments to run through an algorithm, or should the algorithm find securities that fit? Today our system only supports human selection, but in the near future we will be proving new tools that make it possible for your algorithm to find suitable securities.

The question is: how could you make the stock selection with your algorithm? This is where our product development is focused now. We think the Quantopian platform should provide you with two facilities:

  • an easy way to specify a universe of stocks. All trade events for stocks in your chose universe will be fed to your algorithm. This gives your algorithm access to more than just hand-picked securities.
  • batch transforms that allow you to work with a window of data for all securities in your universe. This gives your algorithm the data necessary to check for relationships between securities, and to analyze the behavior of any security over a useful historic period.

With these tools, you can start exploring ways to algorithmically identify stocks that would work well with your strategy.

In this particular case, the algorithm is looking for opportunities to follow the momentum of the security: the algo buys when the price breaks above the vwap, and sells when it falls below. You could certainly hand pick stocks where this algorithm would perform well - stocks with a secular decline would tend to build a short position, and stocks with a secular increasing trend would tend to build up long positions. Securities without a trend will probably tend to burn up capital in trading costs - I think that's what you're seeing in this example.

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.

Hey,

wow I am extremely interested in such tools. Could you explain them a little bit further. How will they work? Which libs are used?

Max,

Great!

The batch transforms are available now in production; the documentation is here: https://www.quantopian.com/help#ide-batch-transforms

Our universe selection is implemented and undergoing testing and performance optimization. The most recent discussion is here: https://www.quantopian.com/posts/looking-at-all-securities

The design of our universe selection is to use a dollar volume ranking on individual securities, based on this discussion: https://www.quantopian.com/posts/universe-selection

Our methodology is designed to make an unbiased selection for the universe, so that your algorithm can then screen further. For something simple like choosing pairs, you could perhaps look at regression fit over a trailing window, and choose stocks with high co-integration.

We are discussing internally whether it makes sense to open source the universe selection code. The main hold up on is that the selection is very data intensive, and we think it would require us to also release our datasource code. That would require some refactoring on our side, because our current datasources are a bit specific to our infrastructure.

thanks,
fawce