Lean  $LEAN_TAG$
QuantConnect.Indicators.Beta Class Reference

In technical analysis Beta indicator is used to measure volatility or risk of a target (ETF) relative to the overall risk (volatility) of the reference (market indexes). The Beta indicators compares target's price movement to the movements of the indexes over the same period of time. More...

Inheritance diagram for QuantConnect.Indicators.Beta:
[legend]

Public Member Functions

 Beta (string name, Symbol targetSymbol, Symbol referenceSymbol, int period)
 Creates a new Beta indicator with the specified name, target, reference,
and period values More...
 
 Beta (Symbol targetSymbol, Symbol referenceSymbol, int period)
 Creates a new Beta indicator with the specified target, reference,
and period values More...
 
 Beta (string name, int period, Symbol targetSymbol, Symbol referenceSymbol)
 Creates a new Beta indicator with the specified name, period, target and reference values More...
 
override void Reset ()
 Resets this indicator to its initial state More...
 
- Public Member Functions inherited from QuantConnect.Indicators.DualSymbolIndicator< decimal >
override void Reset ()
 Resets this indicator to its initial state More...
 

Public Attributes

override bool IsReady => _targetReturns.IsReady && _referenceReturns.IsReady
 Gets a flag indicating when the indicator is ready and fully initialized More...
 

Protected Member Functions

override void AddDataPoint (IBaseDataBar input)
 Adds the closing price to the corresponding symbol's data set (target or reference). Computes returns when there are enough data points for each symbol. More...
 
override void ComputeIndicator ()
 Computes the beta value of the target in relation with the reference using the target and reference returns More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.DualSymbolIndicator< decimal >
 DualSymbolIndicator (string name, Symbol targetSymbol, Symbol referenceSymbol, int period)
 Initializes the dual symbol indicator. More...
 
override decimal ComputeNextValue (IBaseDataBar input)
 Checks and computes the indicator if the input data matches. This method ensures the input data points are from matching time periods and different symbols. More...
 
abstract void AddDataPoint (IBaseDataBar input)
 Adds the closing price to the corresponding symbol's data set (target or reference). This method stores the data points for each symbol and performs specific calculations based on the symbol. For instance, it computes returns in the case of the Beta indicator. More...
 

Additional Inherited Members

- Properties inherited from QuantConnect.Indicators.DualSymbolIndicator< decimal >
RollingWindow< T > TargetDataPoints [get]
 RollingWindow to store the data points of the target symbol More...
 
RollingWindow< T > ReferenceDataPoints [get]
 RollingWindow to store the data points of the reference symbol More...
 
Symbol ReferenceSymbol [get]
 Symbol of the reference used More...
 
Symbol TargetSymbol [get]
 Symbol of the target used More...
 
bool IsTimezoneDifferent [get]
 Indicates if the time zone for the target and reference are different. More...
 
decimal IndicatorValue [get, set]
 The most recently computed value of the indicator. More...
 
int WarmUpPeriod [get, set]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 

Detailed Description

In technical analysis Beta indicator is used to measure volatility or risk of a target (ETF) relative to the overall risk (volatility) of the reference (market indexes). The Beta indicators compares target's price movement to the movements of the indexes over the same period of time.

It is common practice to use the SPX index as a benchmark of the overall reference market when it comes to Beta calculations.

The indicator only updates when both assets have a price for a time step. When a bar is missing for one of the assets, the indicator value fills forward to improve the accuracy of the indicator.

Definition at line 33 of file Beta.cs.

Constructor & Destructor Documentation

◆ Beta() [1/3]

QuantConnect.Indicators.Beta.Beta ( string  name,
Symbol  targetSymbol,
Symbol  referenceSymbol,
int  period 
)

Creates a new Beta indicator with the specified name, target, reference,
and period values

Parameters
nameThe name of this indicator
targetSymbolThe target symbol of this indicator
periodThe period of this indicator
referenceSymbolThe reference symbol of this indicator

Definition at line 58 of file Beta.cs.

◆ Beta() [2/3]

QuantConnect.Indicators.Beta.Beta ( Symbol  targetSymbol,
Symbol  referenceSymbol,
int  period 
)

Creates a new Beta indicator with the specified target, reference,
and period values

Parameters
targetSymbolThe target symbol of this indicator
periodThe period of this indicator
referenceSymbolThe reference symbol of this indicator

Definition at line 79 of file Beta.cs.

◆ Beta() [3/3]

QuantConnect.Indicators.Beta.Beta ( string  name,
int  period,
Symbol  targetSymbol,
Symbol  referenceSymbol 
)

Creates a new Beta indicator with the specified name, period, target and reference values

Parameters
nameThe name of this indicator
periodThe period of this indicator
targetSymbolThe target symbol of this indicator
referenceSymbolThe reference symbol of this indicator

Constructor overload for backward compatibility.

Definition at line 93 of file Beta.cs.

Member Function Documentation

◆ AddDataPoint()

override void QuantConnect.Indicators.Beta.AddDataPoint ( IBaseDataBar  input)
protected

Adds the closing price to the corresponding symbol's data set (target or reference). Computes returns when there are enough data points for each symbol.

Parameters
inputThe input value for this symbol

Definition at line 103 of file Beta.cs.

◆ ComputeIndicator()

override void QuantConnect.Indicators.Beta.ComputeIndicator ( )
protectedvirtual

Computes the beta value of the target in relation with the reference using the target and reference returns

Implements QuantConnect.Indicators.DualSymbolIndicator< decimal >.

Definition at line 142 of file Beta.cs.

◆ Reset()

override void QuantConnect.Indicators.Beta.Reset ( )

Resets this indicator to its initial state

Definition at line 156 of file Beta.cs.

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.Beta.IsReady => _targetReturns.IsReady && _referenceReturns.IsReady

Gets a flag indicating when the indicator is ready and fully initialized

Definition at line 48 of file Beta.cs.


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