Overall Statistics |
Total Orders 4 Average Win 0% Average Loss -2.34% Compounding Annual Return 11.544% Drawdown 7.200% Expectancy -0.5 Start Equity 100000 End Equity 102751 Net Profit 2.751% Sharpe Ratio 0.593 Sortino Ratio 0.544 Probabilistic Sharpe Ratio 42.918% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 0 Alpha -0.008 Beta 1.053 Annual Standard Deviation 0.12 Annual Variance 0.014 Information Ratio -0.037 Tracking Error 0.101 Treynor Ratio 0.068 Total Fees $2.00 Estimated Strategy Capacity $4000.00 Lowest Capacity Asset GOOCV VP83T1ZUHROL Portfolio Turnover 0.92% |
# region imports from AlgorithmImports import * # endregion class LongStraddleAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2017, 4, 1) self.set_end_date(2017, 6, 30) self.set_cash(100000) option = self.add_option("GOOG") self.symbol = option.symbol option.set_filter(-1, 1, 30, 60) def on_data(self, slice: Slice) -> None: if self.portfolio.invested: return chain = slice.option_chains.get(self.symbol, None) if not chain: return # Find ATM options with the nearest expiry expiry = min([x.expiry for x in chain]) contracts = sorted([x for x in chain if x.expiry == expiry], key=lambda x: abs(chain.underlying.price - x.strike)) if len(contracts) < 2: return # The first two contracts are the ATM Call and the ATM Put contracts = contracts[0:2] long_straddle = OptionStrategies.straddle(self.symbol, contracts[0].strike, expiry) self.buy(long_straddle, 1)