diff options
Diffstat (limited to 'services/strategy-engine/tests/test_bollinger_strategy.py')
| -rw-r--r-- | services/strategy-engine/tests/test_bollinger_strategy.py | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/services/strategy-engine/tests/test_bollinger_strategy.py b/services/strategy-engine/tests/test_bollinger_strategy.py index 473d9b4..7761f2d 100644 --- a/services/strategy-engine/tests/test_bollinger_strategy.py +++ b/services/strategy-engine/tests/test_bollinger_strategy.py @@ -107,12 +107,14 @@ def test_bollinger_squeeze_detection(): """Tight bandwidth → no signal during squeeze.""" # Use a strategy with a high squeeze threshold so constant prices trigger squeeze s = BollingerStrategy() - s.configure({ - "period": 5, - "num_std": 2.0, - "min_bandwidth": 0.0, - "squeeze_threshold": 0.5, # Very high threshold to ensure squeeze triggers - }) + s.configure( + { + "period": 5, + "num_std": 2.0, + "min_bandwidth": 0.0, + "squeeze_threshold": 0.5, # Very high threshold to ensure squeeze triggers + } + ) # Feed identical prices → bandwidth = 0 (below any threshold) for _ in range(6): @@ -126,12 +128,14 @@ def test_bollinger_squeeze_detection(): def test_bollinger_squeeze_breakout_buy(): """Squeeze ends with price above SMA → BUY signal.""" s = BollingerStrategy() - s.configure({ - "period": 5, - "num_std": 1.0, - "min_bandwidth": 0.0, - "squeeze_threshold": 0.01, - }) + s.configure( + { + "period": 5, + "num_std": 1.0, + "min_bandwidth": 0.0, + "squeeze_threshold": 0.01, + } + ) # Feed identical prices to create a squeeze (bandwidth = 0) for _ in range(6): @@ -149,12 +153,14 @@ def test_bollinger_squeeze_breakout_buy(): def test_bollinger_pct_b_conviction(): """Signals near band extremes have higher conviction via %B.""" s = BollingerStrategy() - s.configure({ - "period": 5, - "num_std": 1.0, - "min_bandwidth": 0.0, - "squeeze_threshold": 0.0, # Disable squeeze for this test - }) + s.configure( + { + "period": 5, + "num_std": 1.0, + "min_bandwidth": 0.0, + "squeeze_threshold": 0.0, # Disable squeeze for this test + } + ) # Build up with stable prices for _ in range(5): |
