contango.strategy.rule_based.conditions.predicate
contango.strategy.rule_based.conditions.predicate
Predicate
Predicate(fn: Callable[[TradingContext], bool])
Bases: Condition[TradingContext]
A lambda expression that evaluates to a boolean.
Initializes Predicate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[TradingContext], bool]
|
The callable that returns a boolean. |
required |
Source code in src\contango\strategy\rule_based\conditions\predicate.py
13 14 15 16 17 18 19 20 | |
evaluate
evaluate(context: TradingContext) -> bool
Evaluates the state of the predicate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
TradingContext
|
The current context to feed into the lambda. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
The boolean value of the lambda. |
Source code in src\contango\strategy\rule_based\conditions\predicate.py
22 23 24 25 26 27 28 29 30 31 32 | |