Skip to content

OptionContract

QuantConnect.Data.Market.OptionContract

OptionContract(security: ISecurityPrice)
OptionContract(
    contract_data: OptionUniverse,
    symbol_properties: SymbolProperties,
)

Bases: BaseContract

Defines a single option contract at a specific expiration and strike price

Signature descriptions:

  • Initializes a new instance of the OptionContract class

  • Initializes a new option contract from a given OptionUniverse instance

Parameters:

Name Type Description Default
security Optional[ISecurityPrice]

The option contract security

None
contract_data Optional[OptionUniverse]

The option universe contract data to use as source for this contract

None
symbol_properties Optional[SymbolProperties]

The contract symbol properties

None

strike

strike: float

Gets the strike price

scaled_strike

scaled_strike: float

Gets the strike price multiplied by the strike multiplier

right

right: OptionRight

Gets the right being purchased (call or put )

style

style: OptionStyle

Gets the option style

theoretical_price

theoretical_price: float

Gets the theoretical price of this option contract as computed by the IOptionPriceModel

implied_volatility

implied_volatility: float

Gets the implied volatility of the option contract as computed by the IOptionPriceModel

greeks

greeks: Greeks

Gets the greeks for this contract

open_interest

open_interest: float

Gets the open interest

last_price

last_price: float

Gets the last price this contract traded at

volume

volume: int

Gets the last volume this contract traded at

bid_price

bid_price: float

Gets the current bid price

bid_size

bid_size: int

Get the current bid size

ask_price

ask_price: float

Gets the ask price

ask_size

ask_size: int

Gets the current ask size

underlying_last_price

underlying_last_price: float

Gets the last price the underlying security traded at

symbol

symbol: Symbol

Gets the contract's symbol

id

The security identifier of the symbol

underlying_symbol

underlying_symbol: Symbol

Gets the underlying security's symbol

expiry

expiry: datetime

Gets the expiration date

time

time: datetime

Gets the local date time this contract's data was last updated

create

create(
    base_data: BaseData,
    security: ISecurityPrice,
    underlying: BaseData,
) -> OptionContract
create(
    end_time: Union[datetime, date],
    security: ISecurityPrice,
    underlying: BaseData,
) -> OptionContract
create(
    contract_data: OptionUniverse,
    symbol_properties: SymbolProperties,
) -> OptionContract

Signature descriptions:

  • Creates a OptionContract

  • Creates a new option contract from a given OptionUniverse instance, using its data to form a quote bar to source pricing data

Parameters:

Name Type Description Default
base_data Optional[BaseData]
None
security Optional[ISecurityPrice]

Provides price properties for a Security

None
underlying Optional[BaseData]

Last underlying security trade data

None
end_time Optional[Union[datetime, date]]

local date time this contract's data was last updated

None
contract_data Optional[OptionUniverse]

The option universe contract data to use as source for this contract

None
symbol_properties Optional[SymbolProperties]

The contract symbol properties

None

Returns:

Type Description
OptionContract

Option contract.

to_string

to_string() -> str

Returns a string that represents the current object.

Returns:

Type Description
str

A string that represents the current object.