Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
cross-correlation, SPY & SH?

How would I use Quantopian to look at the cross-correlation of SPY & SH? I realize that all of the tools aren't in place yet, but I am offering this as another example of capabilities one might need to develop a novel algorithm for backtesting.

6 responses

@Grant,

You would need a trailing window of data for the two stocks, so that you could do the time-series calculation. This is precisely the type of use case for which we are building batch transform support. You will be able to declare a method as a batch transform, and that method will periodically receive a window of data for all the stocks in your universe.

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.

When does Quantopian expect to have the batch transform support ready for testing? Will it include plotting capability, as well?

Hello Grant - I don't have a date for you on the batch transform yet. Less than a month is my goal.

What plotting do you have in mind?

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.

@Dan,

Thanks for your feedback. See http://www.mathworks.com/discovery/gallery.html for plotting examples. I have in mind that in Quantopian it would be straightforward to generate arbitrary plots. In the case of SPY and SH, I'd be interested in using the cross-correlation to estimate any delay between the two "signals" and then plot the delay over time to see how it varies.

@Grant, thanks for explaining! The library we would use is matplotlib. Their gallery is here: http://matplotlib.org/gallery.html
I'd love to know how you think matplotlib compares to MATLAB.

Thanks again,
fawce

@fawce, matplotlib looks good...seems like you are on track with this choice. Users just need a full-up 2D/3D graphics/plotting tool.