Lean
$LEAN_TAG$
|
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...
Public Member Functions | |
OptionStrategyLegDefinition (OptionRight right, int quantity, IEnumerable< OptionStrategyLegPredicate > predicates) | |
Initializes a new instance of the OptionStrategyLegDefinition class More... | |
IEnumerable< OptionStrategyLegDefinitionMatch > | Match (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< OptionStrategyLegPredicate > | GetEnumerator () |
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... | |
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.
QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.OptionStrategyLegDefinition | ( | OptionRight | right, |
int | quantity, | ||
IEnumerable< OptionStrategyLegPredicate > | predicates | ||
) |
Initializes a new instance of the OptionStrategyLegDefinition class
right | The leg's contract right |
quantity | The leg's unit quantity |
predicates | The conditions a position must meet in order to match this definition |
Definition at line 49 of file OptionStrategyLegDefinition.cs.
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
options | Strategy matcher options guiding matching behaviors |
legs | The preceding legs already matched for the parent strategy definition |
positions | The remaining, unmatched positions available to be matched against |
Definition at line 63 of file OptionStrategyLegDefinition.cs.
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.
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.
|
static |
Creates the appropriate OptionStrategy.LegData with the specified quantity
Definition at line 132 of file OptionStrategyLegDefinition.cs.
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.
|
static |
Creates a new OptionStrategyLegDefinition matching the specified parameters
Definition at line 172 of file OptionStrategyLegDefinition.cs.
IEnumerator<OptionStrategyLegPredicate> QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegDefinition.GetEnumerator | ( | ) |
Returns an enumerator that iterates through the collection.
Definition at line 185 of file OptionStrategyLegDefinition.cs.
|
get |
Gets the unit quantity
Definition at line 36 of file OptionStrategyLegDefinition.cs.
|
get |
Gets the contract right
Definition at line 41 of file OptionStrategyLegDefinition.cs.