Skip to content

IContractFilters

QuantConnect.Securities.IContractFilters

Bases: Generic[QuantConnect_Securities_IContractFilters_TSelf]

The contract filters shared by every derivative universe selection and chain: expirations, contract types and liquidity. IOptionContractFilters{TSelf} and IFutureContractFilters{TSelf} add the option and future specific ones

expiration

expiration(
    min_expiry: timedelta, max_expiry: timedelta
) -> QuantConnect_Securities_IContractFilters_TSelf
expiration(
    min_expiry_days: int, max_expiry_days: int
) -> QuantConnect_Securities_IContractFilters_TSelf
expiration(
    expiries: List[datetime],
) -> QuantConnect_Securities_IContractFilters_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

  • Selects the contracts expiring on any of the given dates, ignoring the time of day

back_month

back_month() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the contracts of the second nearest expiration

back_months

back_months() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the contracts of all expirations but the nearest one

expiring_after

expiring_after(
    date: Union[datetime, date],
) -> QuantConnect_Securities_IContractFilters_TSelf

Selects the contracts expiring after the given date, excluding it

expiring_before

expiring_before(
    date: Union[datetime, date],
) -> QuantConnect_Securities_IContractFilters_TSelf

Selects the contracts expiring before the given date, excluding it

farthest_expiration

farthest_expiration() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the contracts of the farthest expiration

front_month

front_month() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the contracts of the nearest expiration

oi

oi(
    min: int, max: int
) -> QuantConnect_Securities_IContractFilters_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_IContractFilters_TSelf

Selects the contracts with open interest in the given range

standards_only

standards_only() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the standard contracts, excluding weeklys

volume

volume(
    min: int, max: int
) -> QuantConnect_Securities_IContractFilters_TSelf

Selects the contracts with volume in the given range

weeklys_only

weeklys_only() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the non standard weekly contracts

zero_dte

zero_dte() -> (
    QuantConnect_Securities_IContractFilters_TSelf
)

Selects the contracts expiring today