| Overall Statistics |
|
Total Trades 4 Average Win 2.03% Average Loss 0% Compounding Annual Return -12.545% Drawdown 11.400% Expectancy 0 Net Profit -3.275% Sharpe Ratio -0.584 Probabilistic Sharpe Ratio 17.618% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.028 Beta -1.194 Annual Standard Deviation 0.138 Annual Variance 0.019 Information Ratio -0.954 Tracking Error 0.179 Treynor Ratio 0.067 Total Fees $2.00 Estimated Strategy Capacity $9000.00 Lowest Capacity Asset GOOCV VP83T1ZUHROL Portfolio Turnover 1.02% |
# region imports
from AlgorithmImports import *
# endregion
class LongStraddleAlgorithm(QCAlgorithm):
def Initialize(self) -> None:
self.SetStartDate(2017, 4, 1)
self.SetEndDate(2017, 6, 30)
self.SetCash(100000)
option = self.AddOption("GOOG")
self.symbol = option.Symbol
option.SetFilter(-1, 1, 30, 60)
def OnData(self, slice: Slice) -> None:
if self.Portfolio.Invested:
return
chain = slice.OptionChains.get(self.symbol, None)
if not chain:
return
# Find ATM options with the nearest expiry
expiry = min([x.Expiry for x in chain])
contracts = sorted([x for x in chain if x.Expiry == expiry],
key=lambda x: abs(chain.Underlying.Price - x.Strike))
if len(contracts) < 2:
return
# The first two contracts are the ATM Call and the ATM Put
contracts = contracts[0:2]
short_straddle = OptionStrategies.ShortStraddle(self.symbol, contracts[0].Strike, expiry)
self.Buy(short_straddle, 1)