summaryrefslogtreecommitdiff
path: root/services/strategy-engine/tests
diff options
context:
space:
mode:
Diffstat (limited to 'services/strategy-engine/tests')
-rw-r--r--services/strategy-engine/tests/test_moc_strategy.py28
-rw-r--r--services/strategy-engine/tests/test_sentiment_wiring.py1
2 files changed, 26 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
diff --git a/services/strategy-engine/tests/test_sentiment_wiring.py b/services/strategy-engine/tests/test_sentiment_wiring.py
index f1a816f..e0052cb 100644
--- a/services/strategy-engine/tests/test_sentiment_wiring.py
+++ b/services/strategy-engine/tests/test_sentiment_wiring.py
@@ -1,4 +1,5 @@
"""Test sentiment is wired into strategy engine."""
+
import sys
from pathlib import Path