OptionFilterUniverse
QuantConnect.Securities.OptionFilterUniverse
OptionFilterUniverse(option: Option)
OptionFilterUniverse(
option: Option,
all_data: List[OptionUniverse],
underlying: BaseData,
underlying_scale_factor: float = 1,
)
Bases: ContractSecurityFilterUniverse[QuantConnect_Securities_OptionFilterUniverse, OptionUniverse]
Represents options symbols universe used in filtering.
Constructs OptionFilterUniverse
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
Option
|
The canonical option chain security |
required |
underlying_internal
underlying_internal: BaseData
The underlying price data
This codeEntityType is protected.
type
type: ContractExpirationType
Expiration Types allowed through the filter Standards only by default
This codeEntityType is protected.
local_time
local_time: datetime
The local exchange current time
ContractExpirationType
Bases: IntEnum
Defines listed contract types with Flags attribute
This codeEntityType is protected.
STANDARD
STANDARD = 1
Standard contracts
WEEKLY
WEEKLY = 2
Non standard weekly contracts
adjust_expiration_reference_date
adjust_expiration_reference_date(
reference_date: Union[datetime, date],
) -> datetime
Adjusts the date to the next trading day if the current date is not a trading day, so that expiration filter is properly applied. e.g. Selection for Mondays happen on Friday midnight (Saturday start), so if the minimum time to expiration is, say 0, contracts expiring on Monday would be filtered out if the date is not properly adjusted to the next trading day (Monday).
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_date
|
Union[datetime, date]
|
The date to be adjusted |
required |
Returns:
| Type | Description |
|---|---|
datetime
|
The adjusted date. |
box_spread
box_spread(
min_days_till_expiry: int = 30, strike_spread: float = 5
) -> OptionFilterUniverse
Sets universe of an OTM call, an ITM call, an OTM put, and an ITM put with the same expiry with closest match to the criteria given. The OTM call has the same strike as the ITM put, while the same holds for the ITM call and the OTM put
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_spread
|
float
|
The desire strike price distance of the OTM call and the OTM put from the current underlying price |
5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
call_butterfly
call_butterfly(
min_days_till_expiry: int = 30, strike_spread: float = 5
) -> OptionFilterUniverse
Sets universe of an ITM call, an ATM call, and an OTM call with the same expiry and equal strike price distance, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_spread
|
float
|
The desire strike price distance of the ITM call and the OTM call from the current underlying price |
5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
call_calendar_spread
call_calendar_spread(
strike_from_atm: float = 0,
min_near_days_till_expiry: int = 30,
min_far_days_till_expiry: int = 60,
) -> OptionFilterUniverse
Sets universe of 2 call contracts with the same strike price and different expiration dates, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strike_from_atm
|
float
|
The desire strike price distance from the current underlying price |
0
|
min_near_days_till_expiry
|
int
|
The mininum days till expiry of the closer contract from the current time, closest expiry will be selected |
30
|
min_far_days_till_expiry
|
int
|
The mininum days till expiry of the further conrtact from the current time, closest expiry will be selected |
60
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
call_ladder
call_ladder(
min_days_till_expiry: int,
higher_strike_from_atm: float,
middle_strike_from_atm: float,
lower_strike_from_atm: float,
) -> OptionFilterUniverse
Sets universe of 3 call contracts with the same expiry and different strike prices, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
required |
higher_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the higher strike price |
required |
middle_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the middle strike price |
required |
lower_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the lower strike price |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
calls_only
calls_only() -> OptionFilterUniverse
Sets universe of call options (if any) as a selection
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
call_spread
call_spread(
min_days_till_expiry: int = 30,
higher_strike_from_atm: float = 5,
lower_strike_from_atm: Optional[float] = None,
) -> OptionFilterUniverse
Sets universe of 2 call contracts with the same expiry and different strike prices, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
higher_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the higher strike price |
5
|
lower_strike_from_atm
|
Optional[float]
|
The desire strike price distance from the current underlying price of the lower strike price |
None
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
conversion
conversion(
min_days_till_expiry: int = 30,
strike_from_atm: float = 5,
) -> OptionFilterUniverse
Sets universe of a call contract and a put contract with the same expiry and strike price, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_from_atm
|
float
|
The desire strike price distance from the current underlying price |
5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
create_data_instance
create_data_instance(
symbol: Union[Symbol, str, BaseContract],
) -> OptionUniverse
Creates a new instance of the data type for the given symbol
This codeEntityType is protected.
Returns:
| Type | Description |
|---|---|
OptionUniverse
|
A data instance for the given symbol. |
d
d(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Delta between the given range. Alias for delta(decimal, decimal)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Delta value |
required |
max
|
float
|
The maximum Delta value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
delta
delta(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Delta between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Delta value |
required |
max
|
float
|
The maximum Delta value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
g
g(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Gamma between the given range. Alias for gamma(decimal, decimal)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Gamma value |
required |
max
|
float
|
The maximum Gamma value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
gamma
gamma(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Gamma between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Gamma value |
required |
max
|
float
|
The maximum Gamma value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
implied_volatility
implied_volatility(
min: float, max: float
) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with implied volatility between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum implied volatility value |
required |
max
|
float
|
The maximum implied volatility value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
iron_butterfly
iron_butterfly(
min_days_till_expiry: int = 30, strike_spread: float = 5
) -> OptionFilterUniverse
Sets universe of an OTM call, an ATM call, an ATM put, and an OTM put with the same expiry and equal strike price distance, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_spread
|
float
|
The desire strike price distance of the OTM call and the OTM put from the current underlying price |
5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
iron_condor
iron_condor(
min_days_till_expiry: int = 30,
near_strike_spread: float = 5,
far_strike_spread: float = 10,
) -> OptionFilterUniverse
Sets universe of a far-OTM call, a near-OTM call, a near-OTM put, and a far-OTM put with the same expiry and equal strike price distance between both calls and both puts, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
near_strike_spread
|
float
|
The desire strike price distance of the near-to-expiry call and the near-to-expiry put from the current underlying price |
5
|
far_strike_spread
|
float
|
The desire strike price distance of the further-to-expiry call and the further-to-expiry put from the current underlying price |
10
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
is_standard
is_standard(
symbol: Union[Symbol, str, BaseContract],
) -> bool
Determine if the given Option contract symbol is standard
This codeEntityType is protected.
Returns:
| Type | Description |
|---|---|
bool
|
True if standard. |
iv
iv(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with implied volatility between the given range. Alias for implied_volatility(decimal, decimal)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum implied volatility value |
required |
max
|
float
|
The maximum implied volatility value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
jelly_roll
jelly_roll(
strike_from_atm: float = 0,
min_near_days_till_expiry: int = 30,
min_far_days_till_expiry: int = 60,
) -> OptionFilterUniverse
Sets universe of 2 call and 2 put contracts with the same strike price and 2 expiration dates, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strike_from_atm
|
float
|
The desire strike price distance from the current underlying price |
0
|
min_near_days_till_expiry
|
int
|
The mininum days till expiry of the closer contract from the current time, closest expiry will be selected |
30
|
min_far_days_till_expiry
|
int
|
The mininum days till expiry of the further conrtact from the current time, closest expiry will be selected |
60
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
naked_call
naked_call(
min_days_till_expiry: int = 30,
strike_from_atm: float = 0,
) -> OptionFilterUniverse
Sets universe of a single call contract with the closest match to criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_from_atm
|
float
|
The desire strike price distance from the current underlying price |
0
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
naked_put
naked_put(
min_days_till_expiry: int = 30,
strike_from_atm: float = 0,
) -> OptionFilterUniverse
Sets universe of a single put contract with the closest match to criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_from_atm
|
float
|
The desire strike price distance from the current underlying price |
0
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
oi
oi(min: int, max: int) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with open interest between the given range. Alias for open_interest(long, long)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
int
|
The minimum open interest value |
required |
max
|
int
|
The maximum open interest value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
open_interest
open_interest(min: int, max: int) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with open interest between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
int
|
The minimum open interest value |
required |
max
|
int
|
The maximum open interest value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
protective_collar
protective_collar(
min_days_till_expiry: int = 30,
call_strike_from_atm: float = 5,
put_strike_from_atm: float = -5,
) -> OptionFilterUniverse
Sets universe of a call contract and a put contract with the same expiry but lower strike price, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
call_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the call. |
5
|
put_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the put. |
-5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
put_butterfly
put_butterfly(
min_days_till_expiry: int = 30, strike_spread: float = 5
) -> OptionFilterUniverse
Sets universe of an ITM put, an ATM put, and an OTM put with the same expiry and equal strike price distance, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
strike_spread
|
float
|
The desire strike price distance of the ITM put and the OTM put from the current underlying price |
5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
put_calendar_spread
put_calendar_spread(
strike_from_atm: float = 0,
min_near_days_till_expiry: int = 30,
min_far_days_till_expiry: int = 60,
) -> OptionFilterUniverse
Sets universe of 2 put contracts with the same strike price and different expiration dates, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strike_from_atm
|
float
|
The desire strike price distance from the current underlying price |
0
|
min_near_days_till_expiry
|
int
|
The mininum days till expiry of the closer contract from the current time, closest expiry will be selected |
30
|
min_far_days_till_expiry
|
int
|
The mininum days till expiry of the further conrtact from the current time, closest expiry will be selected |
60
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
put_ladder
put_ladder(
min_days_till_expiry: int,
higher_strike_from_atm: float,
middle_strike_from_atm: float,
lower_strike_from_atm: float,
) -> OptionFilterUniverse
Sets universe of 3 put contracts with the same expiry and different strike prices, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
required |
higher_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the higher strike price |
required |
middle_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the middle strike price |
required |
lower_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the lower strike price |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
puts_only
puts_only() -> OptionFilterUniverse
Sets universe of put options (if any) as a selection
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
put_spread
put_spread(
min_days_till_expiry: int = 30,
higher_strike_from_atm: float = 5,
lower_strike_from_atm: Optional[float] = None,
) -> OptionFilterUniverse
Sets universe of 2 put contracts with the same expiry and different strike prices, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
higher_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the higher strike price |
5
|
lower_strike_from_atm
|
Optional[float]
|
The desire strike price distance from the current underlying price of the lower strike price |
None
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
r
r(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Rho between the given range. Alias for rho(decimal, decimal)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Rho value |
required |
max
|
float
|
The maximum Rho value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
refresh
refresh(
all_contracts_data: List[OptionUniverse],
underlying: BaseData,
local_time: Union[datetime, date],
) -> None
Refreshes this option filter universe and allows specifying if the exchange date changed from last call
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_contracts_data
|
List[OptionUniverse]
|
All data for the option contracts |
required |
underlying
|
BaseData
|
The current underlying last data point |
required |
local_time
|
Union[datetime, date]
|
The current local time |
required |
rho
rho(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Rho between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Rho value |
required |
max
|
float
|
The maximum Rho value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
straddle
straddle(
min_days_till_expiry: int = 30,
) -> OptionFilterUniverse
Sets universe of an ATM call contract and an ATM put contract with the same expiry, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
strangle
strangle(
min_days_till_expiry: int = 30,
call_strike_from_atm: float = 5,
put_strike_from_atm: float = -5,
) -> OptionFilterUniverse
Sets universe of an OTM call contract and an OTM put contract with the same expiry, with closest match to the criteria given
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_days_till_expiry
|
int
|
The minimum days till expiry from the current time, closest expiry will be selected |
30
|
call_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the OTM call. It must be positive. |
5
|
put_strike_from_atm
|
float
|
The desire strike price distance from the current underlying price of the OTM put. It must be negative. |
-5
|
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
strikes
strikes(
min_strike: int, max_strike: int
) -> OptionFilterUniverse
Applies filter selecting options contracts based on a range of strikes in relative terms
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_strike
|
int
|
The minimum strike relative to the underlying price, for example, -1 would filter out contracts further than 1 strike below market price |
required |
max_strike
|
int
|
The maximum strike relative to the underlying price, for example, +1 would filter out contracts further than 1 strike above market price |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
t
t(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Theta between the given range. Alias for theta(decimal, decimal)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Theta value |
required |
max
|
float
|
The maximum Theta value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
theta
theta(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Theta between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Theta value |
required |
max
|
float
|
The maximum Theta value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
v
v(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Vega between the given range. Alias for vega(decimal, decimal)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Vega value |
required |
max
|
float
|
The maximum Vega value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
vega
vega(min: float, max: float) -> OptionFilterUniverse
Applies the filter to the universe selecting the contracts with Vega between the given range
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
The minimum Vega value |
required |
max
|
float
|
The maximum Vega value |
required |
Returns:
| Type | Description |
|---|---|
OptionFilterUniverse
|
Universe with filter applied. |
contracts
contracts(
contracts: Any,
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
contracts(
contracts: List[Symbol],
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
contracts(
contracts: List[
QuantConnect_Securities_ContractSecurityFilterUniverse_TData
],
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
contracts(
contract_selector: Callable[
[
List[
QuantConnect_Securities_ContractSecurityFilterUniverse_TData
]
],
List[Symbol],
],
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
contracts(
contract_selector: Callable[
[
List[
QuantConnect_Securities_ContractSecurityFilterUniverse_TData
]
],
List[
QuantConnect_Securities_ContractSecurityFilterUniverse_TData
],
],
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Signature descriptions:
-
Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last.
-
Sets a function used to filter the set of available contract filters. The input to the 'contract_selector' function will be the already filtered list if any other filters have already been applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contracts
|
Optional[Any | List[Symbol] | List[QuantConnect_Securities_ContractSecurityFilterUniverse_TData]]
|
The option contract symbol objects to select |
None
|
contract_selector
|
Optional[Callable[[List[QuantConnect_Securities_ContractSecurityFilterUniverse_TData]], List[Symbol]] | Callable[[List[QuantConnect_Securities_ContractSecurityFilterUniverse_TData]], List[QuantConnect_Securities_ContractSecurityFilterUniverse_TData]]]
|
The option contract symbol objects to select |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
expiration
expiration(
min_expiry: timedelta, max_expiry: timedelta
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
expiration(
min_expiry_days: int, max_expiry_days: int
) -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Signature descriptions:
-
Applies filter selecting options contracts based on a range of expiration dates relative to the current day
-
Applies filter selecting contracts based on a range of expiration dates relative to the current day
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_expiry
|
Optional[timedelta]
|
The minimum time until expiry to include, for example, TimeSpan.FromDays(10) |
None
|
max_expiry
|
Optional[timedelta]
|
The maximum time until expiry to include, for example, TimeSpan.FromDays(10) |
None
|
min_expiry_days
|
Optional[int]
|
The minimum time, expressed in days, until expiry to include, for example, 10 |
None
|
max_expiry_days
|
Optional[int]
|
The maximum time, expressed in days, until expiry to include, for example, 10 |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
__iter__
__iter__() -> (
Iterator[
QuantConnect_Securities_ContractSecurityFilterUniverse_TData
]
)
back_month
back_month() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Returns first of back month contracts
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
back_months
back_months() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Returns a list of back month contracts
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
front_month
front_month() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Returns front month contract
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
get_enumerator
get_enumerator() -> (
IEnumerator[
QuantConnect_Securities_ContractSecurityFilterUniverse_TData
]
)
IEnumerable interface method implementation
Returns:
| Type | Description |
|---|---|
IEnumerator[QuantConnect_Securities_ContractSecurityFilterUniverse_TData]
|
IEnumerator of Symbols in Universe. |
include_weeklys
include_weeklys() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Includes universe of non-standard weeklys contracts (if any) into selection
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
only_apply_filter_at_market_open
only_apply_filter_at_market_open() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Instructs the engine to only filter contracts on the first time step of each market day.
Deprecated as of 2023-12-13. Filters are always non-dynamic as of now, which means they will only bee applied daily.
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
standards_only
standards_only() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Sets universe of standard contracts (if any) as selection Contracts by default are standards; only needed to switch back if changed
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |
weeklys_only
weeklys_only() -> (
QuantConnect_Securities_ContractSecurityFilterUniverse_T
)
Sets universe of weeklys contracts (if any) as selection
Returns:
| Type | Description |
|---|---|
QuantConnect_Securities_ContractSecurityFilterUniverse_T
|
Universe with filter applied. |