Lean  $LEAN_TAG$
QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel Class Reference

Provides an implementation of IVolatilityModel that computes the annualized sample standard deviation of daily returns as the volatility of the security More...

Inheritance diagram for QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel:
[legend]

Public Member Functions

 StandardDeviationOfReturnsVolatilityModel (int periods, Resolution? resolution=null, TimeSpan? updateFrequency=null)
 Initializes a new instance of the StandardDeviationOfReturnsVolatilityModel class More...
 
 StandardDeviationOfReturnsVolatilityModel (Resolution resolution, TimeSpan? updateFrequency=null)
 Initializes a new instance of the StandardDeviationOfReturnsVolatilityModel class More...
 
override void Update (Security security, BaseData data)
 Updates this model using the new price information in the specified security instance More...
 
override IEnumerable< HistoryRequestGetHistoryRequirements (Security security, DateTime utcTime)
 Returns history requirements for the volatility model expressed in the form of history request More...
 
- Public Member Functions inherited from QuantConnect.Securities.Volatility.BaseVolatilityModel
virtual void SetSubscriptionDataConfigProvider (ISubscriptionDataConfigProvider subscriptionDataConfigProvider)
 Sets the ISubscriptionDataConfigProvider instance to use. More...
 
IEnumerable< HistoryRequestGetHistoryRequirements (Security security, DateTime utcTime, Resolution? resolution, int barCount)
 Gets history requests required for warming up the greeks with the provided resolution More...
 

Properties

override decimal Volatility [get]
 Gets the volatility of the security as a percentage More...
 
- Properties inherited from QuantConnect.Securities.Volatility.BaseVolatilityModel
ISubscriptionDataConfigProvider SubscriptionDataConfigProvider [get, set]
 Provides access to registered SubscriptionDataConfig More...
 
virtual decimal Volatility [get]
 Gets the volatility of the security as a percentage More...
 
- Properties inherited from QuantConnect.Securities.IVolatilityModel
decimal Volatility [get]
 Gets the volatility of the security as a percentage More...
 

Detailed Description

Provides an implementation of IVolatilityModel that computes the annualized sample standard deviation of daily returns as the volatility of the security

Definition at line 31 of file StandardDeviationOfReturnsVolatilityModel.cs.

Constructor & Destructor Documentation

◆ StandardDeviationOfReturnsVolatilityModel() [1/2]

QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel.StandardDeviationOfReturnsVolatilityModel ( int  periods,
Resolution resolution = null,
TimeSpan?  updateFrequency = null 
)

Initializes a new instance of the StandardDeviationOfReturnsVolatilityModel class

Parameters
periodsThe max number of samples in the rolling window to be considered for calculating the standard deviation of returns
resolutionResolution of the price data inserted into the rolling window series to calculate standard deviation. Will be used as the default value for update frequency if a value is not provided for updateFrequency . This only has a material effect in live mode. For backtesting, this value does not cause any behavioral changes.
updateFrequencyFrequency at which we insert new values into the rolling window for the standard deviation calculation

The volatility model will be updated with the most granular/highest resolution data that was added to your algorithm. That means that if I added Resolution.Tick data for my Futures strategy, that this model will be updated using Resolution.Tick data as the algorithm progresses in time.

Keep this in mind when setting the period and update frequency. The Resolution parameter is only used for live mode, or for the default value of the updateFrequency if no value is provided.

Definition at line 86 of file StandardDeviationOfReturnsVolatilityModel.cs.

◆ StandardDeviationOfReturnsVolatilityModel() [2/2]

QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel.StandardDeviationOfReturnsVolatilityModel ( Resolution  resolution,
TimeSpan?  updateFrequency = null 
)

Initializes a new instance of the StandardDeviationOfReturnsVolatilityModel class

Parameters
resolutionResolution of the price data inserted into the rolling window series to calculate standard deviation. Will be used as the default value for update frequency if a value is not provided for updateFrequency . This only has a material effect in live mode. For backtesting, this value does not cause any behavioral changes.
updateFrequencyFrequency at which we insert new values into the rolling window for the standard deviation calculation

The volatility model will be updated with the most granular/highest resolution data that was added to your algorithm. That means that if I added Resolution.Tick data for my Futures strategy, that this model will be updated using Resolution.Tick data as the algorithm progresses in time.

Keep this in mind when setting the period and update frequency. The Resolution parameter is only used for live mode, or for the default value of the updateFrequency if no value is provided.

Definition at line 119 of file StandardDeviationOfReturnsVolatilityModel.cs.

Member Function Documentation

◆ Update()

override void QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel.Update ( Security  security,
BaseData  data 
)
virtual

Updates this model using the new price information in the specified security instance

Parameters
securityThe security to calculate volatility for
dataData to update the volatility model with

Reimplemented from QuantConnect.Securities.Volatility.BaseVolatilityModel.

Definition at line 132 of file StandardDeviationOfReturnsVolatilityModel.cs.

Here is the call graph for this function:

◆ GetHistoryRequirements()

override IEnumerable<HistoryRequest> QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel.GetHistoryRequirements ( Security  security,
DateTime  utcTime 
)
virtual

Returns history requirements for the volatility model expressed in the form of history request

Parameters
securityThe security of the request
utcTimeThe date of the request
Returns
History request object list, or empty if no requirements

Reimplemented from QuantConnect.Securities.Volatility.BaseVolatilityModel.

Definition at line 157 of file StandardDeviationOfReturnsVolatilityModel.cs.

Property Documentation

◆ Volatility

override decimal QuantConnect.Securities.StandardDeviationOfReturnsVolatilityModel.Volatility
get

Gets the volatility of the security as a percentage

Definition at line 46 of file StandardDeviationOfReturnsVolatilityModel.cs.


The documentation for this class was generated from the following file: