diff options
Diffstat (limited to 'services/strategy-engine/tests/test_moc_strategy.py')
| -rw-r--r-- | services/strategy-engine/tests/test_moc_strategy.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/services/strategy-engine/tests/test_moc_strategy.py b/services/strategy-engine/tests/test_moc_strategy.py index 10a6720..1928a28 100644 --- a/services/strategy-engine/tests/test_moc_strategy.py +++ b/services/strategy-engine/tests/test_moc_strategy.py @@ -1,6 +1,8 @@ """Tests for MOC (Market on Close) strategy.""" + import sys from pathlib import Path + sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from datetime import datetime, timezone @@ -61,8 +63,28 @@ def test_moc_no_signal_outside_buy_window(): def test_moc_buy_signal_in_window(): s = _make_strategy(ema_period=3) # Build up history with some oscillation so RSI settles in the 30-70 range - prices = [150, 149, 151, 148, 152, 149, 150, 151, 148, 150, - 149, 151, 150, 152, 151, 153, 152, 154, 153, 155] + prices = [ + 150, + 149, + 151, + 148, + 152, + 149, + 150, + 151, + 148, + 150, + 149, + 151, + 150, + 152, + 151, + 153, + 152, + 154, + 153, + 155, + ] signals = [] for i, p in enumerate(prices): sig = s.on_candle(_candle(p, hour=20, minute=i * 2, volume=200.0)) @@ -105,7 +127,7 @@ def test_moc_no_buy_on_bearish_candle(): for i in range(8): s.on_candle(_candle(150, hour=20, minute=i * 3, volume=200.0)) # Bearish candle (open > close) - sig = s.on_candle(_candle(149, hour=20, minute=30, open_price=151)) + s.on_candle(_candle(149, hour=20, minute=30, open_price=151)) # May or may not signal depending on other criteria, but bearish should reduce chances # Just verify no crash |
