Skip to content

ExpressionBuilder

QuantConnect.Util.ExpressionBuilder

Bases: Object

Provides methods for constructing expressions at runtime

as_enumerable

as_enumerable(expression: Any) -> Iterable[Expression]

Converts the specified expression into an enumerable of expressions by walking the expression tree

Parameters:

Name Type Description Default
expression Any

The expression to enumerate

required

Returns:

Type Description
Iterable[Expression]

An enumerable containing all expressions in the input expression.

is_binary_comparison

is_binary_comparison(type: Any) -> bool

Determines whether or not the specified type is a binary comparison.

make_property_or_field_selector

make_property_or_field_selector(
    type: Type, property_or_field: str
) -> Any

Constructs a selector of the form: x => x.property_or_field where x is an instance of 'type'

Parameters:

Name Type Description Default
type Type

The type of the parameter in the expression

required
property_or_field str

The name of the property or field to bind to

required

Returns:

Type Description
Any

A new lambda expression that represents accessing the property or field on 'type'.