SharpeRatioParameter

StockSharp.Algo.Statistics

Sharpe ratio (annualized return - risk-free rate / annualized standard deviation).

Inherits: RiskAdjustedRatioParameter

Constructors

SharpeRatioParameter
public SharpeRatioParameter()
sharpeRatioParameter = SharpeRatioParameter()

Initialize a new instance of the SharpeRatioParameter class.

Methods

AddRiskSample
protected override void AddRiskSample(decimal ret, long count)
sharpeRatioParameter.AddRiskSample(ret, count)

Adds consecutive periods of the same return to the risk accumulator.

ret
The return value.
count
How many periods earned it.
GetRisk
protected override decimal GetRisk(long count, decimal sumReturn)
result = sharpeRatioParameter.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 override bool HasEnoughRiskSamples(long count)
result = sharpeRatioParameter.HasEnoughRiskSamples(count)

Checks if enough risk samples accumulated for calculation.

count
Count of samples.

Returns: Check result.

LoadAsync
public override Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = sharpeRatioParameter.LoadAsync(storage, cancellationToken)

To load the state of statistic parameter.

storage
Storage.
cancellationToken
CancellationToken

Returns: Task

Reset
public override void Reset()
sharpeRatioParameter.Reset()

To reset the parameter value.

SaveAsync
public override Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = sharpeRatioParameter.SaveAsync(storage, cancellationToken)

To save the state of statistic parameter.

storage
Storage.
cancellationToken
CancellationToken

Returns: Task