Back to Community
Fundamental pipeline

Can someone show me a simple way to use the Morningstar fundamentals data in a pipeline? Documentation says I need to reference a column but I don't know what those columns are. What I have is:

def initialize(context):  
    """  
    Called once at the start of the algorithm.  
    """  
    p = attach_pipeline(Pipeline(), 'my_pipeline')  
    my_factor = MyFactor(inputs=[morningstar.asset_classification.financial_health_grade], window_length=1)  
    p.add(my_factor, 'my_factor')  

I've subclassed CustomFactor but I'm just not sure how to get the various rankings out of the input.

3 responses

If you simply want a pipeline column containing the financial health grade, try the following:

def initialize(context):  
    """  
    Called once at the start of the algorithm.  
    """  
    p = attach_pipeline(Pipeline(), 'my_pipeline')  
    my_factor = morningstar.asset_classification.financial_health_grade.latest  
    p.add(my_factor, 'my_factor')  

See this page of the tutorial and look under the heading "Latest" for a simple example of how to use .latest.

Also, see the following post for the new fundamental data implementation. https://www.quantopian.com/posts/faster-fundamental-data

Thanks, Michael. I'll give all this a look.

Hi Matt,

Here is a link showing all the available fields in the Morningstar fundamentals dataset:
https://www.quantopian.com/help/fundamentals#fundamentals-overview

To reference fundamentals data in your code, simply import Fundamentals from quantopian.pipeline.data.

Here’s an example of using Morningstar fundamentals data in pipeline, specifically on line 20 using ‘enterprise_value’ as a factor. Let me know if you need any more guidance and good luck!

Best,
Robert

Clone Algorithm
30
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: 59bc1cbeec453d505a20f2a9
There was a runtime error.
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.