From 76f934f95d3b5cbb96765e7158976e4a4c879fa9 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:11:10 +0900 Subject: feat(strategy): add parameter validation to all strategies --- services/strategy-engine/strategies/vwap_strategy.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'services/strategy-engine/strategies/vwap_strategy.py') diff --git a/services/strategy-engine/strategies/vwap_strategy.py b/services/strategy-engine/strategies/vwap_strategy.py index d1b86b5..78919f1 100644 --- a/services/strategy-engine/strategies/vwap_strategy.py +++ b/services/strategy-engine/strategies/vwap_strategy.py @@ -24,6 +24,13 @@ class VwapStrategy(BaseStrategy): self._deviation_threshold = float(params.get("deviation_threshold", 0.002)) self._quantity = Decimal(str(params.get("quantity", "0.01"))) + if self._deviation_threshold <= 0: + raise ValueError( + f"VWAP deviation_threshold must be > 0, got {self._deviation_threshold}" + ) + if self._quantity <= 0: + raise ValueError(f"Quantity must be positive, got {self._quantity}") + def reset(self) -> None: self._cumulative_tp_vol = 0.0 self._cumulative_vol = 0.0 -- cgit v1.2.3