Skip to content

OptionGreeksIndicatorBase

QuantConnect.Indicators.OptionGreeksIndicatorBase

OptionGreeksIndicatorBase(
    name: str,
    option: Union[Symbol, str, BaseContract],
    risk_free_rate_model: Any,
    dividend_yield_model: Any,
    mirror_option: Union[Symbol, str, BaseContract] = None,
    option_model: Optional[OptionPricingModelType] = None,
    iv_model: Optional[OptionPricingModelType] = None,
)
OptionGreeksIndicatorBase(
    name: str,
    option: Union[Symbol, str, BaseContract],
    risk_free_rate_model: Any,
    dividend_yield: float = 0.0,
    mirror_option: Union[Symbol, str, BaseContract] = None,
    option_model: Optional[OptionPricingModelType] = None,
    iv_model: Optional[OptionPricingModelType] = None,
)
OptionGreeksIndicatorBase(
    name: str,
    option: Union[Symbol, str, BaseContract],
    risk_free_rate_model: IRiskFreeInterestRateModel,
    dividend_yield_model: IDividendYieldModel,
    mirror_option: Union[Symbol, str, BaseContract] = None,
    option_model: Optional[OptionPricingModelType] = None,
    iv_model: Optional[OptionPricingModelType] = None,
)
OptionGreeksIndicatorBase(
    name: str,
    option: Union[Symbol, str, BaseContract],
    risk_free_rate_model: IRiskFreeInterestRateModel,
    dividend_yield: float = 0.0,
    mirror_option: Union[Symbol, str, BaseContract] = None,
    option_model: Optional[OptionPricingModelType] = None,
    iv_model: Optional[OptionPricingModelType] = None,
)
OptionGreeksIndicatorBase(
    name: str,
    option: Union[Symbol, str, BaseContract],
    risk_free_rate: float = 0.05,
    dividend_yield: float = 0.0,
    mirror_option: Union[Symbol, str, BaseContract] = None,
    option_model: Optional[OptionPricingModelType] = None,
    iv_model: Optional[OptionPricingModelType] = None,
)

Bases: OptionIndicatorBase

To provide a base class for option greeks indicator

Initializes a new instance of the OptionGreeksIndicatorBase class

Parameters:

Name Type Description Default
name str

The name of this indicator

required
option Union[Symbol, str, BaseContract]

The option to be tracked

required
risk_free_rate_model Optional[Any | IRiskFreeInterestRateModel]

Risk-free rate model

None
dividend_yield_model Optional[Any | IDividendYieldModel]

Dividend yield model

None
mirror_option Union[Symbol, str, BaseContract]

The mirror option for parity calculation

None
option_model Optional[OptionPricingModelType]

The option pricing model used to estimate the Greek

None
iv_model Optional[OptionPricingModelType]

The option pricing model used to estimate IV

None
dividend_yield Optional[float]

Dividend yield, as a constant

0.0
risk_free_rate Optional[float]

Risk-free rate, as a constant

0.05

implied_volatility

implied_volatility: ImpliedVolatility

Gets the implied volatility of the option

is_ready

is_ready: bool

Gets a flag indicating when this indicator is ready and fully initialized

warm_up_period

warm_up_period: int

Required period, in data points, for the indicator to be ready and fully initialized.

consolidators

consolidators: ISet[IDataConsolidator]

The data consolidators associated with this indicator if any

current

Gets the current state of this indicator. If the state has not been updated then the time on the value will equal DateTime.MinValue.

previous

Gets the previous state of this indicator. If the state has not been updated then the time on the value will equal DateTime.MinValue.

name

name: str

Gets a name for this indicator

samples

samples: int

Gets the number of samples processed by this indicator

updated

updated: _EventContainer[
    Callable[[Object, IndicatorDataPoint], Any], Any
]

Event handler that fires after this indicator is updated

window

A rolling window keeping a history of the indicator values of a given period

data_by_symbol

data_by_symbol: Dictionary[Symbol, SymbolData]

Relevant data for each symbol the indicator works on, including all inputs and actual data points used for calculation.

This codeEntityType is protected.

indicator_value

indicator_value: float

The most recently computed value of the indicator.

This codeEntityType is protected.

option_symbol

option_symbol: Symbol

Option's symbol object

expiry

expiry: datetime

Gets the expiration time of the option

