summaryrefslogtreecommitdiff
path: root/services/strategy-engine/src
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 16:14:11 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 16:14:11 +0900
commit380b8c079a9f92ece128ecccdff6c62fdef8f3b2 (patch)
treec56414eab6c0ddc4118cb7c6535274b1224ca031 /services/strategy-engine/src
parentc3560fdd637c4f034cac4f7371aeed65d018bc91 (diff)
feat(strategy): add warmup_period to BaseStrategy and YAML config loading
Diffstat (limited to 'services/strategy-engine/src')
-rw-r--r--services/strategy-engine/src/strategy_engine/plugin_loader.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/services/strategy-engine/src/strategy_engine/plugin_loader.py b/services/strategy-engine/src/strategy_engine/plugin_loader.py
index 719dc6d..f99b670 100644
--- a/services/strategy-engine/src/strategy_engine/plugin_loader.py
+++ b/services/strategy-engine/src/strategy_engine/plugin_loader.py
@@ -3,12 +3,15 @@ import importlib.util
import sys
from pathlib import Path
+import yaml
+
from strategies.base import BaseStrategy
def load_strategies(strategies_dir: Path) -> list[BaseStrategy]:
"""Scan strategies_dir for *.py files and load all BaseStrategy subclasses."""
loaded: list[BaseStrategy] = []
+ config_dir = strategies_dir / "config"
for path in sorted(strategies_dir.glob("*.py")):
# Skip dunder files and base
@@ -31,6 +34,13 @@ def load_strategies(strategies_dir: Path) -> list[BaseStrategy]:
and issubclass(obj, BaseStrategy)
and obj is not BaseStrategy
):
- loaded.append(obj())
+ instance = obj()
+ yaml_path = config_dir / f"{path.stem}.yaml"
+ if yaml_path.exists():
+ with open(yaml_path) as f:
+ params = yaml.safe_load(f)
+ if params:
+ instance.configure(params)
+ loaded.append(instance)
return loaded