diff options
Diffstat (limited to 'services')
| -rw-r--r-- | services/api/src/trading_api/routers/strategies.py | 22 | ||||
| -rw-r--r-- | services/order-executor/src/order_executor/config.py | 5 |
2 files changed, 17 insertions, 10 deletions
diff --git a/services/api/src/trading_api/routers/strategies.py b/services/api/src/trading_api/routers/strategies.py index e968529..7ddd54e 100644 --- a/services/api/src/trading_api/routers/strategies.py +++ b/services/api/src/trading_api/routers/strategies.py @@ -1,15 +1,26 @@ """Strategy endpoints.""" import logging +import os import sys from pathlib import Path from fastapi import APIRouter, HTTPException -# Add strategy-engine to path for plugin loading -_STRATEGY_DIR = Path(__file__).resolve().parents[5] / "strategy-engine" -if str(_STRATEGY_DIR) not in sys.path: - sys.path.insert(0, str(_STRATEGY_DIR)) +# Resolve strategies directory from env or relative paths +_STRATEGIES_DIR = Path( + os.environ.get( + "STRATEGIES_DIR", + str(Path(__file__).resolve().parents[5] / "services" / "strategy-engine" / "strategies"), + ) +) +# Add parent so `from strategies.base import BaseStrategy` works +if str(_STRATEGIES_DIR.parent) not in sys.path: + sys.path.insert(0, str(_STRATEGIES_DIR.parent)) +# Add strategy-engine src for plugin_loader +_SE_SRC = Path(__file__).resolve().parents[5] / "services" / "strategy-engine" / "src" +if str(_SE_SRC) not in sys.path: + sys.path.insert(0, str(_SE_SRC)) logger = logging.getLogger(__name__) @@ -22,8 +33,7 @@ async def list_strategies(): try: from strategy_engine.plugin_loader import load_strategies - strategies_dir = _STRATEGY_DIR / "strategies" - strategies = load_strategies(strategies_dir) + strategies = load_strategies(_STRATEGIES_DIR) return [ { "name": s.name, diff --git a/services/order-executor/src/order_executor/config.py b/services/order-executor/src/order_executor/config.py index 14828ea..6542a31 100644 --- a/services/order-executor/src/order_executor/config.py +++ b/services/order-executor/src/order_executor/config.py @@ -4,7 +4,4 @@ from shared.config import Settings class ExecutorConfig(Settings): - risk_trailing_stop_pct: float = 0.0 - risk_max_open_positions: int = 10 - risk_volatility_lookback: int = 20 - risk_volatility_scale: bool = False + pass |