right

right: OptionRight

Gets the option right (call/put) of the option

strike

strike: float

Gets the strike price of the option

style

style: OptionStyle

Gets the option style (European/American) of the option

risk_free_rate

risk_free_rate: Identity

Risk Free Rate

dividend_yield

dividend_yield: Identity

Dividend Yield

price

Gets the option price level

opposite_price

Gets the mirror option price level, for implied volatility

underlying_price

underlying_price: IndicatorBase[IndicatorDataPoint]

Gets the underlying's price level

use_mirror_contract

use_mirror_contract: bool

Flag if mirror option is implemented for parity type calculation

SymbolData

SymbolData(
    symbol: Union[Symbol, str, BaseContract], period: int
)

Bases: Object

Contains the data points, the current input and other relevant indicator data for a symbol.

This codeEntityType is protected.

Initializes a new instance of the SymbolData class.

exchange_time_zone

exchange_time_zone: Any

The exchange time zone for the security represented by this symbol.

data_points

data_points: RollingWindow[
    QuantConnect_Indicators_MultiSymbolIndicator_TInput
]

Data points for the symbol. This only hold the data points that have been used to calculate the indicator, which are those that had matching end times for every symbol.

current_input

current_input: (
    QuantConnect_Indicators_MultiSymbolIndicator_TInput
)

The last input data point for the symbol.

new_input

new_input: _EventContainer[
    Callable[
        [
            Object,
            QuantConnect_Indicators_MultiSymbolIndicator_TInput,
        ],
        Any,
    ],
    Any,
]

Event that fires when a new input data point is set for the symbol.

current_input_end_time_utc

current_input_end_time_utc: datetime

The end time of the last input data point for the symbol in UTC.

reset

reset() -> None

Resets this symbol data to its initial state

set_resolution

set_resolution(resolution: Resolution) -> None

Sets the resolution for this symbol data, to be used for time alignment.

calculate_greek

calculate_greek(time_till_expiry: float) -> float

Calculate the greek of the option

This codeEntityType is protected.

compute_indicator

compute_indicator() -> float

Computes the next value of the option greek indicator

This codeEntityType is protected.

Returns:

Type Description
float

The input is returned unmodified.

reset

reset() -> None

Resets this indicator and all sub-indicators

__eq__

__eq__(right: float) -> bool
__eq__(right: IndicatorBase) -> bool
__eq__(right: float) -> bool
__eq__(right: IndicatorBase) -> bool
__eq__(right: int) -> bool
__eq__(right: IndicatorBase) -> bool
__eq__(right: int) -> bool
__eq__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is equal to the specified value

  • Determines if the specified value is equal to the indicator's current value

__ge__

__ge__(right: float) -> bool
__ge__(right: IndicatorBase) -> bool
__ge__(right: float) -> bool
__ge__(right: IndicatorBase) -> bool
__ge__(right: int) -> bool
__ge__(right: IndicatorBase) -> bool
__ge__(right: int) -> bool
__ge__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is greater than or equal to the specified value

  • Determines if the specified value is greater than or equal to the indicator's current value

__gt__

__gt__(right: float) -> bool
__gt__(right: IndicatorBase) -> bool
__gt__(right: float) -> bool
__gt__(right: IndicatorBase) -> bool
__gt__(right: int) -> bool
__gt__(right: IndicatorBase) -> bool
__gt__(right: int) -> bool
__gt__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is greater than the specified value

  • Determines if the specified value is greater than the indicator's current value

__le__

__le__(right: float) -> bool
__le__(right: IndicatorBase) -> bool
__le__(right: float) -> bool
__le__(right: IndicatorBase) -> bool
__le__(right: int) -> bool
__le__(right: IndicatorBase) -> bool
__le__(right: int) -> bool
__le__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is less than or equal to the specified value

  • Determines if the specified value is less than or equal to the indicator's current value

__lt__

__lt__(right: float) -> bool
__lt__(right: IndicatorBase) -> bool
__lt__(right: float) -> bool
__lt__(right: IndicatorBase) -> bool
__lt__(right: int) -> bool
__lt__(right: IndicatorBase) -> bool
__lt__(right: int) -> bool
__lt__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is less than the specified value

  • Determines if the specified value is less than the indicator's current value

__ne__

