summaryrefslogtreecommitdiff
path: root/services/strategy-engine/strategies/volume_profile_strategy.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 17:11:10 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 17:11:10 +0900
commit76f934f95d3b5cbb96765e7158976e4a4c879fa9 (patch)
tree4dc93becf70e41e9df9cc7bb777c6defc3a85d30 /services/strategy-engine/strategies/volume_profile_strategy.py
parentadf5e96542ebd65c7d13ca5e9825071183b3ef13 (diff)
feat(strategy): add parameter validation to all strategies
Diffstat (limited to 'services/strategy-engine/strategies/volume_profile_strategy.py')
-rw-r--r--services/strategy-engine/strategies/volume_profile_strategy.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/services/strategy-engine/strategies/volume_profile_strategy.py b/services/strategy-engine/strategies/volume_profile_strategy.py
index e9463bf..b91e107 100644
--- a/services/strategy-engine/strategies/volume_profile_strategy.py
+++ b/services/strategy-engine/strategies/volume_profile_strategy.py
@@ -29,6 +29,19 @@ class VolumeProfileStrategy(BaseStrategy):
self._value_area_pct = float(params.get("value_area_pct", 0.7))
self._quantity = Decimal(str(params.get("quantity", "0.01")))
+ if self._lookback_period < 2:
+ raise ValueError(
+ f"Volume profile lookback_period must be >= 2, got {self._lookback_period}"
+ )
+ if self._num_bins < 2:
+ raise ValueError(f"Volume profile num_bins must be >= 2, got {self._num_bins}")
+ if not (0 < self._value_area_pct <= 1):
+ raise ValueError(
+ f"Volume profile value_area_pct must be 0 < pct <= 1, got {self._value_area_pct}"
+ )
+ if self._quantity <= 0:
+ raise ValueError(f"Quantity must be positive, got {self._quantity}")
+
def reset(self) -> None:
self._candles.clear()
self._was_below_va = False