| Overall Statistics |
|
Total Trades 2 Average Win 0% Average Loss 0% Compounding Annual Return 6.361% Drawdown 0.600% Expectancy 0 Net Profit 0.486% Sharpe Ratio 1.073 Sortino Ratio 1.026 Probabilistic Sharpe Ratio 75.361% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.005 Beta -0.104 Annual Standard Deviation 0.025 Annual Variance 0.001 Information Ratio 1.681 Tracking Error 0.138 Treynor Ratio -0.257 Total Fees $2.00 Estimated Strategy Capacity $5100000.00 Lowest Capacity Asset GOOCV Y6URRG5V0U06|GOOCV VP83T1ZUHROL Portfolio Turnover 0.03% |
# region imports
from AlgorithmImports import *
# endregion
class HyperActiveOrangeHippopotamus(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2023, 2, 3)
self.SetEndDate(2023, 3, 3)
self.SetCash(100000)
option = self.AddOption("GOOG", Resolution.Minute)
self.symbol = option.Symbol
option.SetFilter(lambda universe: universe.Strikes(-10, 10).Expiration(30, 45))
self.itm_call = None
self.otm_call = None
def OnData(self, data: Slice):
# Get the OptionChain
chain = data.OptionChains.get(self.symbol, None)
if not chain: return
if self.itm_call is None:
# Get the furthest expiry date of the contracts
expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
# Select the ITM call with the lowest strike
itm_calls = [c for c in chain if c.Expiry == expiry and c.Right == OptionRight.Call and c.Strike < chain.Underlying.Price]
if len(itm_calls) == 0: return
self.itm_call = sorted(itm_calls, key=lambda x: x.Strike)[0]
# Sell an ITM call
self.MarketOrder(self.itm_call.Symbol, -1)
if self.otm_call is None and self.Time.day > 13:
# Select the OTM call with the highest strike
otm_calls = [c for c in chain if c.Expiry == self.itm_call.Expiry and c.Right == OptionRight.Call and c.Strike > chain.Underlying.Price and c.Strike > self.itm_call.Strike]
if len(otm_calls) == 0: return
self.otm_call = sorted(otm_calls, key=lambda x: x.Strike)[-1]
# Buy an OTM call
self.MarketOrder(self.otm_call.Symbol, 1)