33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
"""Tests for paper trading simulator."""
|
|
|
|
import pytest
|
|
from decimal import Decimal
|
|
from unittest.mock import Mock
|
|
from src.trading.paper_trading import get_paper_trading, PaperTradingSimulator
|
|
from src.core.database import Order, OrderSide, OrderType
|
|
|
|
|
|
class TestPaperTradingSimulator:
|
|
"""Tests for PaperTradingSimulator."""
|
|
|
|
@pytest.fixture
|
|
def simulator(self):
|
|
"""Create paper trading simulator."""
|
|
return PaperTradingSimulator(initial_capital=Decimal('1000.0'))
|
|
|
|
def test_initialization(self, simulator):
|
|
"""Test simulator initialization."""
|
|
assert simulator.initial_capital == Decimal('1000.0')
|
|
assert simulator.cash == Decimal('1000.0')
|
|
|
|
def test_get_balance(self, simulator):
|
|
"""Test getting balance."""
|
|
balance = simulator.get_balance()
|
|
assert balance == Decimal('1000.0')
|
|
|
|
def test_get_positions(self, simulator):
|
|
"""Test getting positions."""
|
|
positions = simulator.get_positions()
|
|
assert isinstance(positions, list)
|
|
|