**Namespace:**WealthLab.Backtest

**Parent:**Object

The OptionGreek class contains fields to hold a single set of greeks for an option symbol. Not all fields will be used by every historical providers that support options.

The Ask price at the UpdatedAt date/time.

The Bid price at the UpdatedAt date/time.

Option delta is a measure of the sensitivity of an option's price to changes in the underlying asset's price. It quantifies the expected change in the option price for a one-unit change in the price of the underlying asset.

Delta is expressed as a number between 0 and 1 for call options and between -1 and 0 for put options. For call options, a delta of 0.5 means that for every $1 increase in the underlying asset's price, the option's price is expected to increase by $0.50. Conversely, for put options, a delta of -0.5 means that for every $1 increase in the underlying asset's price, the option's price is expected to decrease by $0.50.

The delta of an option is affected by several factors, including the current price of the underlying asset, the strike price of the option, the time to expiration, and the volatility of the underlying asset. Delta is not a constant value and can change as these factors fluctuate.

An identifier used by IB's provider to indicate the option data's source.

- 13 = Computed Greeks and implied volatility based on the underlying stock price and the option model price.
- 53 = Greek values are based off a user customized price - result of CalculateOptionPrice() or CalculateIV()

**Remarks**

- FieldType can be ignored.

Option gamma is a measure of the *rate of change in an option's delta* in response to changes in the underlying asset's price. It quantifies how sensitive the option's delta is to movements in the underlying asset.

Gamma is particularly relevant when it comes to assessing the potential changes in delta as the price of the underlying asset fluctuates. It represents the second-order derivative of the option price with respect to the underlying asset's price.

When an option has a high gamma, it means that its delta is more responsive to changes in the underlying asset's price. This results in larger changes in delta for each unit change in the underlying asset's price. On the other hand, options with low gamma have less sensitivity to changes in the underlying asset's price, and their delta changes more gradually.

Gamma is at its highest for at-the-money options, meaning options where the strike price is close to the current price of the underlying asset. As an option moves further in or out of the money, the gamma tends to decrease.

**Implied Volatility (IV)** refers to the estimated level of volatility implied by the current market price of an option. It represents the market's expectation of how much the underlying asset's price is likely to fluctuate over the life of the option. Given the option's price and the price of the underlying asset, IV may be calculated by IB's Provider for the option as shown in the example.

Implied volatility is a crucial component in option pricing models, such as the Black-Scholes model. It is not directly observable or measurable but can be derived from the option's price using these models. Implied volatility reflects the collective sentiment and expectations of market participants regarding future price movements of the underlying asset.

When implied volatility is high, it suggests that market participants anticipate significant price swings in the underlying asset. Conversely, low implied volatility implies that the market expects relatively stable or muted price movements.

Implied volatility can be influenced by various factors, including market conditions, economic events, earnings announcements, geopolitical developments, and supply and demand dynamics in the options market. Additionally, implied volatility tends to be higher for options with longer time to expiration, as there is more time for potential price fluctuations.

`using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; using WealthLab.InteractiveBrokers; /* using required */ namespace WealthScript3 { public class IBOptionIVDemo : UserStrategyBase { public override void Initialize(BarHistory bars) { WLColor textColor = WLColor.NeonGreen; double price = bars.Close[bars.Count - 1]; DateTime currentDate = bars.DateTimes[bars.Count - 1]; int minDaysToExpiry = 10; bool weeklies = false; bool allowExpired = false; bool closestStrike = true; string optSym = IBHistorical.Instance.GetOptionsSymbol(bars, OptionType.Call, price, currentDate, minDaysToExpiry, weeklies, allowExpired, closestStrike); DrawHeaderText(optSym, textColor, 14); if (optSym != null) { if (bars.Scale.IsIntraday) { BarHistory obars = GetHistory(bars, optSym); if (obars != null) { PlotBarHistory(obars, optSym); double iv = IBHistorical.Instance.CalculateIV(optSym, obars.Close[obars.Count - 1], price); DrawHeaderText("Calculated IV = " + iv.ToString("N2"), textColor, 14); if (iv > 0) { double op = IBHistorical.Instance.CalculateOptionPrice(optSym, iv, price); // priceUnderlying DrawHeaderText("Option Price Calculated = " + op.ToString("N2"), textColor, 14); } } } else { DrawHeaderText("Intraday required for option data", textColor, 14); } } } public override void Execute(BarHistory bars, int idx) { } } }`

