Local changes: Updated model training, removed debug instrumentation, and configuration improvements
This commit is contained in:
45
tests/unit/strategies/test_macd_strategy.py
Normal file
45
tests/unit/strategies/test_macd_strategy.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""Tests for MACD strategy."""
|
||||
|
||||
import pytest
|
||||
import pandas as pd
|
||||
from src.strategies.technical.macd_strategy import MACDStrategy
|
||||
|
||||
|
||||
class TestMACDStrategy:
|
||||
"""Tests for MACDStrategy."""
|
||||
|
||||
@pytest.fixture
|
||||
def strategy(self):
|
||||
"""Create MACD strategy instance."""
|
||||
return MACDStrategy(
|
||||
strategy_id=1,
|
||||
name="test_macd",
|
||||
symbol="BTC/USD",
|
||||
timeframe="1h",
|
||||
parameters={
|
||||
"fast_period": 12,
|
||||
"slow_period": 26,
|
||||
"signal_period": 9
|
||||
}
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_macd_strategy_initialization(self, strategy):
|
||||
"""Test MACD strategy initialization."""
|
||||
assert strategy.fast_period == 12
|
||||
assert strategy.slow_period == 26
|
||||
assert strategy.signal_period == 9
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_signal(self, strategy):
|
||||
"""Test signal generation."""
|
||||
# Create minimal data
|
||||
data = pd.DataFrame({
|
||||
'close': [100 + i * 0.1 for i in range(50)]
|
||||
})
|
||||
strategy.current_data = data
|
||||
|
||||
signal = await strategy.generate_signal()
|
||||
assert "signal" in signal
|
||||
assert signal["signal"] in ["buy", "sell", "hold"]
|
||||
|
||||
Reference in New Issue
Block a user