Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Missing morningstar fundamentals? Work-around?

It looks like some morningstar fundamentals are missing and I'm trying to figure out a work around.

Issue:
Day n: create pipeline with morningstar fundamentals (e.g. ev_to_ebitda) and filter out top x equities
Day n+1: update pipeline and check changes in morningstar fundamentals vs previous day.
Several of the equities from day n that I query in the pipeline on day n+1 returns 0.

Presumably this means that those data points are missing in the dataset?

Idea for solution:
If I increase the window-size in a custom factor - can I then fetch the last available datapoint for each equity? That way I can rank equities with a mixture of current data points for those that have and last known data point for those that don't. I would prefer to have a slightly outdated value than no value at all.

Thoughts?

2 responses

Hi Hannes,

I'd like to try and reproduce your issue. You're looking at ev_to_ebitda, right? On what date and for which equities are you seeing 0s?

Normally when a datapoint is missing from the dataset it shows up as nan.

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.

create a pipeline and take top 20 equities sorted by ev_to_ebitda.

Then in before_trading_start() added:
results = pipeline_output('factors').dropna()
ranks = results.rank().mean(axis=1).order()
context.longs = ranks.tail(context.number_longs)

old_l_ranks = l_data = 0  
for security in context.portfolio.positions:  
    if context.portfolio.positions[security].amount > 0 :  
        old_l_ranks += ranks.get(security,0)  
        if ranks.get(security,0) > 0 : l_data += 1

context.missinglong += context.number_longs - l_data  
record(missinglong = context.missinglong)

The get() command above ends up fetching several 0s as default since it can't find yesterday's top equities in today's pipeline.