contango.strategy.rule_based.rules.rule
contango.strategy.rule_based.rules.rule
Rule
Rule(when: Condition[C], then: Action[C, R])
Bases: Generic[C, R]
Executes an action upon a condition being True.
Attributes:
| Name | Type | Description |
|---|---|---|
C |
The context for the rule. |
|
R |
The return type for the rule. |
Initializes a Rule with a condition & action.
Source code in src\contango\strategy\rule_based\rules\rule.py
22 23 24 25 26 27 | |
evaluate
evaluate(context: C) -> R | None
Evaluates the status of the condition, executing & returning the output from the action if True.
Source code in src\contango\strategy\rule_based\rules\rule.py
29 30 31 32 33 34 | |