Lean  $LEAN_TAG$
QuantConnect.Indicators.SharpeRatio Class Reference

Calculation of the Sharpe Ratio (SR) developed by William F. Sharpe. More...

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

Public Member Functions

 SharpeRatio (string name, int period, IRiskFreeInterestRateModel riskFreeRateModel)
 Creates a new Sharpe Ratio indicator using the specified periods More...
 
 SharpeRatio (int period, IRiskFreeInterestRateModel riskFreeRateModel)
 Creates a new Sharpe Ratio indicator using the specified periods More...
 
 SharpeRatio (string name, int period, PyObject riskFreeRateModel)
 Creates a new Sharpe Ratio indicator using the specified period using a Python risk free rate model More...
 
 SharpeRatio (int period, PyObject riskFreeRateModel)
 Creates a new Sharpe Ratio indicator using the specified period using a Python risk free rate model More...
 
 SharpeRatio (string name, int period, decimal riskFreeRate=0.0m)
 Creates a new Sharpe Ratio indicator using the specified periods More...
 
 SharpeRatio (int period, decimal riskFreeRate=0.0m)
 Creates a new SharpeRatio indicator using the specified periods More...
 
override void Reset ()
 Resets this indicator to its initial state More...
 

Public Attributes

override bool IsReady => Ratio.Samples > _period
 Returns whether the indicator is properly initialized with data More...
 

Protected Member Functions

override decimal ComputeNextValue (IndicatorDataPoint input)
 Computes the next value for this indicator from the given state. More...
 

Properties

RateOfChange RateOfChange [get]
 RateOfChange indicator for calculating the sharpe ratio More...
 
Identity RiskFreeRate [get]
 RiskFreeRate indicator for calculating the sharpe ratio More...
 
IndicatorBase Ratio [get, set]
 Indicator to store the calculation of the sharpe ratio More...
 
IndicatorBase Numerator [get]
 Indicator to store the numerator of the Sharpe ratio calculation More...
 
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 
- Properties inherited from QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 

Detailed Description

Calculation of the Sharpe Ratio (SR) developed by William F. Sharpe.

Reference: https://www.investopedia.com/articles/07/sharpe_ratio.asp Formula: S(x) = (Rx - Rf) / stdDev(Rx) Where: S(x) - sharpe ratio of x Rx - average rate of return for x Rf - risk-free rate

Definition at line 32 of file SharpeRatio.cs.

Constructor & Destructor Documentation

◆ SharpeRatio() [1/6]

QuantConnect.Indicators.SharpeRatio.SharpeRatio ( string  name,
int  period,
IRiskFreeInterestRateModel  riskFreeRateModel 
)

Creates a new Sharpe Ratio indicator using the specified periods

Parameters
nameThe name of this indicator
periodPeriod of historical observation for sharpe ratio calculation
riskFreeRateModelRisk-free rate model

Definition at line 80 of file SharpeRatio.cs.

◆ SharpeRatio() [2/6]

QuantConnect.Indicators.SharpeRatio.SharpeRatio ( int  period,
IRiskFreeInterestRateModel  riskFreeRateModel 
)

Creates a new Sharpe Ratio indicator using the specified periods

Parameters
periodPeriod of historical observation for sharpe ratio calculation
riskFreeRateModelRisk-free rate model

Definition at line 103 of file SharpeRatio.cs.

◆ SharpeRatio() [3/6]

QuantConnect.Indicators.SharpeRatio.SharpeRatio ( string  name,
int  period,
PyObject  riskFreeRateModel 
)

Creates a new Sharpe Ratio indicator using the specified period using a Python risk free rate model

Parameters
periodPeriod of historical observation for sharpe ratio calculation
riskFreeRateModelRisk-free rate model

Definition at line 113 of file SharpeRatio.cs.

◆ SharpeRatio() [4/6]

QuantConnect.Indicators.SharpeRatio.SharpeRatio ( int  period,
PyObject  riskFreeRateModel 
)

Creates a new Sharpe Ratio indicator using the specified period using a Python risk free rate model

Parameters
periodPeriod of historical observation for sharpe ratio calculation
riskFreeRateModelRisk-free rate model

Definition at line 123 of file SharpeRatio.cs.

◆ SharpeRatio() [5/6]

QuantConnect.Indicators.SharpeRatio.SharpeRatio ( string  name,
int  period,
decimal  riskFreeRate = 0.0m 
)

Creates a new Sharpe Ratio indicator using the specified periods

Parameters
nameThe name of this indicator
periodPeriod of historical observation for sharpe ratio calculation
riskFreeRateRisk-free rate for sharpe ratio calculation

Definition at line 134 of file SharpeRatio.cs.

◆ SharpeRatio() [6/6]

QuantConnect.Indicators.SharpeRatio.SharpeRatio ( int  period,
decimal  riskFreeRate = 0.0m 
)

Creates a new SharpeRatio indicator using the specified periods

Parameters
periodPeriod of historical observation for sharpe ratio calculation
riskFreeRateRisk-free rate for sharpe ratio calculation

Definition at line 144 of file SharpeRatio.cs.

Member Function Documentation

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.SharpeRatio.ComputeNextValue ( IndicatorDataPoint  input)
protected

Computes the next value for this indicator from the given state.

Parameters
inputThe input given to the indicator
Returns
A new value for this indicator

Definition at line 154 of file SharpeRatio.cs.

◆ Reset()

override void QuantConnect.Indicators.SharpeRatio.Reset ( )

Resets this indicator to its initial state

Definition at line 164 of file SharpeRatio.cs.

Here is the call graph for this function:

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.SharpeRatio.IsReady => Ratio.Samples > _period

Returns whether the indicator is properly initialized with data

Definition at line 72 of file SharpeRatio.cs.

Property Documentation

◆ RateOfChange

RateOfChange QuantConnect.Indicators.SharpeRatio.RateOfChange
getprotected

RateOfChange indicator for calculating the sharpe ratio

Definition at line 47 of file SharpeRatio.cs.

◆ RiskFreeRate

Identity QuantConnect.Indicators.SharpeRatio.RiskFreeRate
getprotected

RiskFreeRate indicator for calculating the sharpe ratio

Definition at line 52 of file SharpeRatio.cs.

◆ Ratio

IndicatorBase QuantConnect.Indicators.SharpeRatio.Ratio
getsetprotected

Indicator to store the calculation of the sharpe ratio

Definition at line 57 of file SharpeRatio.cs.

◆ Numerator

IndicatorBase QuantConnect.Indicators.SharpeRatio.Numerator
getprotected

Indicator to store the numerator of the Sharpe ratio calculation

Definition at line 62 of file SharpeRatio.cs.

◆ WarmUpPeriod

int QuantConnect.Indicators.SharpeRatio.WarmUpPeriod
get

Required period, in data points, for the indicator to be ready and fully initialized.

Definition at line 67 of file SharpeRatio.cs.


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