Overall Statistics |
Total Orders 4 Average Win 0% Average Loss 0% Compounding Annual Return -0.774% Drawdown 0.200% Expectancy 0 Start Equity 500000 End Equity 499694.8 Net Profit -0.061% Sharpe Ratio 0.149 Sortino Ratio 0.099 Probabilistic Sharpe Ratio 58.582% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.041 Beta -0.075 Annual Standard Deviation 0.008 Annual Variance 0 Information Ratio -7.804 Tracking Error 0.069 Treynor Ratio -0.015 Total Fees $5.20 Estimated Strategy Capacity $3500000.00 Lowest Capacity Asset GOOCV WIQJ61J2NVQE|GOOCV VP83T1ZUHROL Portfolio Turnover 0.06% |
#region imports from AlgorithmImports import * #endregion class IronCondorAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2017, 2, 1) self.set_end_date(2017, 3, 1) self.set_cash(500000) option = self.add_option("GOOG") self.symbol = option.symbol option.set_filter(lambda universe: universe.include_weeklys().strikes(-15, 15).expiration(0, 40)) # use the underlying equity GOOG as the benchmark self.set_benchmark(self.symbol.underlying) def on_data(self,slice): # If there is underlying assets in portfolio at expiration, liquidate the stocks in order to roll into new contracts if self.portfolio[self.symbol.underlying].invested: self.liquidate() if self.portfolio.invested or not self.is_market_open(self.symbol): return chain = slice.option_chains.get(self.symbol) if not chain: return # Find put and call contracts with the farthest expiry expiry = max([x.expiry for x in chain]) chain = sorted([x for x in chain if x.expiry == expiry], key = lambda x: x.strike) put_contracts = [x for x in chain if x.right == OptionRight.PUT] call_contracts = [x for x in chain if x.right == OptionRight.CALL] if len(call_contracts) < 10 or len(put_contracts) < 10: return # Select the strikes in the strategy legs far_put = put_contracts[0].strike near_put = put_contracts[10].strike near_call = call_contracts[-10].strike far_call = call_contracts[-1].strike iron_condor = OptionStrategies.iron_condor( self.symbol, far_put, near_put, near_call, far_call, expiry) self.buy(iron_condor, 2)