Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Using the Fetcher with Quandl

I have a short algorithm that allows you to obtain some extra information about companies. It uses the fetcher to access fundamental stock data from Quandl. There isn't much strategy in this algorithm, it's more of a display of how to use the fetcher with Quandl to obtain info such as P/E ratio, EBITDA, Capital Expenditures, and a ton more.

For convenience of testing out the different ratios, right now the algorithm just checks out the maximum and minimum ratios of the stocks considered, but it would be easy to look at an absolute value instead.

Any suggestions, comments, or questions are welcome!

7 responses

Sam, very cool algorithm, thanks for posting. It would be cool if you refactored the code so that the codes and the calls to fetcher were encapsulated in a class. Then you could instantiate the class in the initialize method to retrieve the data you want. We have a special fetch_estimize method, maybe we should have a fetch_quandl method that works along the lines you have outlined here.

thanks,
fawce

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,
Very nice algo! Just a question: are the data fetched static? Does the algo use the current P/E when he trades in 2003 or does it get the 2003 P/E?

Thanks,
Martin

It uses the 2003 data when it trades in 2003 - that's the beauty of the whole thing!

When you load a time series using Fetcher, the timestamps on the data is integrated into the backtester just like the stock data is - no look ahead bias. Data is used only when it is the correct time.

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 a lot for your quick reply! Another question if I may, is there any way to make the algo select the stocks based on the fetched data? For example: sell the stocks whose P/E ratios are among the 10% higher of sector i...
Martin

Not yet, but it's a feature I'd love to build.

--- Errors..... 'fetch_csv' only permitted within initialize function

Quandl's OFDP is deprecated or removed. I wonder what the equivalent would be for today.