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

Defines a condition under which a particular OptionPosition can be combined with a preceding list of leg (also of type OptionPosition) to achieve a particular option strategy. More...

Public Member Functions

 OptionStrategyLegPredicate (BinaryComparison comparison, IOptionStrategyLegPredicateReferenceValue reference, Func< IReadOnlyList< OptionPosition >, OptionPosition, bool > predicate, Expression< Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >> expression)
 Initializes a new instance of the OptionStrategyLegPredicate class More...
 
bool Matches (IReadOnlyList< OptionPosition > legs, OptionPosition position)
 Determines whether or not the provided combination of preceding legs and current position adhere to this predicate's requirements. More...
 
OptionPositionCollection Filter (IReadOnlyList< OptionPosition > legs, OptionPositionCollection positions, bool includeUnderlying)
 Filters the specified positions by applying this predicate based on the referenced legs. More...
 
IOptionStrategyLegPredicateReferenceValue GetReferenceValue ()
 Gets the underlying IOptionStrategyLegPredicateReferenceValue value used by this predicate. More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 

Static Public Member Functions

static OptionStrategyLegPredicate Create (Expression< Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >> expression)
 Creates a new OptionStrategyLegPredicate from the specified predicate expression More...
 

Public Attributes

bool IsIndexed => _comparison != null && _reference != null
 Determines whether or not this predicate is able to utilize OptionPositionCollection indexes. More...
 

Detailed Description

Defines a condition under which a particular OptionPosition can be combined with a preceding list of leg (also of type OptionPosition) to achieve a particular option strategy.

Definition at line 30 of file OptionStrategyLegPredicate.cs.

Constructor & Destructor Documentation

◆ OptionStrategyLegPredicate()

QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegPredicate.OptionStrategyLegPredicate ( BinaryComparison  comparison,
IOptionStrategyLegPredicateReferenceValue  reference,
Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >  predicate,
Expression< Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >>  expression 
)

Initializes a new instance of the OptionStrategyLegPredicate class

Parameters
comparisonThe BinaryComparison invoked
referenceThe reference value, such as a strike price, encapsulated within the IOptionStrategyLegPredicateReferenceValue to enable resolving the value from different potential sets.
predicateThe compiled predicate expression
expressionThe predicate expression, from which, all other values were derived.

Definition at line 50 of file OptionStrategyLegPredicate.cs.

Here is the caller graph for this function:

Member Function Documentation

◆ Matches()

bool QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegPredicate.Matches ( IReadOnlyList< OptionPosition legs,
OptionPosition  position 
)

Determines whether or not the provided combination of preceding legs and current position adhere to this predicate's requirements.

Definition at line 67 of file OptionStrategyLegPredicate.cs.

◆ Filter()

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

Filters the specified positions by applying this predicate based on the referenced legs.

Definition at line 86 of file OptionStrategyLegPredicate.cs.

Here is the call graph for this function:

◆ GetReferenceValue()

IOptionStrategyLegPredicateReferenceValue QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegPredicate.GetReferenceValue ( )

Gets the underlying IOptionStrategyLegPredicateReferenceValue value used by this predicate.

Definition at line 111 of file OptionStrategyLegPredicate.cs.

◆ Create()

static OptionStrategyLegPredicate QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegPredicate.Create ( Expression< Func< IReadOnlyList< OptionPosition >, OptionPosition, bool >>  expression)
static

Creates a new OptionStrategyLegPredicate from the specified predicate expression

Definition at line 119 of file OptionStrategyLegPredicate.cs.

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

◆ ToString()

override string QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegPredicate.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

Definition at line 240 of file OptionStrategyLegPredicate.cs.

Member Data Documentation

◆ IsIndexed

bool QuantConnect.Securities.Option.StrategyMatcher.OptionStrategyLegPredicate.IsIndexed => _comparison != null && _reference != null

Determines whether or not this predicate is able to utilize OptionPositionCollection indexes.

Definition at line 40 of file OptionStrategyLegPredicate.cs.


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