summaryrefslogtreecommitdiff
path: root/services/strategy-engine/tests/test_volume_profile_strategy.py
diff options
context:
space:
mode:
Diffstat (limited to 'services/strategy-engine/tests/test_volume_profile_strategy.py')
-rw-r--r--services/strategy-engine/tests/test_volume_profile_strategy.py54
1 files changed, 37 insertions, 17 deletions
diff --git a/services/strategy-engine/tests/test_volume_profile_strategy.py b/services/strategy-engine/tests/test_volume_profile_strategy.py
index be123b0..71f0eca 100644
--- a/services/strategy-engine/tests/test_volume_profile_strategy.py
+++ b/services/strategy-engine/tests/test_volume_profile_strategy.py
@@ -1,8 +1,8 @@
"""Tests for the Volume Profile strategy."""
+
from datetime import datetime, timezone
from decimal import Decimal
-import pytest
from shared.models import Candle, OrderSide
from strategies.volume_profile_strategy import VolumeProfileStrategy
@@ -39,17 +39,27 @@ def test_volume_profile_no_signal_insufficient_data():
def test_volume_profile_buy_at_value_area_low():
"""Concentrate volume around 95-105, price drops to 88, bounces back to 99."""
strategy = VolumeProfileStrategy()
- strategy.configure({
- "lookback_period": 10,
- "num_bins": 5,
- "value_area_pct": 0.7,
- "quantity": "0.01",
- })
+ strategy.configure(
+ {
+ "lookback_period": 10,
+ "num_bins": 5,
+ "value_area_pct": 0.7,
+ "quantity": "0.01",
+ }
+ )
# Build profile: 10 candles with volume concentrated around 95-105
profile_data = [
- (95, 50), (97, 50), (99, 100), (100, 100), (101, 100),
- (103, 50), (105, 50), (100, 100), (99, 100), (101, 50),
+ (95, 50),
+ (97, 50),
+ (99, 100),
+ (100, 100),
+ (101, 100),
+ (103, 50),
+ (105, 50),
+ (100, 100),
+ (99, 100),
+ (101, 50),
]
for price, vol in profile_data:
strategy.on_candle(make_candle(price, vol))
@@ -67,17 +77,27 @@ def test_volume_profile_buy_at_value_area_low():
def test_volume_profile_sell_at_value_area_high():
"""Concentrate volume around 95-105, price rises to 112, pulls back to 101."""
strategy = VolumeProfileStrategy()
- strategy.configure({
- "lookback_period": 10,
- "num_bins": 5,
- "value_area_pct": 0.7,
- "quantity": "0.01",
- })
+ strategy.configure(
+ {
+ "lookback_period": 10,
+ "num_bins": 5,
+ "value_area_pct": 0.7,
+ "quantity": "0.01",
+ }
+ )
# Build profile: 10 candles with volume concentrated around 95-105
profile_data = [
- (95, 50), (97, 50), (99, 100), (100, 100), (101, 100),
- (103, 50), (105, 50), (100, 100), (99, 100), (101, 50),
+ (95, 50),
+ (97, 50),
+ (99, 100),
+ (100, 100),
+ (101, 100),
+ (103, 50),
+ (105, 50),
+ (100, 100),
+ (99, 100),
+ (101, 50),
]
for price, vol in profile_data:
strategy.on_candle(make_candle(price, vol))