IV based on the option's ask price.

IV based on the option's bid price.

The Midpoint price is the average of Bid and Ask prices.

The date and time at which the option last traded. Most option contracts are illiquid, so the last price of an option could be far from it's current bid/ask.

The options's price. See **OptionLastTradedAt**.

Unknown. If you have a source for this, let us know!

IB only: The present value of dividends expected on the option's underlying.

Rho is a measure of the sensitivity of an option's price to changes in the risk-free interest rate. It quantifies how much the option's price is expected to change for a one-percentage-point change in the interest rate.

Rho is one of the lesser-known Greek letters in options trading, as it has a relatively minor impact compared to other factors like delta, gamma, theta, and vega. Its significance becomes more prominent in scenarios where interest rates experience significant fluctuations.

When interest rates rise, call options tend to increase in value, while put options decrease in value due to the effect of higher interest rates on the cost of carry. Conversely, when interest rates fall, call options typically decrease in value, while put options increase in value.

**Remarks**

- Rho is more relevant for longer-term options, such as those with distant expiration dates, as interest rate changes have a greater impact on their pricing.
- Rho is typically more significant for options on interest rate-sensitive assets, such as bonds or interest rate futures, as changes in interest rates directly impact the value of these underlying assets.
- Rho is not as commonly considered in equity options trading, where other factors like delta, gamma, theta, and vega play more significant roles.

Tradier only: ORATS final implied volatility.

See https://evan597.wordpress.com/2015/05/11/orats-historical-and-implied-volatility/

The option symbol.

Historical providers that support options will return a properly-formatted option symbol in response to `GetOptionSymbol()`

. Use that symbol in the historical provider's request to `GetGreeks()`

. See examples specific to each provider in the help doc. The example works for the IBHistorical provider.

`using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; using WealthLab.InteractiveBrokers; /* using required */ namespace WealthScript5 { public class IBOptionDemo : UserStrategyBase { public override void Initialize(BarHistory bars) { WLColor textColor = WLColor.NeonGreen; double price = bars.Close[bars.Count - 1]; DateTime currentDate = bars.DateTimes[bars.Count - 1]; int minDaysToExpiry = 10; bool weeklies = false; bool allowExpired = false; bool closestStrike = true; string optSym = IBHistorical.Instance.GetOptionsSymbol(bars, OptionType.Call, price, currentDate, minDaysToExpiry, weeklies, allowExpired, closestStrike); DrawHeaderText(optSym, textColor, 14); if (optSym != null) { OptionGreek greek = IBHistorical.Instance.GetGreeks(optSym); if (greek != null) { DrawHeaderText("MidPoint = " + greek.OptionPrice.ToString("N2"), textColor, 14); DrawHeaderText("IV = " + greek.IV.ToString("N2"), textColor, 14); DrawHeaderText("Delta = " + greek.Delta.ToString("N2"), textColor, 14); DrawHeaderText("Gamma = " + greek.Gamma.ToString("N2"), textColor, 14); DrawHeaderText("Theta = " + greek.Theta.ToString("N2"), textColor, 14); DrawHeaderText("Vega = " + greek.Vega.ToString("N2"), textColor, 14); DrawHeaderText("Underlying = " + greek.UnderlyingPrice.ToString("N2"), textColor, 14); } else { DrawHeaderText("The Greeks returned a null", textColor, 14); } } } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { } } }`

A generic string that can be used by a provider for a custom field.

Option theta is a measure of the rate at which the price of an option changes over time as the time to expiration decreases. It quantifies the time decay of an option's value.

