Overall Statistics
Total Orders
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
100000
End Equity
100067.7
Net Profit
0%
Sharpe Ratio
0
Sortino Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$2.30
Estimated Strategy Capacity
$49000.00
Lowest Capacity Asset
MSFT YLSDUHMXEI2U|MSFT R735QTJ8XC9X
Portfolio Turnover
1.57%
# region imports
from AlgorithmImports import *
# endregion

class BearCallLadderOptionStrategy(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2024, 8, 14)
        self.set_end_date(2024, 8, 16)
        self.set_cash(100000)
        
        option = self.add_option("MSFT", Resolution.MINUTE)
        self._symbol = option.symbol

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

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

        # Get the OptionChain
        chain = slice.option_chains.get(self._symbol)
        if not chain:
            return
        calls = sorted(chain, key=lambda x: x.strike)
        legs = [  Leg.create(calls[0].symbol, -1), Leg.create(calls[1].symbol, 2) ]
        
        self.combo_market_order(legs, 1)