Dividend Yield
Key Concepts
Introduction
Dividends are periodic payments a company makes to its shareholders out of its earnings. The dividend yield refers to the rate of return an investor earns in the form of dividends from holding a stock.
In the context of Option pricing models, the dividend yield is a critical factor because it affects the value of the underlying stock. When calculating the theoretical price of an Option using these models, the dividend yield is factored into the equation.
Set Models
To set the dividend yield model for an Option indicator, pass a DividendYieldProvider
as the dividendYieldModel
dividend_yield_model
parameter.
public override void Initialize() { // Before creating the indicator, create the set dividend yield model, such that it will use it in default // Using DividendYieldProvider will calculate the continuous dividend yield using all dividend payoffs in 1 year var dividendYieldModel = new DividendYieldProvider(symbol.Underlying); _iv = new ImpliedVolatility(symbol, RiskFreeInterestRateModel, dividendYieldModel, OptionPricingModelType.BlackScholes); }
def initialize(self) -> None: # Before creating the indicator, create the set dividend yield model # Using DividendYieldProvider will calculate the continuous dividend yield using all dividend payoffs in 1 year dividend_yield_model = DividendYieldProvider(symbol.underlying) self.iv = ImpliedVolatility(symbol, self.risk_free_interest_rate_model, dividend_yield_model, OptionPricingModelType.BLACK_SCHOLES)
To view all the pre-built dividend yield models, see Supported Models.
Default Behavior
For US Equity Options, the default dividend yield model is the DividendYieldProvider, which provides the continuous yield calculated from all dividend payoffs from the underlying Equity over the previous 350 days.
For other Option types, the default dividend yield model is the DividendYieldProvider
, but it calculates the yield from the dividends of the SPY ETF.
Model Structure
Dividend yield models must extend the IDividendYieldModel
interface. Extensions of the IDividendYieldModel
interface must implement a GetDividendYield
get_dividend_yield
method. The GetDividendYield
get_dividend_yield
method returns the dividend yield for a given date.
public class CustomDividendYieldModelExampleAlgorithm : QCAlgorithm { public override void Initialize() { var symbol = AddEquity("SPY").Symbol; // Before creating the indicator, create the dividend yield model var dividendYieldModel = new MyDividendYieldModel(); _iv = new ImpliedVolatility(symbol, RiskFreeInterestRateModel, dividendYieldModel, OptionPricingModelType.BlackScholes); } } // Define the custom dividend yield model public class MyDividendYieldModel : IDividendYieldModel { public decimal GetDividendYield(DateTime date) { return 0.02m; } }
class CustomDividendYieldModelExampleAlgorithm(QCAlgorithm): def initialize(self) -> None: symbol = self.add_equity("SPY").symbol # Before creating the indicator, create the dividend yield model dividend_yield_model = MyDividendYieldModel() self.iv = ImpliedVolatility(symbol, self.risk_free_interest_rate_model, dividend_yield_model, OptionPricingModelType.BLACK_SCHOLES) # Define the custom dividend yield model class MyDividendYieldModel: def get_dividend_yield(self, date: datetime) -> float: return 0.02
For a full example algorithm, see this backtestthis backtest.