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 -1.769 Tracking Error 0.183 Treynor Ratio 0 Total Fees $0.00 |
from Selection.FundamentalUniverseSelectionModel import FundamentalUniverseSelectionModel import pandas as pd class MultidimensionalDynamicProcessor(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 5, 2) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.SetUniverseSelection(LiquidValueUniverseSelectionModel()) class LiquidValueUniverseSelectionModel(FundamentalUniverseSelectionModel): def __init__(self): self.lastWeek = -1 self.called = 0 super().__init__(True) def SelectCoarse(self, algorithm, coarse): if not algorithm.Time.day % 7 == 0: return Universe.Unchanged sortedByDollarVolume = sorted([x for x in coarse if x.HasFundamentalData], key=lambda x: x.DollarVolume, reverse=True) return [x.Symbol for x in sortedByDollarVolume[:100]] def SelectFine(self, algorithm, fine): if not algorithm.Time.day % 7 == 0: return Universe.Unchanged factors_by_security_id = pd.DataFrame() for f in fine: factors_by_security_id.loc[str(f.Symbol), 'cash_return'] = f.ValuationRatios.CashReturn factors_by_security_id.loc[str(f.Symbol), 'earnings_yield'] = f.ValuationRatios.EarningYield universe = factors_by_security_id.rank().sum(axis=1).sort_values().index[-10:] return [algorithm.Symbol(security_identifier) for security_identifier in universe]