Skip to content

Commit

Permalink
Add QCAlgorithm helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisSzeto committed Jan 6, 2024
1 parent d2f3d75 commit e8b60b1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Algorithm/QCAlgorithm.Indicators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,25 @@ public Identity Identity(Symbol symbol, TimeSpan resolution, Func<IBaseData, dec
return identity;
}

/// <summary>
/// Creates a new ImpliedVolatility indicator for the symbol The indicator will be automatically
/// updated on the symbol's subscription resolution
/// </summary>
/// <param name="symbol">The option symbol whose values we want as an indicator</param>
/// <param name="riskFreeRate">The risk free rate</param>
/// <param name="period">The lookback period of historical volatility</param>
/// <param name="resolution">The desired resolution of the data</param>
/// <returns>A new ImpliedVolatility indicator for the specified symbol</returns>
[DocumentationAttribute(Indicators)]
public ImpliedVolatility IV(Symbol symbol, decimal riskFreeRate = 0.05m, int period = 252, Resolution? resolution = null)
{
var name = CreateIndicatorName(symbol, $"KER({period})", resolution);
var iv = new ImpliedVolatility(name, symbol, riskFreeRate, period);
RegisterIndicator(symbol, iv, ResolveConsolidator(symbol, resolution));
RegisterIndicator(symbol.Underlying, iv, ResolveConsolidator(symbol, resolution));
return iv;
}

/// <summary>
/// Creates a new KaufmanAdaptiveMovingAverage indicator.
/// </summary>
Expand Down

0 comments on commit e8b60b1

Please sign in to comment.