diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:06:49 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:06:49 +0900 |
| commit | adf5e96542ebd65c7d13ca5e9825071183b3ef13 (patch) | |
| tree | 699800730cc9f68ab775bea5722ba55cf08b304a /tests/integration/test_order_execution_flow.py | |
| parent | b8dc7344ff99eb23d5f003795f17cdba3b89c40b (diff) | |
fix: lint fixes for integration tests and backtester noqa annotations
Diffstat (limited to 'tests/integration/test_order_execution_flow.py')
| -rw-r--r-- | tests/integration/test_order_execution_flow.py | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/tests/integration/test_order_execution_flow.py b/tests/integration/test_order_execution_flow.py index 1ea0485..819b7db 100644 --- a/tests/integration/test_order_execution_flow.py +++ b/tests/integration/test_order_execution_flow.py @@ -1,4 +1,5 @@ """Integration test: signal -> risk manager -> order executor -> order event.""" + import sys from pathlib import Path @@ -6,7 +7,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "services" / "order import pytest from decimal import Decimal -from unittest.mock import AsyncMock, MagicMock +from unittest.mock import AsyncMock from shared.models import Signal, OrderSide, OrderStatus from order_executor.executor import OrderExecutor @@ -17,8 +18,12 @@ from order_executor.risk_manager import RiskManager async def test_signal_to_order_flow(): """A valid signal passes risk checks and produces a filled order.""" signal = Signal( - strategy="rsi", symbol="BTC/USDT", side=OrderSide.BUY, - price=Decimal("50000"), quantity=Decimal("0.01"), reason="RSI oversold", + strategy="rsi", + symbol="BTC/USDT", + side=OrderSide.BUY, + price=Decimal("50000"), + quantity=Decimal("0.01"), + reason="RSI oversold", ) exchange = AsyncMock() @@ -35,8 +40,12 @@ async def test_signal_to_order_flow(): notifier = AsyncMock() executor = OrderExecutor( - exchange=exchange, risk_manager=risk_manager, - broker=broker, db=db, notifier=notifier, dry_run=True, + exchange=exchange, + risk_manager=risk_manager, + broker=broker, + db=db, + notifier=notifier, + dry_run=True, ) order = await executor.execute(signal) @@ -56,8 +65,11 @@ async def test_signal_to_order_flow(): async def test_signal_rejected_by_risk_manager(): """A signal that exceeds position size is rejected.""" signal = Signal( - strategy="rsi", symbol="BTC/USDT", side=OrderSide.BUY, - price=Decimal("50000"), quantity=Decimal("100"), # Way too large + strategy="rsi", + symbol="BTC/USDT", + side=OrderSide.BUY, + price=Decimal("50000"), + quantity=Decimal("100"), # Way too large reason="test", ) @@ -71,8 +83,12 @@ async def test_signal_rejected_by_risk_manager(): ) executor = OrderExecutor( - exchange=exchange, risk_manager=risk_manager, - broker=AsyncMock(), db=AsyncMock(), notifier=AsyncMock(), dry_run=True, + exchange=exchange, + risk_manager=risk_manager, + broker=AsyncMock(), + db=AsyncMock(), + notifier=AsyncMock(), + dry_run=True, ) order = await executor.execute(signal) |
