diff options
Diffstat (limited to 'tests/integration')
| -rw-r--r-- | tests/integration/test_backtest_end_to_end.py | 7 | ||||
| -rw-r--r-- | tests/integration/test_order_execution_flow.py | 5 | ||||
| -rw-r--r-- | tests/integration/test_portfolio_tracking_flow.py | 3 | ||||
| -rw-r--r-- | tests/integration/test_strategy_signal_flow.py | 11 |
4 files changed, 15 insertions, 11 deletions
diff --git a/tests/integration/test_backtest_end_to_end.py b/tests/integration/test_backtest_end_to_end.py index 4cc0b12..fbc0a24 100644 --- a/tests/integration/test_backtest_end_to_end.py +++ b/tests/integration/test_backtest_end_to_end.py @@ -9,19 +9,20 @@ sys.path.insert( sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "services" / "strategy-engine")) sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "services" / "backtester" / "src")) +from datetime import UTC, datetime, timedelta from decimal import Decimal -from datetime import datetime, timedelta, timezone -from shared.models import Candle from backtester.engine import BacktestEngine +from shared.models import Candle + def _generate_candles(prices: list[float], symbol="AAPL") -> list[Candle]: return [ Candle( symbol=symbol, timeframe="1h", - open_time=datetime(2025, 1, 1, tzinfo=timezone.utc) + timedelta(hours=i), + open_time=datetime(2025, 1, 1, tzinfo=UTC) + timedelta(hours=i), open=Decimal(str(p)), high=Decimal(str(p + 100)), low=Decimal(str(p - 100)), diff --git a/tests/integration/test_order_execution_flow.py b/tests/integration/test_order_execution_flow.py index dcbc498..2beb388 100644 --- a/tests/integration/test_order_execution_flow.py +++ b/tests/integration/test_order_execution_flow.py @@ -5,14 +5,15 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "services" / "order-executor" / "src")) -import pytest from decimal import Decimal from unittest.mock import AsyncMock -from shared.models import Signal, OrderSide, OrderStatus +import pytest from order_executor.executor import OrderExecutor from order_executor.risk_manager import RiskManager +from shared.models import OrderSide, OrderStatus, Signal + @pytest.mark.asyncio async def test_signal_to_order_flow(): diff --git a/tests/integration/test_portfolio_tracking_flow.py b/tests/integration/test_portfolio_tracking_flow.py index b20275a..d91a265 100644 --- a/tests/integration/test_portfolio_tracking_flow.py +++ b/tests/integration/test_portfolio_tracking_flow.py @@ -9,9 +9,10 @@ sys.path.insert( from decimal import Decimal -from shared.models import Order, OrderSide, OrderType, OrderStatus from portfolio_manager.portfolio import PortfolioTracker +from shared.models import Order, OrderSide, OrderStatus, OrderType + def test_portfolio_tracks_buy_sell_cycle(): """Buy then sell should update position and reset on full sell.""" diff --git a/tests/integration/test_strategy_signal_flow.py b/tests/integration/test_strategy_signal_flow.py index 6b048fb..3f7ec35 100644 --- a/tests/integration/test_strategy_signal_flow.py +++ b/tests/integration/test_strategy_signal_flow.py @@ -8,15 +8,16 @@ sys.path.insert( ) sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "services" / "strategy-engine")) -import pytest +from datetime import UTC, datetime from decimal import Decimal -from datetime import datetime, timezone from unittest.mock import AsyncMock -from shared.models import Candle -from shared.events import CandleEvent +import pytest from strategy_engine.engine import StrategyEngine +from shared.events import CandleEvent +from shared.models import Candle + @pytest.fixture def candles(): @@ -28,7 +29,7 @@ def candles(): Candle( symbol="AAPL", timeframe="1m", - open_time=datetime(2025, 1, 1, i, 0, tzinfo=timezone.utc), + open_time=datetime(2025, 1, 1, i, 0, tzinfo=UTC), open=price, high=price + 1, low=price - 1, |
