| Overall Statistics |
|
Total Trades 11 Average Win 0% Average Loss 0% Compounding Annual Return -11.344% Drawdown 2.600% Expectancy 0 Net Profit -1.017% Sharpe Ratio -1.293 Probabilistic Sharpe Ratio 21.016% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.092 Beta -0.176 Annual Standard Deviation 0.071 Annual Variance 0.005 Information Ratio -0.647 Tracking Error 0.145 Treynor Ratio 0.523 Total Fees $11.00 |
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
class NetNet(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1) # Set Start Date
self.SetEndDate(2020, 1, 31)
self.SetCash(100000) # Set Strategy Cash
self.SetAlpha(NetNetAlpha())
self.SetExecution(ImmediateExecutionModel())
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(lambda time: None))
self.Settings.RebalanacePortfolioOnInsightChanges = False
self.Settings.RebalancePortfolioOnSecurityChanges = True
self.SetUniverseSelection(FineFundamentalUniverseSelectionModel(self.CoarseSelectionFunction, self.FineSelectionFunction, None, None))
self.UniverseSettings.Resolution = Resolution.Daily
self.SetSecurityInitializer(lambda x: x.SetDataNormalizationMode(DataNormalizationMode.Raw))
# on 15 Jan, filter for securities with fundamental data
def CoarseSelectionFunction(self, coarse):
if not (self.Time.month == 1 and self.Time.day == 15):
return Universe.Unchanged
filtered = [ x.Symbol for x in coarse if x.HasFundamentalData ]
return filtered
# on 15 Jan, filter for securities with price above 1000
def FineSelectionFunction(self, fine):
filtered = [ x.Symbol for x in fine if x.Price > 1000 ]
return filtered
class NetNetAlpha(AlphaModel):
def __init__(self):
pass
def Update(self, algorithm, data):
insights = []
if not (algorithm.Time.month == 1 and algorithm.Time.day == 15):
return insights
for security in algorithm.ActiveSecurities.Values:
insights.append(Insight.Price(security.Symbol, timedelta(days=366), InsightDirection.Up))
return insights