Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -8.321% Drawdown 0.800% Expectancy 0 Net Profit -0.348% Sharpe Ratio -2.402 Probabilistic Sharpe Ratio 15.014% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.24 Beta 0.135 Annual Standard Deviation 0.034 Annual Variance 0.001 Information Ratio -7.482 Tracking Error 0.168 Treynor Ratio -0.597 Total Fees $1.00 Estimated Strategy Capacity $11000000.00 Lowest Capacity Asset AAPL X22O820Y7OME|AAPL R735QTJ8XC9X |
from QuantConnect.Algorithm import * from QuantConnect.Securities.Option import OptionPriceModels class BasicTemplateOptionsFilterUniverseAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 1, 1) self.SetEndDate(2019, 1, 16) self.SetCash(100000) self.option = self.AddOption("AAPL") self.option.SetFilter(-1, +1, 14, 60) self.option.PriceModel = OptionPriceModels.BinomialTian() self.SetWarmUp(30, Resolution.Daily) self.done = False def OnData(self,slice): if self.IsWarmingUp: return for chain in slice.OptionChains: for symbol, chain in slice.OptionChains.items(): if not self.done: contracts = [c for c in chain if c.Right == OptionRight.Call] sorted_contracts = sorted(contracts, key = lambda x: x.Expiry, reverse=True) self.contract = sorted_contracts[0] self.MarketOrder(self.contract.Symbol, 1) self.done = True else: contract = [c for c in chain if str(c) == str(self.contract)] if len(contract) == 0: return contract = contract[0] self.Plot("Price", "Theoretical", contract.TheoreticalPrice) self.Plot("Volatility", "Value", self.Securities[symbol.Underlying].VolatilityModel.Volatility) self.Plot("Delta", "Value", contract.Greeks.Delta)