| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 13.215% Drawdown 33.700% Expectancy 0 Net Profit 272.561% Sharpe Ratio 0.706 Probabilistic Sharpe Ratio 10.376% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.001 Beta 0.997 Annual Standard Deviation 0.143 Annual Variance 0.02 Information Ratio -0.329 Tracking Error 0.005 Treynor Ratio 0.101 Total Fees $4.17 Estimated Strategy Capacity $100000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 0.03% |
# region imports
from AlgorithmImports import *
# endregion
class Buyandhold(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2013, 1, 1) # Set Start Date
self.SetEndDate(2023, 8, 5) # Set End Date
self.SetCash(100000) # Set Strategy Cash
self.AddEquity("SPY", Resolution.Minute)
def OnData(self, data: Slice):
"""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.0)
self.Debug("Purchased Stock")