Overall Statistics |
Total Trades 1 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 $2.75 Estimated Strategy Capacity $420000.00 Lowest Capacity Asset AAPL XYME7AV9W0O6|AAPL R735QTJ8XC9X |
from AlgorithmImports import * # endregion class EnergeticYellowGreenFalcon(QCAlgorithm): def Initialize(self): self.SetStartDate(2022, 5, 19) # Set Start Date self.SetEndDate(2022, 5, 21) self.SetCash(100000) # Set Strategy Cash self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol option = self.AddOption("AAPL") self.option_symbol = option.Symbol self.SetWarmUp(timedelta(days = 30)) self.order = True self.SetSecurityInitializer(self.SecurityInitializer) def SecurityInitializer(self, security): security.SetMarketPrice(self.GetLastKnownPrice(security)) security.SetDataNormalizationMode(DataNormalizationMode.Raw) def OnData(self, data): if self.IsWarmingUp: return if not self.Portfolio.Invested and self.order: contract_symbols = self.OptionChainProvider.GetOptionContractList(self.option_symbol, self.Time) expiry = min([symbol.ID.Date for symbol in contract_symbols], default="EMPTY") filtered_symbols = [symbol for symbol in contract_symbols if symbol.ID.Date == expiry and self.option_symbol.ID.OptionRight == OptionRight.Call] self.contract_symbol = sorted(filtered_symbols, key=lambda symbol: symbol.ID.StrikePrice)[0] value = self.AddOptionContract(self.contract_symbol) shares_to_buy = int(self.Portfolio.Cash / (100*value.AskPrice)) self.MarketOrder(self.contract_symbol, shares_to_buy) self.order = False