Overall Statistics
Total Trades
568
Average Win
8.68%
Average Loss
-1.14%
Compounding Annual Return
25.402%
Drawdown
62.900%
Expectancy
2.932
Net Profit
145.005%
Sharpe Ratio
0.612
Sortino Ratio
0.778
Probabilistic Sharpe Ratio
14.446%
Loss Rate
54%
Win Rate
46%
Profit-Loss Ratio
7.64
Alpha
0.237
Beta
1.037
Annual Standard Deviation
0.522
Annual Variance
0.273
Information Ratio
0.495
Tracking Error
0.484
Treynor Ratio
0.308
Total Fees
$494.73
Estimated Strategy Capacity
$2100000.00
Lowest Capacity Asset
CHV YE4OOBOV3X46|CHV R735QTJ8XC9X
Portfolio Turnover
1.30%
# region imports
from AlgorithmImports import *
# endregion

class CreativeOrangeHyena(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 1, 1)
        self.SetCash(100000)

        self.option = self.AddOption("CVX", Resolution.Daily)
        self.symbol = self.option.Symbol


        self.option.SetFilter(self.UniverseFunc)
        self.invested_dates = {}

        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
        self.AddRiskManagement(NullRiskManagementModel())
    
    def UniverseFunc(self, universe):
        return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(25), timedelta(30))

    
    def OnData(self, slice: Slice) -> None:
        
            chain = slice.OptionChains.get(self.symbol, None)
            if not chain: return
            
            call = [x for x in chain if x.Right == OptionRight.Call]
            OTM_contracts = [x for x in call if x.UnderlyingLastPrice - x.Strike < 0]
            
            if len(OTM_contracts) == 0: return
            
            self.Buy(OTM_contracts[0].Symbol, 1)
            self.Plot("Price Chart", "Bid Price", OTM_contracts[0].BidPrice)
            self.Plot("Price Chart", "Ask Price", OTM_contracts[0].AskPrice)
            self.invested_dates[OTM_contracts[0].Symbol.Value] = self.Time