Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe 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 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# region imports from AlgorithmImports import * # endregion class FormalBlackAnguilline(QCAlgorithm): def Initialize(self): self.SetStartDate(2023, 1, 1) self.SetEndDate(2023, 3, 8) self.SetCash(100000) # Set Strategy Cash self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol contracts = self.OptionChainProvider.GetOptionContractList(self.spy, self.Time.date()) if len(contracts) == 0 : return [] self.contract_list = [i for i in contracts if 10 < (i.ID.Date.date() - self.Time.date()).days < 100] for contract in self.contract_list[:2]: option = self.AddOptionContract(contract, Resolution.Minute) option.PriceModel = OptionPriceModels.BjerksundStensland() self.Debug(self.contract_list) self.Securities[self.spy].VolatilityModel = StandardDeviationOfReturnsVolatilityModel(30, Resolution.Daily) self.symbolDataBySymbol = {} self.symbolDataBySymbol[self.spy] = SymbolData(self.spy) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY", 30), self.RemoveOptions) def RemoveOptions(self): for symbol, symbolData in self.symbolDataBySymbol.items(): for contract in symbolData.contracts: self.RemoveOptionContract(contract) def OnData(self, data: Slice): pass def OnSecuritiesChanged(self, changes): for added in changes.AddedSecurities: if added.Symbol.SecurityType == SecurityType.Option: self.symbolDataBySymbol[added.Underlying.Symbol].contracts.append(added.Symbol) for removed in changes.RemovedSecurities: if removed.Symbol.SecurityType == SecurityType.Equity: self.symbolDataBySymbol.pop(removed.Symbol, None) elif removed.Symbol.SecurityType == SecurityType.Option: self.symbolDataBySymbol[removed.Underlying.Symbol].contracts.remove(removed.Symbol) class SymbolData: def __init__(self, ticker_symbol): self.symbol = ticker_symbol self.contracts = []