Class RiskAdjustedRatioParameter
- Namespace
- StockSharp.Algo.Statistics
- Assembly
- StockSharp.Algo.dll
Base class for risk-adjusted ratios (Sharpe/Sortino).
public abstract class RiskAdjustedRatioParameter : BasePnLStatisticParameter<decimal>, INotifyPropertyChangedEx, INotifyPropertyChanging, IStatisticParameter<decimal>, IPnLStatisticParameter, IStatisticParameter, IPersistable, INotifyPropertyChanged, IRiskFreeRateStatisticParameter
- Inheritance
-
RiskAdjustedRatioParameter
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
RiskAdjustedRatioParameter(StatisticParameterTypes)
Initializes a new instance of the RiskAdjustedRatioParameter class.
protected RiskAdjustedRatioParameter(StatisticParameterTypes type)
Parameters
Properties
Period
Return calculation period.
public TimeSpan Period { get; set; }
Property Value
RiskFreeRate
Annual risk-free rate (e.g., 0.03 = 3%).
public decimal RiskFreeRate { get; set; }
Property Value
Methods
Add(DateTimeOffset, decimal, decimal?)
To add new data to the parameter.
public override void Add(DateTimeOffset marketTime, decimal pnl, decimal? commission)
Parameters
marketTimeDateTimeOffsetThe exchange time.
pnldecimalThe profit-loss value.
commissiondecimal?Commission.
AddRiskSample(decimal)
Adds a new sample to the risk accumulator.
protected abstract void AddRiskSample(decimal ret)
Parameters
retdecimalThe return value.
GetRisk(int, decimal)
Gets the risk value (e.g., stddev or downside deviation).
protected abstract decimal GetRisk(int count, decimal sumReturn)
Parameters
Returns
- decimal
Risk value.
HasEnoughRiskSamples(int)
Checks if enough risk samples accumulated for calculation.
protected abstract bool HasEnoughRiskSamples(int count)
Parameters
countintCount of samples.
Returns
- bool
Check result.
Load(SettingsStorage)
To load the state of statistic parameter.
public override void Load(SettingsStorage storage)
Parameters
storageSettingsStorageStorage.
Reset()
To reset the parameter value.
public override void Reset()
Save(SettingsStorage)
To save the state of statistic parameter.
public override void Save(SettingsStorage storage)
Parameters
storageSettingsStorageStorage.