Skip to content

BinaryComparison

QuantConnect.BinaryComparison

Bases: Object

Enumeration class defining binary comparisons and providing access to expressions and functions capable of evaluating a particular comparison for any type. If a particular type does not implement a binary comparison than an exception will be thrown.

EQUAL

EQUAL: BinaryComparison = ...

Gets the BinaryComparison equivalent of ExpressionType.Equal

NOT_EQUAL

NOT_EQUAL: BinaryComparison = ...

Gets the BinaryComparison equivalent of ExpressionType.NotEqual

LESS_THAN

LESS_THAN: BinaryComparison = ...

Gets the BinaryComparison equivalent of ExpressionType.LessThan

GREATER_THAN

GREATER_THAN: BinaryComparison = ...

Gets the BinaryComparison equivalent of ExpressionType.GreaterThan

LESS_THAN_OR_EQUAL

LESS_THAN_OR_EQUAL: BinaryComparison = ...

Gets the BinaryComparison equivalent of ExpressionType.LessThanOrEqual

GREATER_THAN_OR_EQUAL

GREATER_THAN_OR_EQUAL: BinaryComparison = ...

Gets the BinaryComparison equivalent of ExpressionType.GreaterThanOrEqual

type

type: Any

Gets the expression type defining the binary comparison.

evaluate

evaluate(
    left: QuantConnect_BinaryComparison_Evaluate_T,
    right: QuantConnect_BinaryComparison_Evaluate_T,
) -> bool

Evaluates the specified left and right according to this BinaryComparison

filter

filter(
    values: QuantConnect_BinaryComparisonExtensions_Filter_TCollection,
    reference: QuantConnect_BinaryComparisonExtensions_Filter_T,
) -> QuantConnect_BinaryComparisonExtensions_Filter_TCollection
filter(
    values: SortedDictionary[
        QuantConnect_BinaryComparisonExtensions_Filter_TKey,
        QuantConnect_BinaryComparisonExtensions_Filter_TValue,
    ],
    reference: QuantConnect_BinaryComparisonExtensions_Filter_TKey,
) -> SortedDictionary[
    QuantConnect_BinaryComparisonExtensions_Filter_TKey,
    QuantConnect_BinaryComparisonExtensions_Filter_TValue,
]
filter(
    values: ImmutableSortedDictionary[
        QuantConnect_BinaryComparisonExtensions_Filter_TKey,
        QuantConnect_BinaryComparisonExtensions_Filter_TValue,
    ],
    reference: QuantConnect_BinaryComparisonExtensions_Filter_TKey,
) -> ImmutableSortedDictionary[
    QuantConnect_BinaryComparisonExtensions_Filter_TKey,
    QuantConnect_BinaryComparisonExtensions_Filter_TValue,
]

Filters the provided values according to this BinaryComparison and the specified reference value. The reference value is used as the RIGHT side of the binary comparison. Consider the binary comparison is LessThan and we call Filter(values, 42). We're looking for keys that are less than 42.

get_evaluator

get_evaluator() -> Callable[
    [
        QuantConnect_BinaryComparison_GetEvaluator_T,
        QuantConnect_BinaryComparison_GetEvaluator_T,
    ],
    bool,
]

Gets a function capable of performing this BinaryComparison

get_expression

get_expression() -> Any

Gets an expression representing this BinaryComparison

split_by

split_by(
    values: ImmutableSortedDictionary[
        QuantConnect_BinaryComparisonExtensions_SplitBy_TKey,
        QuantConnect_BinaryComparisonExtensions_SplitBy_TValue,
    ],
    reference: QuantConnect_BinaryComparisonExtensions_SplitBy_TKey,
) -> Tuple[
    ImmutableSortedDictionary[
        QuantConnect_BinaryComparisonExtensions_SplitBy_TKey,
        QuantConnect_BinaryComparisonExtensions_SplitBy_TValue,
    ],
    ImmutableSortedDictionary[
        QuantConnect_BinaryComparisonExtensions_SplitBy_TKey,
        QuantConnect_BinaryComparisonExtensions_SplitBy_TValue,
    ],
]

Filters the provided values according to this BinaryComparison and the specified reference value. The reference value is used as the RIGHT side of the binary comparison. Consider the binary comparison is LessThan and we call Filter(values, 42). We're looking for keys that are less than 42.

flip_operands

flip_operands() -> BinaryComparison

Flips the logic ordering of the comparison's operands. For example, LESS_THAN is converted into GREATER_THAN

from_expression_type

from_expression_type(type: Any) -> BinaryComparison

Gets the BinaryComparison matching the provided type

to_string

to_string() -> str

Returns a string that represents the current object.

Returns:

Type Description
str

A string that represents the current object.