Theta represents the change in the option price for a one-unit decrease in the time to expiration, with all other factors held constant. It measures how much value an option loses each day as it approaches its expiration date. As an option approaches its expiration date, the rate of time decay (theta) accelerates, causing the option's value to decline at a faster pace.

Option buyers (holders) need to be aware of theta because it erodes the value of their options over time. This is especially important for traders who rely on time-sensitive strategies or who hold options with a short time to expiration.

On the other hand, option sellers (writers) benefit from theta. They collect premium by selling options and profit as time passes and the option's value decreases due to theta decay. Theta is a key component in option-selling strategies, such as covered calls or credit spreads.

Theta is affected by other factors, such as the current price of the underlying asset, the strike price of the option, the implied volatility, and interest rates. Generally, at-the-money options have higher theta compared to options that are deep in or out of the money.

The last price of the underlier. See **OptionLastTradedAt**.

Date that the volatility data was last updated, converted to EST.

**Remarks**

- Primarily used by Tradier, whose Greeks update
*near the top of the hour*for the basic data subscription.

`using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; using WealthLab.Tradier; namespace WealthScript6 { public class TradierOptionDemo : UserStrategyBase { public override void Initialize(BarHistory bars) { WLColor textColor = WLColor.NeonGreen; double price = bars.Close[bars.Count - 1]; DateTime currentDate = bars.DateTimes[bars.Count - 1]; int minDaysToExpiry = 10; bool allowExpired = false; bool closestStrike = false; string optSym = TradierHistorical.Instance.GetOptionsSymbol(bars, OptionType.Call, price, currentDate, minDaysToExpiry, allowExpired, closestStrike); DrawHeaderText(optSym, textColor, 14); BarHistory obars = GetHistory(bars, optSym); if (obars != null) PlotBarHistory(obars, optSym); else DrawHeaderText("No option bars", textColor, 14); OptionGreek greek = TradierHistorical.Instance.GetGreeks(optSym); if (greek != null) { DrawHeaderText("Option Price = " + greek.OptionPrice.ToString("N4"), textColor, 14); DrawHeaderText("Option Last Traded = " + greek.OptionLastTradedAt.ToShortDateTimeString(), textColor, 14); DrawHeaderText("Underlying = " + greek.UnderlyingPrice.ToString("N4"), textColor, 14); // N/A here for Tradier DrawHeaderText("IV = " + greek.IV.ToString("N4"), textColor, 14); DrawHeaderText("Delta = " + greek.Delta.ToString("N4"), textColor, 14); DrawHeaderText("Gamma = " + greek.Gamma.ToString("N4"), textColor, 14); DrawHeaderText("Theta = " + greek.Theta.ToString("N4"), textColor, 14); DrawHeaderText("Vega = " + greek.Vega.ToString("N4"), textColor, 14); DrawHeaderText("Vega = " + greek.Vega.ToString("N4"), textColor, 14); DrawHeaderText("Greeks Last Updated = " + greek.UpdatedAt.ToShortDateTimeString(), textColor, 14); } else { DrawHeaderText("The Greeks returned a null", textColor, 14); } } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { } } }`

Option vega is a measure of the sensitivity of an option's price to changes in the volatility of the underlying asset. It quantifies how much the option's price is expected to change in response to a one-percentage-point change in the implied volatility of the underlying asset.

Vega is an important Greek letter in options trading as it helps traders and investors assess the impact of changes in volatility on option prices. When implied volatility increases, option prices tend to rise, and vice versa. Vega measures the rate at which option prices are expected to change as volatility fluctuates.

A high vega indicates that the option's price is more sensitive to changes in volatility, and a small change in implied volatility can significantly impact the option's price. Conversely, a low vega suggests that the option's price is less sensitive to changes in volatility.

Vega is particularly relevant for traders who have a view on future volatility to help gauge the potential impact of volatility changes on option positions and can be used in strategies that aim to profit from expected changes in volatility.

Vega is highest for at-the-money options and decreases as the option moves further in or out of the money. Additionally, vega is typically larger for options with longer time to expiration, as there is more time for potential volatility changes to impact the option price.