Overall Statistics
Total Orders
3
Average Win
0%
Average Loss
0%
Compounding Annual Return
-14.575%
Drawdown
1.000%
Expectancy
0
Start Equity
100000
End Equity
99112
Net Profit
-0.888%
Sharpe Ratio
-2.92
Sortino Ratio
-2.392
Probabilistic Sharpe Ratio
10.520%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.132
Beta
-0.15
Annual Standard Deviation
0.041
Annual Variance
0.002
Information Ratio
-0.609
Tracking Error
0.078
Treynor Ratio
0.802
Total Fees
$3.00
Estimated Strategy Capacity
$8700000.00
Lowest Capacity Asset
GOOCV WK9O88F8EXFQ|GOOCV VP83T1ZUHROL
Portfolio Turnover
0.29%
# region imports
from AlgorithmImports import *
# endregion

class BullCallLadderOptionStrategy(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2017, 4, 1)
        self.set_end_date(2017, 4, 23)
        self.set_cash(100000)
        
        option = self.add_option("GOOG", Resolution.MINUTE)
        self._symbol = option.symbol

        # set our strike/expiry filter for this option chain
        option.set_filter(lambda x: x.include_weeklys().call_ladder(30, 5, 0, -5))

    def on_data(self, slice):
        if self.portfolio.invested:
            return

        # Get the OptionChain
        chain = slice.option_chains.get(self._symbol, None)
        if not chain:
            return
        
        # Select the call Option contracts with the furthest expiry
        expiry = max([x.expiry for x in chain])
        calls = [i for i in chain if i.expiry == expiry and i.right == OptionRight.CALL]
        if not calls:
            return

        # Select the strike prices from the remaining contracts
        strikes = sorted(set(x.strike for x in calls))
        if len(strikes) < 3:
            return
        
        low_strike = strikes[0]
        middle_strike = strikes[1]
        high_strike = strikes[2]
    
        option_strategy = OptionStrategies.bull_call_ladder(self._symbol, low_strike, middle_strike, high_strike, expiry)
        self.buy(option_strategy, 1)