Overall Statistics |
Total Orders 1 Average Win 0% Average Loss 0% Compounding Annual Return 13.280% Drawdown 33.600% Expectancy 0 Start Equity 100000 End Equity 348395.52 Net Profit 248.396% Sharpe Ratio 0.553 Sortino Ratio 0.558 Probabilistic Sharpe Ratio 10.319% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0 Beta 0.998 Annual Standard Deviation 0.146 Annual Variance 0.021 Information Ratio -0.453 Tracking Error 0 Treynor Ratio 0.081 Total Fees $3.06 Estimated Strategy Capacity $1400000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 0.03% |
# THIS IS JUST A DEFAULT PROJECT # In order to check the 10 Best Days research you need to select ... # # on the right side in the EXPLORER select --> Best Days.ipynb from AlgorithmImports import * class BuyAndHoldSPY(QCAlgorithm): def Initialize(self): # Set the start and end date for a 10-year backtest self.SetStartDate(2014, 10, 1) # Start date 10 years ago self.SetEndDate(2024, 10, 1) # End date self.SetCash(100000) # Set the initial cash balance # Add SPY (S&P 500 ETF) to the universe self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol # Set warm-up period for indicators or anything else if needed self.SetWarmUp(TimeSpan.FromDays(30)) def OnData(self, data): # Check if the portfolio does not already have SPY holdings if not self.Portfolio[self.spy].Invested: # Buy SPY with 100% of the available portfolio cash self.SetHoldings(self.spy, 1) self.Debug(f"Purchased SPY on {self.Time}")