Overall Statistics |
Total Orders 8 Average Win 0.33% Average Loss -0.15% Compounding Annual Return 3.555% Drawdown 0.700% Expectancy -0.192 Start Equity 100000 End Equity 100563 Net Profit 0.563% Sharpe Ratio 1.44 Sortino Ratio 1.321 Probabilistic Sharpe Ratio 67.895% Loss Rate 75% Win Rate 25% Profit-Loss Ratio 2.23 Alpha 0.019 Beta 0.062 Annual Standard Deviation 0.012 Annual Variance 0 Information Ratio 0.372 Tracking Error 0.127 Treynor Ratio 0.277 Total Fees $6.00 Estimated Strategy Capacity $990000.00 Lowest Capacity Asset IBM VOBM1Z09FM2U|IBM R735QTJ8XC9X Portfolio Turnover 1.56% |
#region imports from AlgorithmImports import * #endregion class CoveredCallAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2014, 1, 1) self.set_end_date(2014, 3, 1) self.set_cash(100000) option = self.add_option("IBM") self.symbol = option.symbol option.set_filter(-3, 3, 0, 31) self.call = None # use the underlying equity as the benchmark self.set_benchmark(self.symbol.underlying) def on_data(self, slice): if self.call and self.portfolio[self.call].invested: return chain = slice.option_chains.get(self.symbol) if not chain: return # Find ATM call with the farthest expiry expiry = max([x.expiry for x in chain]) call_contracts = sorted([x for x in chain if x.right == OptionRight.CALL and x.expiry == expiry], key=lambda x: abs(chain.underlying.price - x.strike)) if not call_contracts: return atm_call = call_contracts[0] covered_call = OptionStrategies.covered_call(self.symbol, atm_call.strike, expiry) self.buy(covered_call, 1) self.call = atm_call.symbol