Overall Statistics |
Total Orders 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Start Equity 1000000 End Equity 1000000 Net Profit 0% Sharpe Ratio 0 Sortino Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -4.126 Tracking Error 0.079 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
from AlgorithmImports import * class CustomTradingStrategy(QCAlgorithm): def Initialize(self): # Set backtest details self.SetStartDate(2024,1,1) self.SetEndDate(2024,1,30) self.SetCash(1_000_000) self.SetTimeZone("US/Eastern") # Add required data to the algo self.ticker = 'SPX' weekly_symbol = 'SPXW' weekly_canon_symbol = '?SPXW' self.underlying_symbol = self.AddIndex(self.ticker,Resolution.Daily).Symbol self.canonical_symbol = Symbol.CreateCanonicalOption(self.underlying_symbol, weekly_symbol, Market.USA, weekly_canon_symbol) def OnData(self, data): options = self.OptionChainProvider.GetOptionContractList(self.canonical_symbol, self.Time) if len(options) == 0: self.Log(f'[FAILED] fetching options, len(options == {len(options)}). Should be != 0') else: self.Log(f'[WORKED] fetching options, len(options == {len(options)})')