Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
class CoarseFineFundamentalRegressionAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019,1,3)   #Set Start Date
        self.SetEndDate(2019,1,4)      #Set End Date
        self.SetCash(50000)            #Set Strategy Cash
        self.UniverseSettings.Resolution = Resolution.Minute
        # this add universe method accepts two parameters:
        # - coarse selection function: accepts an IEnumerable<CoarseFundamental> and returns an IEnumerable<Symbol>
        # - fine selection function: accepts an IEnumerable<FineFundamental> and returns an IEnumerable<Symbol>
        self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)


    # return a list of three fixed symbol objects
    def CoarseSelectionFunction(self, coarse):
        Coarse_filtered_stocks = [x for x in coarse if x.DollarVolume > 0 and x.Price > 0 and x.HasFundamentalData]
        self.Debug(' coarse # of stocks {}'.format(len(Coarse_filtered_stocks)))    
        return [stock.Symbol for stock in Coarse_filtered_stocks]


    # sort the data based on what trades on NYSE
    def FineSelectionFunction(self, fine):
        filtered_fine = [x for x in fine if x.CompanyReference.PrimaryExchangeID == "NYS"]
        self.Debug(' fine # of stocks {}'.format(len(filtered_fine)))
        return [ x.Symbol for x in filtered_fine]