Lean  $LEAN_TAG$
QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData > Class Template Referenceabstract

Base class for contract symbols filtering universes. Used by OptionFilterUniverse and FutureFilterUniverse More...

Inheritance diagram for QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >:
[legend]

Public Member Functions

virtual void Refresh (IEnumerable< TData > allData, DateTime localTime)
 Refreshes this filter universe More...
 
StandardsOnly ()
 Sets universe of standard contracts (if any) as selection Contracts by default are standards; only needed to switch back if changed More...
 
IncludeWeeklys ()
 Includes universe of non-standard weeklys contracts (if any) into selection More...
 
WeeklysOnly ()
 Sets universe of weeklys contracts (if any) as selection More...
 
virtual T FrontMonth ()
 Returns front month contract More...
 
virtual T BackMonths ()
 Returns a list of back month contracts More...
 
BackMonth ()
 Returns first of back month contracts More...
 
virtual T Expiration (TimeSpan minExpiry, TimeSpan maxExpiry)
 Applies filter selecting options contracts based on a range of expiration dates relative to the current day More...
 
Expiration (int minExpiryDays, int maxExpiryDays)
 Applies filter selecting contracts based on a range of expiration dates relative to the current day More...
 
Contracts (PyObject contracts)
 Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last. More...
 
Contracts (IEnumerable< Symbol > contracts)
 Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last. More...
 
Contracts (IEnumerable< TData > contracts)
 Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last. More...
 
Contracts (Func< IEnumerable< TData >, IEnumerable< Symbol >> contractSelector)
 Sets a function used to filter the set of available contract filters. The input to the 'contractSelector' function will be the already filtered list if any other filters have already been applied. More...
 
Contracts (Func< IEnumerable< TData >, IEnumerable< TData >> contractSelector)
 Sets a function used to filter the set of available contract filters. The input to the 'contractSelector' function will be the already filtered list if any other filters have already been applied. More...
 
OnlyApplyFilterAtMarketOpen ()
 Instructs the engine to only filter contracts on the first time step of each market day. More...
 
IEnumerator< TData > GetEnumerator ()
 IEnumerable interface method implementation More...
 

Protected Member Functions

 ContractSecurityFilterUniverse ()
 Constructs ContractSecurityFilterUniverse More...
 
 ContractSecurityFilterUniverse (IEnumerable< TData > allData, DateTime localTime)
 Constructs ContractSecurityFilterUniverse More...
 
abstract bool IsStandard (Symbol symbol)
 Function to determine if the given symbol is a standard contract More...
 
abstract TData CreateDataInstance (Symbol symbol)
 Creates a new instance of the data type for the given symbol More...
 
virtual DateTime AdjustExpirationReferenceDate (DateTime referenceDate)
 Adjust the reference date used for expiration filtering. By default it just returns the same date. More...
 

Properties

ContractExpirationType Type = ContractExpirationType.Standard [get, set]
 Expiration Types allowed through the filter Standards only by default More...
 
DateTime LocalTime [get]
 The local exchange current time More...
 

Detailed Description

Base class for contract symbols filtering universes. Used by OptionFilterUniverse and FutureFilterUniverse

Type Constraints
T :ContractSecurityFilterUniverse 
T :T 
T :TData 
TData :IChainUniverseData 

Definition at line 29 of file ContractSecurityFilterUniverse.cs.

Constructor & Destructor Documentation

◆ ContractSecurityFilterUniverse() [1/2]

Constructs ContractSecurityFilterUniverse

Definition at line 108 of file ContractSecurityFilterUniverse.cs.

◆ ContractSecurityFilterUniverse() [2/2]

QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.ContractSecurityFilterUniverse ( IEnumerable< TData >  allData,
DateTime  localTime 
)
protected

Constructs ContractSecurityFilterUniverse

Definition at line 115 of file ContractSecurityFilterUniverse.cs.

Member Function Documentation

◆ IsStandard()

abstract bool QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.IsStandard ( Symbol  symbol)
protectedpure virtual

Function to determine if the given symbol is a standard contract

Returns
True if standard type

Implemented in QuantConnect.Securities.OptionFilterUniverse, and QuantConnect.Securities.FutureFilterUniverse.

◆ CreateDataInstance()

abstract TData QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.CreateDataInstance ( Symbol  symbol)
protectedpure virtual

Creates a new instance of the data type for the given symbol

Returns
A data instance for the given symbol

Implemented in QuantConnect.Securities.OptionFilterUniverse, and QuantConnect.Securities.FutureFilterUniverse.

◆ Refresh()

virtual void QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Refresh ( IEnumerable< TData >  allData,
DateTime  localTime 
)
virtual

Refreshes this filter universe

Parameters
allDataAll data for contracts in the Universe
localTimeThe local exchange current time

Definition at line 185 of file ContractSecurityFilterUniverse.cs.

◆ StandardsOnly()

Sets universe of standard contracts (if any) as selection Contracts by default are standards; only needed to switch back if changed

Returns
Universe with filter applied

Definition at line 198 of file ContractSecurityFilterUniverse.cs.

◆ IncludeWeeklys()

Includes universe of non-standard weeklys contracts (if any) into selection

Returns
Universe with filter applied

Definition at line 214 of file ContractSecurityFilterUniverse.cs.

◆ WeeklysOnly()

