Skip to content

IFutureContractFilters

QuantConnect.Securities.IFutureContractFilters

Bases: Generic[QuantConnect_Securities_IFutureContractFilters_TSelf], IContractFilters[QuantConnect_Securities_IFutureContractFilters_TSelf]

The future contract filters shared by the futures universe selection (FutureFilterUniverse) and the futures chain (Data.Market.FuturesChain), so both offer the same filters with the same semantics. FuturesChainTests.ChainExposesEveryUniverseFilter checks that every universe filter is declared here

contract_months

contract_months(
    months: List[int],
) -> QuantConnect_Securities_IFutureContractFilters_TSelf

Selects the contracts whose contract month is any of the given months of the year, see FutureExpirationCycles. Like expiration_cycle but by the contract month instead of the expiration month

expiration_cycle

expiration_cycle(
    months: List[int],
) -> QuantConnect_Securities_IFutureContractFilters_TSelf

Selects the contracts expiring in any of the given months of the year, see FutureExpirationCycles

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