I want to create a stock selection model base on:
1) market cap > $n Million,
2) average turnover($dollar) > $n Million
3) in two industry
4) select above list of stock that match: n period EMA < today EMA (e.g two months 60 days EMA < today 60 days EMA)
So how to add average turnover to the model and return a list that can screen out all the stocks that meet 4) EMA criteria ?? Thanks
Here is my work for now, please feel free to comment any improvement:
main.py:
from universe_selection import UniverseSelectionModel
class UncoupledNadionFlange(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 6, 13) # Set Start Date
self.SetCash(10000) # Set Strategy Cash
self.UniverseSettings.Resolution = Resolution.Daily
self.CustomUniverseSelectionModel = UniverseSelectionModel(self)
self.AddUniverse(self.UniverseSelectionModel.SelectCoarse, self.UniverseSelectionModel.SelectFine)
def OnData(self, data):
pass
universe_selection.py:
class UniverseSelectionModel():
def __init__(self, algorithm):
self.algorithm = algorithm
def SelectCoarse(self, coarse):
universe = self.FilterMarket(coarse)
return [c.Symbol for c in universe]
def SelectFine(self, fine):
universe = self.FilterIndustry(fine)
self.algorithm.securities = universe
return [f.Symbol for f in universe]
def FilterMarket(self, coarse):
marketcap = [c for c in coarse if c.Fundamentals.MarketCap > 10000000000]
return marketcap
def FilterIndustry(self, fine):
filter_industry = [f for f in fine if f.AssetClassification.MorningstarIndustryCode.ShippingAndPorts and MorningstarIndustryCode.Trucking]
return filter_industry
Shile Wen
Hi Franco,
I suggest checking out the Liquid Value Stocks BootCamp on using Fundamentals and EMA BootCamp.
Best,
Shile Wen
Shile Wen
Hi Franco,
I suggest checking out the Liquid Value Stocks BootCamp on using Fundamentals and EMA BootCamp.
Best,
Shile Wen
Franco shum
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!