Lean  $LEAN_TAG$
QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition Class Reference

Defines a single option leg in an option strategy. This definition supports direct match (does position X match the definition) and position collection filtering (filter collection to include matches) More...

Inheritance diagram for QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition:
[legend]

Public Member Functions

 OptionStrategyLegDefinition (OptionRight right, int quantity, IEnumerable< OptionStrategyLegPredicate > predicates)
 Initializes a new instance of the OptionStrategyLegDefinition class More...
 
IEnumerable< OptionStrategyLegDefinitionMatchMatch (OptionStrategyMatcherOptions options, IReadOnlyList< OptionPosition > legs, OptionPositionCollection positions)
 Yields all possible matches for this leg definition held within the collection of positions More...
 
OptionPositionCollection Filter (IReadOnlyList< OptionPosition > legs, OptionPositionCollection positions, bool includeUnderlying=true)
 Filters the provided positions collection such that any remaining positions are all valid options that match this leg definition instance. More...
 
OptionStrategy.LegData CreateLegData (OptionStrategyLegDefinitionMatch match)
 Creates the appropriate OptionStrategy.LegData for the specified match More...
 
bool TryMatch (OptionPosition position, out OptionStrategy.LegData leg)
 Determines whether or not this leg definition matches the specified position , and if so, what the resulting quantity of the OptionStrategy.OptionLegData should be. More...
 
IEnumerator< OptionStrategyLegPredicateGetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 

Static Public Member Functions

static OptionStrategy.LegData CreateLegData (Symbol symbol, int quantity)
 Creates the appropriate OptionStrategy.LegData with the specified quantity More...
 
static OptionStrategyLegDefinition Create (OptionRight right, int quantity, IEnumerable< Expression< Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >>> predicates)
 Creates a new OptionStrategyLegDefinition matching the specified parameters More...
 

Properties

int Quantity [get]
 Gets the unit quantity More...
 
OptionRight Right [get]
 Gets the contract right More...
 

Detailed Description

Defines a single option leg in an option strategy. This definition supports direct match (does position X match the definition) and position collection filtering (filter collection to include matches)

Definition at line 29 of file OptionStrategyLegDefinition.cs.

Constructor & Destructor Documentation

◆ OptionStrategyLegDefinition()

QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.OptionStrategyLegDefinition ( OptionRight  right,
int  quantity,
IEnumerable< OptionStrategyLegPredicate predicates 
)

Initializes a new instance of the OptionStrategyLegDefinition class

Parameters
rightThe leg's contract right
quantityThe leg's unit quantity
predicatesThe conditions a position must meet in order to match this definition

Definition at line 49 of file OptionStrategyLegDefinition.cs.

Here is the caller graph for this function:

Member Function Documentation

◆ Match()

IEnumerable<OptionStrategyLegDefinitionMatch> QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.Match ( OptionStrategyMatcherOptions  options,
IReadOnlyList< OptionPosition legs,
OptionPositionCollection  positions 
)

Yields all possible matches for this leg definition held within the collection of positions

Parameters
optionsStrategy matcher options guiding matching behaviors
legsThe preceding legs already matched for the parent strategy definition
positionsThe remaining, unmatched positions available to be matched against
Returns
An enumerable of potential matches

Definition at line 63 of file OptionStrategyLegDefinition.cs.

Here is the call graph for this function:

◆ Filter()

OptionPositionCollection QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.Filter ( IReadOnlyList< OptionPosition legs,
OptionPositionCollection  positions,
bool  includeUnderlying = true 
)

Filters the provided positions collection such that any remaining positions are all valid options that match this leg definition instance.

Definition at line 85 of file OptionStrategyLegDefinition.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateLegData() [1/2]

OptionStrategy.LegData QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.CreateLegData ( OptionStrategyLegDefinitionMatch  match)

Creates the appropriate OptionStrategy.LegData for the specified match

Definition at line 121 of file OptionStrategyLegDefinition.cs.

◆ CreateLegData() [2/2]

static OptionStrategy.LegData QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.CreateLegData ( Symbol  symbol,
int  quantity 
)
static

Creates the appropriate OptionStrategy.LegData with the specified quantity

Definition at line 132 of file OptionStrategyLegDefinition.cs.

Here is the call graph for this function:

◆ TryMatch()

bool QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.TryMatch ( OptionPosition  position,
out OptionStrategy.LegData  leg 
)

Determines whether or not this leg definition matches the specified position , and if so, what the resulting quantity of the OptionStrategy.OptionLegData should be.

Definition at line 146 of file OptionStrategyLegDefinition.cs.

Here is the call graph for this function:

◆ Create()

static OptionStrategyLegDefinition QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.Create ( OptionRight  right,
int  quantity,
IEnumerable< Expression< Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >>>  predicates 
)
static

Creates a new OptionStrategyLegDefinition matching the specified parameters

Definition at line 172 of file OptionStrategyLegDefinition.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEnumerator()

IEnumerator<OptionStrategyLegPredicate> QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

Returns
An enumerator that can be used to iterate through the collection.

Definition at line 185 of file OptionStrategyLegDefinition.cs.

Property Documentation

◆ Quantity

int QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.Quantity
get

Gets the unit quantity

Definition at line 36 of file OptionStrategyLegDefinition.cs.

◆ Right

OptionRight QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.Right
get

Gets the contract right

Definition at line 41 of file OptionStrategyLegDefinition.cs.


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