Overall Statistics
Total Trades
2
Average Win
0%
Average Loss
-2.70%
Compounding Annual Return
-10.761%
Drawdown
1.100%
Expectancy
-1
Net Profit
-0.895%
Sharpe Ratio
-6.238
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.263
Beta
9.461
Annual Standard Deviation
0.016
Annual Variance
0
Information Ratio
-7.457
Tracking Error
0.016
Treynor Ratio
-0.01
Total Fees
$0.25
from datetime import timedelta

class BasicTemplateOptionsAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2017, 2, 1)
        self.SetEndDate(2017, 3, 1)
        self.SetCash(100000)

        option = self.AddOption("IBM")
        self.option_symbol = option.Symbol
        option.SetFilter(-10, +10, timedelta(0), timedelta(30))


    def OnData(self,slice):
        if self.Portfolio.Invested: return

        chain = slice.OptionChains.GetValue(self.option_symbol)
        if chain is None:
            return
        contracts = sorted(chain, key = lambda x: x.Strike)
        if len(contracts) == 0: return
        symbol = contracts[-1].Symbol
        if not self.Portfolio.Invested:
            self.MarketOrder(symbol, 1)
 

    def OnOrderEvent(self, orderEvent):
        self.Debug("IBM Price "+str(self.Securities["IBM"].Price))
        self.Log(str(orderEvent))