Back

Historical Fundamental Data

Hi everyone! I'm new to QuantConnect / Python and I'm creating a Universe selection model. Within my FineSelectionFilter i'd like to exclude stocks that have less than a 25% increase in revenue YOY. I'm having trouble creating that measurement and thought I'd try here for help...

 

This is as far as I got before realizing that the list I was pulling was for all stocks rather than each individual security that I wanted, does anyone have a solve for my problem? thank you!

 

start_time = datetime(2017, 1, 4)
    end_time = datetime.now()


    def FineSelectionFilter(self, fine):
         # sort descending by P/E ratio
        
        
        
        revenue_history = qb.GetFundamental(filteredByFundamentalData, "IncomeStatement.TotalRevenue", start_time, end_time)
        revenuegrowth = (IncomeStatement.TotalRevenue - revenue_history) / revenue_history[-2]
        filteredByRevenueGrowth = [x.Symbol for x in fine if revenuegrowth > .25]
        
        sortedByPeRatio = sorted(filtereByRevenueGrowth, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
        
        
    
        # take the top entries from our sorted collection
        return [ x.Symbol for x in sortedByPeRatio[:self.__numberOfSymbolsFine] ]

Update Backtest







0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Nathan,

This BootCamp is a great place to start with learning how to use Fundamental data with our API. Also, check out of documentation on Fundamental data here.

Best,
Shile Wen

0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed