RiskAdjustedRatioParameter

StockSharp.Algo.Statistics

Base class for risk-adjusted ratios (Sharpe/Sortino).

Inherits: BasePnLStatisticParameter<decimal>

Implements: IRiskFreeRateStatisticParameter

Constructors

RiskAdjustedRatioParameter
protected RiskAdjustedRatioParameter(StatisticParameterTypes type)
riskAdjustedRatioParameter = RiskAdjustedRatioParameter(type)

Initializes a new instance of the RiskAdjustedRatioParameter class.

type
Type

Properties

Period
public TimeSpan Period { get; set; }
value = riskAdjustedRatioParameter.Period
riskAdjustedRatioParameter.Period = value

Return calculation period.

RiskFreeRate
public decimal RiskFreeRate { get; set; }
value = riskAdjustedRatioParameter.RiskFreeRate
riskAdjustedRatioParameter.RiskFreeRate = value

Annual risk-free rate (e.g., 0.03 = 3%).

Methods

Add
public override void Add(DateTime marketTime, decimal pnl, decimal? commission)
riskAdjustedRatioParameter.Add(marketTime, pnl, commission)

To add new data to the parameter.

marketTime
The exchange time.
pnl
The profit-loss value.
commission
Commission.
AddRiskSample
protected abstract void AddRiskSample(decimal ret)
riskAdjustedRatioParameter.AddRiskSample(ret)

Adds a new sample to the risk accumulator.

ret
The return value.
GetRisk
protected abstract decimal GetRisk(int count, decimal sumReturn)
result = riskAdjustedRatioParameter.GetRisk(count, sumReturn)

Gets the risk value (e.g., stddev or downside deviation).

count
Count of samples.
sumReturn
Sum of all returns.

Returns: Risk value.

HasEnoughRiskSamples
protected abstract bool HasEnoughRiskSamples(int count)
result = riskAdjustedRatioParameter.HasEnoughRiskSamples(count)

Checks if enough risk samples accumulated for calculation.

count
Count of samples.

Returns: Check result.

Load
public override void Load(SettingsStorage storage)
riskAdjustedRatioParameter.Load(storage)

To load the state of statistic parameter.

storage
Storage.
Reset
public override void Reset()
riskAdjustedRatioParameter.Reset()

To reset the parameter value.

Save
public override void Save(SettingsStorage storage)
riskAdjustedRatioParameter.Save(storage)

To save the state of statistic parameter.

storage
Storage.