Upload alpha_factory/deterministic/expression_mutator.py
Browse files
alpha_factory/deterministic/expression_mutator.py
CHANGED
|
@@ -90,7 +90,8 @@ def mutate_vol_scale(expression: str) -> list[dict]:
|
|
| 90 |
"""Add volatility scaling to the signal."""
|
| 91 |
# If expression has a raw field, wrap it in vol-normalization
|
| 92 |
# Pattern: find the innermost field reference and divide by ts_std
|
| 93 |
-
|
|
|
|
| 94 |
if not match:
|
| 95 |
return []
|
| 96 |
|
|
|
|
| 90 |
"""Add volatility scaling to the signal."""
|
| 91 |
# If expression has a raw field, wrap it in vol-normalization
|
| 92 |
# Pattern: find the innermost field reference and divide by ts_std
|
| 93 |
+
# BRAIN field IDs can contain uppercase (e.g., mdl77_2GlobalDev...)
|
| 94 |
+
match = re.search(r"(ts_(?:rank|mean)\()([a-zA-Z][a-zA-Z0-9_]+)(,\s*\d+\))", expression)
|
| 95 |
if not match:
|
| 96 |
return []
|
| 97 |
|