__ne__(right: float) -> bool
__ne__(right: IndicatorBase) -> bool
__ne__(right: float) -> bool
__ne__(right: IndicatorBase) -> bool
__ne__(right: int) -> bool
__ne__(right: IndicatorBase) -> bool
__ne__(right: int) -> bool
__ne__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is not equal to the specified value

  • Determines if the specified value is not equal to the indicator's current value

compare_to

compare_to(obj: Any) -> int
compare_to(other: IIndicator) -> int

Signature descriptions:

  • Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

  • Compares the current object with another object of the same type.

Parameters:

Name Type Description Default
obj Optional[Any]

An object to compare with this instance.

None
other Optional[IIndicator]

An object to compare with this object.

None

Returns:

Type Description
int

Depends on the signature used. Case 1: [A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj. Greater than zero This instance follows obj in the sort order.]; Case 2: [A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.]

update

update(input: IBaseData) -> bool
update(time: Union[datetime, date], value: float) -> bool

Updates the state of this indicator with the given value and returns true if this indicator is ready, false otherwise

Parameters:

Name Type Description Default
input Optional[IBaseData]

The value to use to update this indicator

None
time Optional[Union[datetime, date]]

The time associated with the value

None
value Optional[float]

The value to use to update this indicator

None

Returns:

Type Description
bool

True if this indicator is ready, false otherwise.

__getitem__

__getitem__(i: int) -> IndicatorDataPoint

Indexes the history windows, where index 0 is the most recent indicator value. If index is greater or equal than the current count, it returns null. If the index is greater or equal than the window size, it returns null and resizes the windows to i + 1.

Parameters:

Name Type Description Default
i int

The index

required

Returns:

Type Description
IndicatorDataPoint

the ith most recent indicator value.

__iter__

__iter__() -> Iterator[IndicatorDataPoint]

compute_next_value

compute_next_value(input: IBaseData) -> float

Computes the next value of this indicator from the given state. This will round the result to 7 decimal places.

This codeEntityType is protected.

Parameters:

Name Type Description Default
input IBaseData

The input given to the indicator

required

Returns:

Type Description
float

A new value for this indicator.

equals

equals(obj: Any) -> bool

Determines whether the specified object is equal to the current object.

Parameters:

Name Type Description Default
obj Any

The object to compare with the current object.

required

Returns:

Type Description
bool

true if the specified object is equal to the current object; otherwise, false.

get_enumerator

get_enumerator() -> IEnumerator[IndicatorDataPoint]

Returns an enumerator that iterates through the history window.

Returns:

Type Description
IEnumerator[IndicatorDataPoint]

A System.Collections.Generic.IEnumerator`1 that can be used to iterate through the history window.

get_hash_code

get_hash_code() -> int

Get Hash Code for this Object

Returns:

Type Description
int

Integer Hash Code.

on_updated

on_updated(consolidated: IndicatorDataPoint) -> None

Event invocator for the Updated event

This codeEntityType is protected.

Parameters:

Name Type Description Default
consolidated IndicatorDataPoint

This is the new piece of data produced by this indicator

required

to_detailed_string

to_detailed_string() -> str

Provides a more detailed string of this indicator in the form of {Name} - {Value}

Returns:

Type Description
str

A detailed string of this indicator's current state.

to_string

to_string() -> str

ToString Overload for Indicator Base

Returns:

Type Description
str

String representation of the indicator.

validate_and_compute_next_value

validate_and_compute_next_value(
    input: QuantConnect_Indicators_IndicatorBase_T,
) -> IndicatorResult

Computes the next value of this indicator from the given state and returns an instance of the IndicatorResult class

This codeEntityType is protected.

Parameters:

Name Type Description Default
input QuantConnect_Indicators_IndicatorBase_T

The input given to the indicator

required

Returns:

Type Description
IndicatorResult

An IndicatorResult object including the status of the indicator.

get_option_model

get_option_model(
    option_model: Optional[OptionPricingModelType],
    option_style: OptionStyle,
) -> OptionPricingModelType

Gets the option pricing model based on the option style, if not specified

Parameters:

Name Type Description Default
option_model Optional[OptionPricingModelType]

The optional option pricing model, which will be returned if not null

required
option_style OptionStyle

The option style

required

Returns:

Type Description
OptionPricingModelType

The option pricing model based on the option style, if not specified.