Sets universe of weeklys contracts (if any) as selection

Returns
Universe with filter applied

Definition at line 230 of file ContractSecurityFilterUniverse.cs.

◆ FrontMonth()

virtual T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.FrontMonth ( )
virtual

Returns front month contract

Returns
Universe with filter applied

Definition at line 240 of file ContractSecurityFilterUniverse.cs.

◆ BackMonths()

virtual T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.BackMonths ( )
virtual

Returns a list of back month contracts

Returns
Universe with filter applied

Definition at line 255 of file ContractSecurityFilterUniverse.cs.

Here is the caller graph for this function:

◆ BackMonth()

Returns first of back month contracts

Returns
Universe with filter applied

Definition at line 270 of file ContractSecurityFilterUniverse.cs.

◆ AdjustExpirationReferenceDate()

virtual DateTime QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.AdjustExpirationReferenceDate ( DateTime  referenceDate)
protectedvirtual

Adjust the reference date used for expiration filtering. By default it just returns the same date.

Parameters
referenceDateThe reference date to be adjusted
Returns
The adjusted date

Reimplemented in QuantConnect.Securities.OptionFilterUniverse.

Definition at line 280 of file ContractSecurityFilterUniverse.cs.

Here is the caller graph for this function:

◆ Expiration() [1/2]

virtual T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Expiration ( TimeSpan  minExpiry,
TimeSpan  maxExpiry 
)
virtual

Applies filter selecting options contracts based on a range of expiration dates relative to the current day

Parameters
minExpiryThe minimum time until expiry to include, for example, TimeSpan.FromDays(10) would exclude contracts expiring in less than 10 days
maxExpiryThe maximum time until expiry to include, for example, TimeSpan.FromDays(10) would exclude contracts expiring in more than 10 days
Returns
Universe with filter applied

Definition at line 293 of file ContractSecurityFilterUniverse.cs.

Here is the caller graph for this function:

◆ Expiration() [2/2]

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Expiration ( int  minExpiryDays,
int  maxExpiryDays 
)

Applies filter selecting contracts based on a range of expiration dates relative to the current day

Parameters
minExpiryDaysThe minimum time, expressed in days, until expiry to include, for example, 10 would exclude contracts expiring in less than 10 days
maxExpiryDaysThe maximum time, expressed in days, until expiry to include, for example, 10 would exclude contracts expiring in more than 10 days
Returns
Universe with filter applied

Definition at line 322 of file ContractSecurityFilterUniverse.cs.

◆ Contracts() [1/5]

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Contracts ( PyObject  contracts)

Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last.

Parameters
contractsThe option contract symbol objects to select
Returns
Universe with filter applied

Definition at line 333 of file ContractSecurityFilterUniverse.cs.

Here is the caller graph for this function:

◆ Contracts() [2/5]

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Contracts ( IEnumerable< Symbol contracts)

Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last.

Parameters
contractsThe option contract symbol objects to select
Returns
Universe with filter applied

Definition at line 351 of file ContractSecurityFilterUniverse.cs.

◆ Contracts() [3/5]

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Contracts ( IEnumerable< TData >  contracts)

Explicitly sets the selected contract symbols for this universe. This overrides and and all other methods of selecting symbols assuming it is called last.

Parameters
contractsThe option contract symbol objects to select
Returns
Universe with filter applied

Definition at line 363 of file ContractSecurityFilterUniverse.cs.

◆ Contracts() [4/5]

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Contracts ( Func< IEnumerable< TData >, IEnumerable< Symbol >>  contractSelector)

Sets a function used to filter the set of available contract filters. The input to the 'contractSelector' function will be the already filtered list if any other filters have already been applied.

Parameters
contractSelectorThe option contract symbol objects to select
Returns
Universe with filter applied

Definition at line 375 of file ContractSecurityFilterUniverse.cs.

◆ Contracts() [5/5]

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Contracts ( Func< IEnumerable< TData >, IEnumerable< TData >>  contractSelector)

Sets a function used to filter the set of available contract filters. The input to the 'contractSelector' function will be the already filtered list if any other filters have already been applied.

Parameters
contractSelectorThe option contract symbol objects to select
Returns
Universe with filter applied

Definition at line 388 of file ContractSecurityFilterUniverse.cs.

◆ OnlyApplyFilterAtMarketOpen()

T QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.OnlyApplyFilterAtMarketOpen ( )

Instructs the engine to only filter contracts on the first time step of each market day.

Returns
Universe with filter applied

Deprecated since filters are always non-dynamic now

Definition at line 401 of file ContractSecurityFilterUniverse.cs.

◆ GetEnumerator()

IEnumerator<TData> QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.GetEnumerator ( )

IEnumerable interface method implementation

Returns
IEnumerator of Symbols in Universe

Definition at line 410 of file ContractSecurityFilterUniverse.cs.

Property Documentation

◆ Type

ContractExpirationType QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.Type = ContractExpirationType.Standard
getsetprotected

Expiration Types allowed through the filter Standards only by default

Definition at line 58 of file ContractSecurityFilterUniverse.cs.

◆ LocalTime

DateTime QuantConnect.Securities.ContractSecurityFilterUniverse< T, TData >.LocalTime
get

The local exchange current time

Definition at line 63 of file ContractSecurityFilterUniverse.cs.


The documentation for this class was generated from the following file: