Overall Statistics |
Total Trades 33 Average Win 0% Average Loss 0% Compounding Annual Return 498.333% Drawdown 2.800% Expectancy 0 Net Profit 3.999% Sharpe Ratio 3.894 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 1.24 Beta -0.191 Annual Standard Deviation 0.33 Annual Variance 0.109 Information Ratio 3.672 Tracking Error 0.415 Treynor Ratio -6.722 Total Fees $33.00 |
from Alphas.MacdAlphaModel import MacdAlphaModel from Execution.ImmediateExecutionModel import ImmediateExecutionModel from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel from Risk.MaximumDrawdownPercentPerSecurity import MaximumDrawdownPercentPerSecurity from Selection.UncorrelatedUniverseSelectionModel import UncorrelatedUniverseSelectionModel class OptimizedTachyonShield(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 8, 14) # Set Start Date self.SetCash(100000) # Set Strategy Cash # self.AddEquity("SPY", Resolution.Minute) self.AddAlpha(MacdAlphaModel(12, 26, 9, MovingAverageType.Simple, Resolution.Daily)) self.SetExecution(ImmediateExecutionModel()) #self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) self.SetPortfolioConstruction(MyPortfolioConstructionModel()) self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(0.1)) self.SetUniverseSelection(UncorrelatedUniverseSelectionModel()) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' # if not self.Portfolio.Invested: # self.SetHoldings("SPY", 1) # Portfolio construction scaffolding class; basic method args. class MyPortfolioConstructionModel(PortfolioConstructionModel): # Create list of PortfolioTarget objects from Insights def CreateTargets(self, algorithm, insights): targets = [] for x in insights: # Return an array of targets targets.append(PortfolioTarget(x.Symbol, 100)) return targets