Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Getting Fundamentals data for a specific date

I'm working on an algorithm that uses the current ROE vs ROE a year ago (along with other factors) to determine whether to buy a stock. Is it possible to get a fundamentals value from a date other than the "current_date" during a run? I tried something similar to Tutorial 3 and maintain a dictionary of all fetched fundamentals data, but each time the algorithm runs, the set of stocks being considered will differ and I ran into a case where the stock in question had not been in the fundamentals set returned previously.

Janene

2 responses

Hi Janene,

Right now, in the IDE, fundamentals only provides the current value. For the purpose of testing this concept in backtesting, you can warm up your algo for a year, storing the ROE for a year, I think like you've found. Unfortunately, we don't yet have a solution to this. We're actively working on one.

One thing to keep in mind is that you aren't limited to 500 stocks (like market data in handle_data) when analyzing and storing fundamental data in before_trading_start(). So you indeed have some sticky problems to handle still around stocks entering and exiting the market, but it shouldn't be related to the number of stocks you're tracking. (this is a common misconception when dealing with fundamental data).

Thanks
Josh

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 for the reply, Josh.

I was pondering doing the warming last night. Filling the set of fundamentals data over the first year of a backtest. Sounds like it could be a very slow algorithm to run. I can restrict the stocks I fill in a bit - the current algorithm is for small-caps, so that set is not the full 5000+ universe of stocks.

This is going to be an essential component of any platform, btw. Others, such as Portfolio123, provide the ability to run backtests with an initial ranking to cull the list each day/week/whatever, then apply a buy/sell algorithm on top of that. I suggest you take a look at what it offers, if you have not already. The algorithm I'm currently toying with is one that our company has implemented on P123. I'm trying to determine if it can be implemented here.

Janene