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!

Clone Algorithm
573
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5277f1bbbd6b68072fa64332
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.
6 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. 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.

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. 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.

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