bayesline.api.equity.parse_expression#
- bayesline.api.equity.parse_expression(text: str) Expression#
Parse an exposure expression and check it against the whitelist.
Parameters#
- textstr
The expression. Leading and trailing whitespace is ignored.
Returns#
- ast.Expression
The parsed tree. Its references are not resolved:
codeis an ast.Name andfactor_group.codean ast.Attribute of an ast.Name.
Raises#
- ValueError
If the text is empty, nested too deeply or not valid syntax, if it uses syntax outside the whitelist or a constant outside the float32 range, if it uses a condition where a value is expected or a value where a condition is expected, or if it calls a function that is not registered or with the wrong arguments.