RiskAdjustedRatioParameter

StockSharp.Algo.Statistics

Базовый класс для коэффициентов, скорректированных с учетом риска (Шарп/Сортино).

Наследует: BasePnLStatisticParameter<decimal>

Реализует: IRiskFreeRateStatisticParameter, IBeginValueStatisticParameter

Конструкторы

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

Инициализирует новый экземпляр класса RiskAdjustedRatioParameter.

type
Тип

Свойства

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

The initial value of the parameter.

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

Период обратного расчета.

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

Годовая безрисковая ставка (e.g, 0,03 = 3%).

Методы

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

Чтобы добавить новые данные в параметр.

marketTime
Время обмена.
pnl
Значение прибыли-убытка.
commission
Комиссия.
AddRiskSample
protected abstract void AddRiskSample(decimal ret, long count)
riskAdjustedRatioParameter.AddRiskSample(ret, count)

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

ret
The return value.
count
How many periods earned it.
AddSample
private bool AddSample(decimal start, decimal level, long count)
result = riskAdjustedRatioParameter.AddSample(start, level, count)

Records periods that opened on and closed on .

start
The PnL level the periods opened on.
level
The PnL level they closed on.
count
How many periods earned that return.

Возвращает: if the return was recorded; if there was no capital to measure it against.

ClosePeriods
private bool ClosePeriods(long target, decimal level)
result = riskAdjustedRatioParameter.ClosePeriods(target, level)

Closes every grid boundary up to on the given PnL level.

target
The number of boundaries the grid is to have closed.
level
The PnL level those boundaries close on.

Возвращает: if every closed period produced a return; if any of them had no capital to measure a return against.

GetRisk
protected abstract decimal GetRisk(long 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.

Возвращает: Risk value.

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

Checks if enough risk samples accumulated for calculation.

count
Count of samples.

Возвращает: Check result.

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

To load the state of statistic parameter.

storage
Storage.
cancellationToken
CancellationToken

Возвращает: Task

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

Сбросить состояние.

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

To save the state of statistic parameter.

storage
Storage.
cancellationToken
CancellationToken

Возвращает: Task

SetPeriod
private void SetPeriod(TimeSpan value)
riskAdjustedRatioParameter.SetPeriod(value)

Sets Period without the open-grid check, for restoring a state that was saved with it.

value
Return calculation period.