OptionSymbol
QuantConnect.Securities.Option.OptionSymbol
Bases: Object
Static class contains common utility methods specific to symbols representing the option contracts
get_last_day_of_trading
get_last_day_of_trading(
symbol: Union[Symbol, str, BaseContract],
) -> datetime
Returns the last trading date for the option contract
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
Option symbol |
required |
get_settlement_date_time
get_settlement_date_time(
symbol: Union[Symbol, str, BaseContract],
) -> datetime
Returns the settlement date time of the option contract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
The option contract symbol |
required |
Returns:
| Type | Description |
|---|---|
datetime
|
The settlement date time. |
is_option_contract_expired
is_option_contract_expired(
symbol: Union[Symbol, str, BaseContract],
current_time_utc: Union[datetime, date],
) -> bool
Returns true if the option contract is expired at the specified time
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
The option contract symbol |
required |
current_time_utc
|
Union[datetime, date]
|
The current time (UTC) |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the option contract is expired at the specified time, false otherwise. |
is_standard
is_standard(
symbol: Union[Symbol, str, BaseContract],
) -> bool
Returns true if the option is a standard contract that expires 3rd Friday of the month
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
Option symbol |
required |
is_standard_contract
is_standard_contract(
symbol: Union[Symbol, str, BaseContract],
) -> bool
Returns true if the option is a standard contract that expires 3rd Friday of the month
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
Option symbol |
required |
is_weekly
is_weekly(symbol: Union[Symbol, str, BaseContract]) -> bool
Returns true if the option is a weekly contract that expires on Friday , except 3rd Friday of the month
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
Option symbol |
required |
map_to_underlying
map_to_underlying(
option_ticker: str, security_type: SecurityType
) -> str
Maps the option ticker to it's underlying
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option_ticker
|
str
|
The option ticker to map |
required |
security_type
|
SecurityType
|
The security type of the option or underlying |
required |
Returns:
| Type | Description |
|---|---|
str
|
The underlying ticker. |