Skip to content

IOptionContractFilters

QuantConnect.Securities.IOptionContractFilters

Bases: Generic[QuantConnect_Securities_IOptionContractFilters_TSelf]

The option contract filters shared by the option universe selection (OptionFilterUniverse) and the option chain (Data.Market.OptionChain), so both offer the same filters with the same semantics. OptionChainTests.ChainExposesEveryUniverseFilter checks that every universe filter is declared here

expiration

expiration(
    min_expiry: timedelta, max_expiry: timedelta
) -> QuantConnect_Securities_IOptionContractFilters_TSelf
expiration(
    min_expiry_days: int, max_expiry_days: int
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Signature descriptions:

  • Selects the contracts expiring in the given range relative to the current date

  • Selects the contracts expiring in the given range of days relative to the current date

back_month

back_month() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the contracts of the second nearest expiration

back_months

back_months() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the contracts of all expirations but the nearest one

box_spread

box_spread(
    min_days_till_expiry: int = 30, strike_spread: float = 5
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects an OTM call, an ITM call, an OTM put and an ITM put with the same expiry closest to the criteria given

call_butterfly

call_butterfly(
    min_days_till_expiry: int = 30, strike_spread: float = 5
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects an ITM, an ATM and an OTM call with the same expiry and equal strike distance closest to the criteria given

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,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the 2 call contracts with the same strike and different expiries closest to the criteria given

call_ladder

call_ladder(
    min_days_till_expiry: int,
    higher_strike_from_atm: float,
    middle_strike_from_atm: float,
    lower_strike_from_atm: float,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects 3 calls with the same expiry and different strikes closest to the criteria given

calls_only

calls_only() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the call contracts

call_spread

call_spread(
    min_days_till_expiry: int = 30,
    higher_strike_from_atm: float = 5,
    lower_strike_from_atm: Optional[float] = None,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the 2 call contracts with the same expiry and different strikes closest to the criteria given

conversion

conversion(
    min_days_till_expiry: int = 30,
    strike_from_atm: float = 5,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects a call and a put with the same expiry and strike closest to the criteria given

d

d(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with delta in the given range. Alias for delta

delta

delta(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with delta in the given range

front_month

front_month() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the contracts of the nearest expiration

g

g(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with gamma in the given range. Alias for gamma

gamma

gamma(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with gamma in the given range

implied_volatility

implied_volatility(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with implied volatility in the given range

iron_butterfly

iron_butterfly(
    min_days_till_expiry: int = 30, strike_spread: float = 5
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects an OTM call, an ATM call, an ATM put and an OTM put with the same expiry and equal strike distance closest to the criteria given

iron_condor

iron_condor(
    min_days_till_expiry: int = 30,
    near_strike_spread: float = 5,
    far_strike_spread: float = 10,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects a far OTM call, a near OTM call, a near OTM put and a far OTM put with the same expiry closest to the criteria given

iv

iv(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with implied volatility in the given range. Alias for implied_volatility

jelly_roll

jelly_roll(
    strike_from_atm: float = 0,
    min_near_days_till_expiry: int = 30,
    min_far_days_till_expiry: int = 60,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects 2 calls and 2 puts with the same strike and 2 expiries closest to the criteria given

naked_call

naked_call(
    min_days_till_expiry: int = 30,
    strike_from_atm: float = 0,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the single call contract with the closest match to the criteria given

naked_put

naked_put(
    min_days_till_expiry: int = 30,
    strike_from_atm: float = 0,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the single put contract with the closest match to the criteria given

oi

oi(
    min: int, max: int
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with open interest in the given range. Alias for open_interest

open_interest

open_interest(
    min: int, max: int
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with open interest in the given range

protective_collar

protective_collar(
    min_days_till_expiry: int = 30,
    call_strike_from_atm: float = 5,
    put_strike_from_atm: float = -5,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects a call and a put with the same expiry and a lower put strike closest to the criteria given

put_butterfly

put_butterfly(
    min_days_till_expiry: int = 30, strike_spread: float = 5
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects an ITM, an ATM and an OTM put with the same expiry and equal strike distance closest to the criteria given

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,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the 2 put contracts with the same strike and different expiries closest to the criteria given

put_ladder

put_ladder(
    min_days_till_expiry: int,
    higher_strike_from_atm: float,
    middle_strike_from_atm: float,
    lower_strike_from_atm: float,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects 3 puts with the same expiry and different strikes closest to the criteria given

puts_only

puts_only() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the put contracts

put_spread

put_spread(
    min_days_till_expiry: int = 30,
    higher_strike_from_atm: float = 5,
    lower_strike_from_atm: Optional[float] = None,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the 2 put contracts with the same expiry and different strikes closest to the criteria given

r

r(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with rho in the given range. Alias for rho

rho

rho(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with rho in the given range

standards_only

standards_only() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the standard contracts, excluding weeklys

straddle

straddle(
    min_days_till_expiry: int = 30,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the ATM call and the ATM put with the same expiry closest to the criteria given

strangle

strangle(
    min_days_till_expiry: int = 30,
    call_strike_from_atm: float = 5,
    put_strike_from_atm: float = -5,
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects an OTM call and an OTM put with the same expiry closest to the criteria given

strikes

strikes(
    min_strike: int, max_strike: int
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with strikes in the given range relative to the underlying price, in number of strikes

t

t(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with theta in the given range. Alias for theta

theta

theta(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with theta in the given range

v

v(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with vega in the given range. Alias for vega

vega

vega(
    min: float, max: float
) -> QuantConnect_Securities_IOptionContractFilters_TSelf

Selects the contracts with vega in the given range

weeklys_only

weeklys_only() -> (
    QuantConnect_Securities_IOptionContractFilters_TSelf
)

Selects the non standard weekly contracts