Overall Statistics |
Total Orders 2 Average Win 0% Average Loss 0% Compounding Annual Return -42.710% Drawdown 5.300% Expectancy 0 Start Equity 100000 End Equity 95865.5 Net Profit -4.134% Sharpe Ratio -3.655 Sortino Ratio -2.45 Probabilistic Sharpe Ratio 0.009% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.339 Beta 0.011 Annual Standard Deviation 0.092 Annual Variance 0.009 Information Ratio -3.783 Tracking Error 0.111 Treynor Ratio -31.123 Total Fees $2.00 Estimated Strategy Capacity $5500000.00 Lowest Capacity Asset GOOCV 30JDODNXWB9VQ|GOOCV VP83T1ZUHROL Portfolio Turnover 0.10% |
# region imports from AlgorithmImports import * # endregion class ShortStrangleAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2017, 4, 1) self.set_end_date(2017, 4, 30) self.set_cash(100000) option = self.add_option("GOOG") self.symbol = option.symbol option.set_filter(lambda universe: universe.include_weeklys().strangle(30, 5, -10)) def on_data(self, slice: Slice) -> None: if self.portfolio.invested: return # Get the OptionChain chain = slice.option_chains.get(self.symbol) if not chain: return # Find options with the nearest expiry expiry = max([x.expiry for x in chain]) contracts = [contract for contract in chain if contract.expiry == expiry] # Order the OTM calls by strike to find the nearest to ATM call_contracts = sorted([contract for contract in contracts if contract.right == OptionRight.CALL and contract.strike > chain.underlying.price], key=lambda x: x.strike) if not call_contracts: return # Order the OTM puts by strike to find the nearest to ATM put_contracts = sorted([contract for contract in contracts if contract.right == OptionRight.PUT and contract.strike < chain.underlying.price], key=lambda x: x.strike, reverse=True) if not put_contracts: return call_strike = call_contracts[0].strike put_strike = put_contracts[0].strike short_strangle = OptionStrategies.short_strangle(self.symbol, call_strike, put_strike, expiry) self.buy(short_strangle, 1)