"""Integration tests for trading workflow."""

import pytest
from unittest.mock import Mock, AsyncMock, patch
from src.trading.engine import get_trading_engine
from src.strategies.technical.rsi_strategy import RSIStrategy


@pytest.mark.integration
class TestTradingWorkflow:
    """Integration tests for complete trading workflow."""
    
    @pytest.mark.asyncio
    async def test_complete_trading_workflow(self, mock_database):
        """Test complete trading workflow."""
        # Initialize trading engine
        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)
        
        # Execute trade (paper trading)
        result = await engine.execute_trade(
            exchange_name="paper_trading",
            strategy_id=1,
            symbol="BTC/USD",
            side="buy",
            order_type="market",
            amount=0.01,
            is_paper_trade=True
        )
        
        assert result is not None
        
        # Cleanup
        await engine.shutdown()

