Overall Statistics |
Total Trades 6 Average Win 0.13% Average Loss -0.19% Compounding Annual Return 10.813% Drawdown 0.600% Expectancy 0.130 Net Profit 0.075% Sharpe Ratio 0.74 Probabilistic Sharpe Ratio 0% Loss Rate 33% Win Rate 67% Profit-Loss Ratio 0.70 Alpha 4.048 Beta -3.603 Annual Standard Deviation 0.046 Annual Variance 0.002 Information Ratio -18.198 Tracking Error 0.059 Treynor Ratio -0.01 Total Fees $9.81 |
class UncoupledHorizontalCompensator(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 11, 6) # Set Start Date self.SetEndDate(2019, 11, 9) self.SetCash(100000) # Set Strategy Cash self.AddEquity("SPY", Resolution.Minute) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY", 30), self.ClosePositions) 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 ''' stop_time = self.Time.replace(hour=15, minute=29) if self.Time > stop_time: return if not self.Portfolio.Invested: self.Debug(f"Trading - {self.Time}") self.SetHoldings("SPY", 1) def ClosePositions(self): self.Liquidate()