Files
crypto_trader/tests/e2e/test_strategy_lifecycle.py

35 lines
876 B
Python
Raw Normal View History

"""End-to-end tests for strategy lifecycle."""
import pytest
from src.strategies.technical.rsi_strategy import RSIStrategy
from src.trading.engine import get_trading_engine
@pytest.mark.e2e
class TestStrategyLifecycle:
"""End-to-end tests for strategy lifecycle."""
@pytest.mark.asyncio
async def test_strategy_lifecycle(self):
"""Test complete strategy lifecycle."""
engine = get_trading_engine()
await engine.initialize()
# Create strategy
strategy = RSIStrategy(
strategy_id=1,
name="test_rsi",
symbol="BTC/USD",
timeframe="1h",
parameters={"rsi_period": 14}
)
# Start
await engine.start_strategy(strategy)
# Stop
await engine.stop_strategy(1)
await engine.shutdown()