32 lines
988 B
Python
32 lines
988 B
Python
"""Integration tests for portfolio tracking."""
|
|
|
|
import pytest
|
|
from decimal import Decimal
|
|
from src.portfolio.tracker import get_portfolio_tracker
|
|
from src.trading.paper_trading import get_paper_trading
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestPortfolioTracking:
|
|
"""Integration tests for portfolio tracking."""
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_portfolio_tracking_workflow(self):
|
|
"""Test portfolio tracking workflow."""
|
|
tracker = get_portfolio_tracker()
|
|
paper_trading = get_paper_trading()
|
|
|
|
# Get initial portfolio
|
|
portfolio1 = await tracker.get_current_portfolio(paper_trading=True)
|
|
|
|
# Portfolio should have structure
|
|
assert "positions" in portfolio1
|
|
assert "performance" in portfolio1
|
|
|
|
# Get updated portfolio
|
|
portfolio2 = await tracker.get_current_portfolio(paper_trading=True)
|
|
|
|
# Should return valid portfolio
|
|
assert portfolio2 is not None
|
|
|