diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 16:24:30 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 16:24:30 +0900 |
| commit | 100aa624ad3f8ad466a95f9da8af30f31f77cc9c (patch) | |
| tree | ef81b9f37872ed462a1f84ea238a130f758782d2 /services/strategy-engine/tests/test_volume_profile_strategy.py | |
| parent | 73eaf704584e5bf3c4499ccdd574af87304e1e5f (diff) | |
fix: resolve lint issues and final integration fixes
- Fix ambiguous variable name in binance_rest.py
- Remove unused volumes variable in volume_profile_strategy.py
- Fix import ordering in backtester main.py and test_metrics.py
- Auto-format all files with ruff
Diffstat (limited to 'services/strategy-engine/tests/test_volume_profile_strategy.py')
| -rw-r--r-- | services/strategy-engine/tests/test_volume_profile_strategy.py | 54 |
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)) |
