Overall Statistics |
Total Orders 420 Average Win 1.61% Average Loss -1.71% Compounding Annual Return 1.395% Drawdown 24.600% Expectancy 0.082 Start Equity 100000 End Equity 127452.00 Net Profit 27.452% Sharpe Ratio -0.127 Sortino Ratio -0.064 Probabilistic Sharpe Ratio 0.002% Loss Rate 44% Win Rate 56% Profit-Loss Ratio 0.94 Alpha -0.016 Beta 0.198 Annual Standard Deviation 0.068 Annual Variance 0.005 Information Ratio -0.317 Tracking Error 0.138 Treynor Ratio -0.044 Total Fees $2438.28 Estimated Strategy Capacity $390000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 6.55% |
#region imports from AlgorithmImports import * #endregion # https://quantpedia.com/Screener/Details/41 class TurnOfMonthSPY(QCAlgorithm): def initialize(self): self.set_start_date(2001, 1, 11) # Set Start Date self.set_end_date(2018, 7, 11) # Set End Date self.set_cash(100000) # Set Strategy Cash self._days = 0 self._spy = self.add_equity("SPY", Resolution.DAILY).symbol # This event triggers the algorithm to purchase during the last trading day of the month self.schedule.on( self.date_rules.month_end(self._spy), self.time_rules.after_market_open(self._spy, 1), self._purchase) def _purchase(self): ''' Immediately purchases the ETF at market opening ''' self.set_holdings(self._spy, 1) self._days = 0 def on_data(self, data): if self.portfolio.invested: self._days += 1 # Liquidates after 3 days if self._days > 3: self.liquidate(self._spy, 'Liquidate after 3 days')