Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
17.290%
Drawdown
16.600%
Expectancy
0
Net Profit
27.278%
Sharpe Ratio
0.543
Sortino Ratio
0.735
Probabilistic Sharpe Ratio
39.026%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0
Beta
0.993
Annual Standard Deviation
0.141
Annual Variance
0.02
Information Ratio
-0.894
Tracking Error
0.001
Treynor Ratio
0.077
Total Fees
$1.35
Estimated Strategy Capacity
$500000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
0.18%
# region imports
from AlgorithmImports import *
# endregion

class CustomVolatilityModelAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 7, 1)
        self.SetCash(100000)
        security = self.AddEquity("SPY", Resolution.Daily)
        security.VolatilityModel = MyVolatilityModel()

    def OnData(self, data: Slice):
        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)


class MyVolatilityModel(BaseVolatilityModel):
    Volatility: float = 0

    def SetSubscriptionDataConfigProvider(self,
         subscriptionDataConfigProvider: ISubscriptionDataConfigProvider) -> None:
        SubscriptionDataConfigProvider = subscriptionDataConfigProvider

    def Update(self, security: Security, data: BaseData) -> None:
        pass

    def GetHistoryRequirements(self,
         security: Security,
         utcTime: datetime,
         resolution: Resolution = None,
         barCount: int = None) -> List[HistoryRequest]:
        return super().GetHistoryRequirements(security, utcTime, resolution, barCount)