Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
get_pricing in research, what is it fetching from Yahoo Finance?

Hi, I noticed that the log output shows get_pricing() is fetching something from Yahoo Finance. What is it that it is fetching from Yahoo Finance?

2 responses

Hi Simon,

Those log lines are a bit of a red herring. What's happening is roughly as follows:

The first time you make any API request (get_pricing, get_backtest, symbols, etc.), we lazily initialize a bunch of resources that are necessary to make the request happen. One of those resources is a calendar of trading days, which comes from Zipline. Because of architectural decisions that were made early in Zipline development, initializing the trading calendar also requires initializing most of the resources that are needed for Zipline to run backtests standalone, even though the only thing research depends on is the trading calendar. One of the unnecessarily-loaded resources is a time series of benchmarks and treasury rates, which are used by Zipline to calculate certain risk metrics. When distributed as a standalone package, Zipline downloads its benchmark data from Yahoo, and when it does so it prints the message that you're seeing.

We're aware that this is a confusing user experience, and there's actually a work-in-progress branch open on Zipline right now that's almost a full redesign of the trading calendar module. That branch can be found here if you're interested in the guts of the backtester. One of the primary benefits of the new architecture is that it will make it much easier to use Zipline's core data structures outside of a backtesting context, but I'm mostly working on it as a side project at the moment, so I can't promise it will land any time soon. In the nearer term, we'll probably do a pass at some point on filtering and/or clarifying some of the logs that are unexpectedly showing up in research. The question, as always, is whether that's a better use of our limited engineering time than building new features or making the system faster and more reliable.

Hope that clarifies things,
- Scott

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.

I'm going through the tutorials as well and I too was confused by the get_pricing() method. Could you just state which file contains the code for this method and the filepath for accessing it. I think Scott and myself would like to examine its inner workings a bit rather than leave it as a black box. Thanks.