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
Probabilistic 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
-6.237
Tracking Error
0.13
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
import pandas as pd

class UncoupledHorizontalSplitter(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 7, 7)  # Set Start Date
        self.SetEndDate(2020, 7, 14)
        self.SetCash(100000)  # Set Strategy Cash
        
        self.AddUniverse(self.CoarseFilter, self.FineFilter)
        
    def OnData(self, slice):
        self.Debug(self.df)
    
    def CoarseFilter(self, coarse):
        usEquities = [c for c in coarse if c.Symbol.ID.Market.lower() == "usa" and c.Symbol.SecurityType == SecurityType.Equity and c.HasFundamentalData]
        usEquities.sort(key=lambda c: c.DollarVolume, reverse=True)
        
        return [c.Symbol for c in usEquities][:10]
        
    def FineFilter(self, fine):
        arrays = [[f.Symbol.Value for f in fine]*2, ["OperatingIncome"]*10 + ["NetIncome"]*10]
        col = pd.MultiIndex.from_arrays(arrays, names=('symbol', 'item'))
        self.df = pd.DataFrame([], columns=col, index=["ThreeMonths", "SixMonths", "NineMonths", "TwelveMonths"])
        
        for f in fine:
            self.df.loc["ThreeMonths", (f.Symbol.Value, "OperatingIncome")] = f.FinancialStatements.IncomeStatement.OperatingIncome.ThreeMonths
            self.df.loc["SixMonths", (f.Symbol.Value, "OperatingIncome")] = f.FinancialStatements.IncomeStatement.OperatingIncome.SixMonths
            self.df.loc["NineMonths", (f.Symbol.Value, "OperatingIncome")] = f.FinancialStatements.IncomeStatement.OperatingIncome.NineMonths
            self.df.loc["TwelveMonths", (f.Symbol.Value, "OperatingIncome")] = f.FinancialStatements.IncomeStatement.OperatingIncome.TwelveMonths
            
            self.df.loc["ThreeMonths", (f.Symbol.Value, "NetIncome")] = f.FinancialStatements.IncomeStatement.NetIncome.ThreeMonths
            self.df.loc["SixMonths", (f.Symbol.Value, "NetIncome")] = f.FinancialStatements.IncomeStatement.NetIncome.SixMonths
            self.df.loc["NineMonths", (f.Symbol.Value, "NetIncome")] = f.FinancialStatements.IncomeStatement.NetIncome.NineMonths
            self.df.loc["TwelveMonths", (f.Symbol.Value, "NetIncome")] = f.FinancialStatements.IncomeStatement.NetIncome.TwelveMonths
        
        return [f.Symbol for f in fine]