"""End-to-end tests for paper trading."""

import pytest
from src.trading.paper_trading import get_paper_trading
from src.trading.engine import get_trading_engine


@pytest.mark.e2e
class TestPaperTradingE2E:
    """End-to-end tests for paper trading."""
    
    @pytest.mark.asyncio
    async def test_paper_trading_scenario(self):
        """Test complete paper trading scenario."""
        # Initialize
        paper_trading = get_paper_trading()
        engine = get_trading_engine()
        await engine.initialize()
        
        # Place buy order
        result1 = await engine.execute_trade(
            exchange_name="paper_trading",
            strategy_id=1,
            symbol="BTC/USD",
            side="buy",
            order_type="market",
            amount=0.01,
            price=50000.0,
            is_paper_trade=True
        )
        
        assert result1 is not None
        
        # Place sell order
        result2 = await engine.execute_trade(
            exchange_name="paper_trading",
            strategy_id=1,
            symbol="BTC/USD",
            side="sell",
            order_type="market",
            amount=0.01,
            price=51000.0,
            is_paper_trade=True
        )
        
        assert result2 is not None
        
        # Check balance
        balance = paper_trading.get_balance()
        assert balance is not None

