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 -2.276 Tracking Error 0.091 Treynor Ratio 0 Total Fees $0.00 |
class VerticalParticleReplicator(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 5) self.SetEndDate(2020, 1, 30) self.SetCash(100000) self.SetUniverseSelection(FineFundamentalUniverseSelectionModel(self.CoarseSelectionFunction, self.FineSelectionFunction, None, None)) self.UniverseSettings.Resolution = Resolution.Daily self.AddAlpha(MyAlphaModel()) self.SetPortfolioConstruction(MyPortfolioConstructionModel()) self.SetExecution(ImmediateExecutionModel()) def CoarseSelectionFunction(self, coarse): sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) return [ x.Symbol for x in sortedByDollarVolume[:1] ] def FineSelectionFunction(self, fine): return [f.Symbol for f in fine] class MyAlphaModel(AlphaModel): Name = "MyAlphaModel_Name" symbol = None def Update(self, algorithm, slice): if self.symbol is not None: return [Insight.Price(self.symbol, timedelta(days=100), InsightDirection.Up)] return [] def OnSecuritiesChanged(self, algorithm, changes): for security in changes.AddedSecurities: self.symbol = security.Symbol class MyPortfolioConstructionModel(PortfolioConstructionModel): def CreateTargets(self, algorithm, insights): for insight in insights: algorithm.Log(f"Alpha Model Name: {insight.SourceModel}") return []