37 lines
994 B
Python
37 lines
994 B
Python
"""Integration tests for strategy execution."""
|
|
|
|
import pytest
|
|
from src.strategies.technical.rsi_strategy import RSIStrategy
|
|
from src.trading.engine import get_trading_engine
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestStrategyExecution:
|
|
"""Integration tests for strategy execution."""
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_strategy_execution_workflow(self):
|
|
"""Test complete strategy execution workflow."""
|
|
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 strategy
|
|
await engine.start_strategy(strategy)
|
|
assert strategy.is_active
|
|
|
|
# Stop strategy
|
|
await engine.stop_strategy(1)
|
|
assert not strategy.is_active
|
|
|
|
await engine.shutdown()
|
|
|