Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 29.818% Drawdown 5.100% Expectancy 0 Net Profit 30.750% Sharpe Ratio 1.943 Probabilistic Sharpe Ratio 82.051% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 1.005 Annual Standard Deviation 0.105 Annual Variance 0.011 Information Ratio 2.177 Tracking Error 0.001 Treynor Ratio 0.203 Total Fees $1.40 Estimated Strategy Capacity $750000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X |
class CreativeLightBrownParrot(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 12, 1) self.SetCash(100000) self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol self.max = self.MAX("SPY",10) 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 ''' # Check if we're not invested and then put portfolio 100% in the SPY ETF. if not self.Portfolio.Invested: self.SetHoldings("SPY", 1) ## Condition to see if SPY is in the Dividend DataDictionary if data.Dividends.ContainsKey("SPY") or data.Splits.ContainsKey("SPY"): self.Debug("Indicator has been reset") self.max.Reset() history = self.History(self.spy,10) for time,row in history.loc[self.spy].iterrows(): self.max.Update(time, row["close"])