Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
[HELP] How to add all Fundamentals indicators to Pipeline

Hi, I'm planning to test different feature selection methods on the 600+ metrics available in the Fundamentals data. Hence, I would like to add all of the fields to my pipeline. Given that there are over 600 of them, the ideal way would be to do this iteratively. However, based on the example code I've seen so far, I have not found a way to do so.

The only way I know how to add fields from the Fundamentals data to my pipeline so far is like in the following code, which adds the first two fields from the Fundamentals Data Reference.

from quantopian.research import run_pipeline  
from quantopian.pipeline import Pipeline  
from quantopian.pipeline.data import Fundamentals

def make_pipeline():  
    return Pipeline(  
        columns={  
            'cannaics' : Fundamentals.cannaics.latest,  
            'financial_health_grade' : Fundamentals.financial_health_grade.latest,  
        }  
    )

result = run_pipeline(make_pipeline(),'2017-11-21','2017-11-21')  
result.head()  

It would be a bit ridiculous to add the remaining 600+ fields from Fundamentals as 600+ individual lines, so I'm wondering if there's a way to do this iteratively?

Any advice would be appreciated, thanks!

3 responses

Import a csv with the fundamentals you want?

Pipeline DataSet objects have a dataset.columns attribute which is a set of all of the bound columns on the dataset. You could use a dict comprehension like:

{column.name: column.latest for column in Fundamentals.columns}

to get a dictionary from column name to a Latest expression. I would not expect this pipeline to run in any reasonable amount of time (if it finishes at all), pipeline is not optimized for loading over 2000 columns at once.

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 think this might be it

def make_pipeline():  

    universe = QTradableStocksUS()  

    start=1  
    pipe = Pipeline()  
    for column in Fundamentals.columns:  
            start=1+start  
            next = str(('{}').format(start))  
            pipe.add(column.latest,next)  


    pipe.set_screen(universe)  

    return pipe