summaryrefslogtreecommitdiff
path: root/shared/tests/test_models.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 16:24:30 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 16:24:30 +0900
commit100aa624ad3f8ad466a95f9da8af30f31f77cc9c (patch)
treeef81b9f37872ed462a1f84ea238a130f758782d2 /shared/tests/test_models.py
parent73eaf704584e5bf3c4499ccdd574af87304e1e5f (diff)
fix: resolve lint issues and final integration fixes
- Fix ambiguous variable name in binance_rest.py - Remove unused volumes variable in volume_profile_strategy.py - Fix import ordering in backtester main.py and test_metrics.py - Auto-format all files with ruff
Diffstat (limited to 'shared/tests/test_models.py')
-rw-r--r--shared/tests/test_models.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/shared/tests/test_models.py b/shared/tests/test_models.py
index f1d92ec..25ab4c9 100644
--- a/shared/tests/test_models.py
+++ b/shared/tests/test_models.py
@@ -1,6 +1,6 @@
"""Tests for shared models and settings."""
+
import os
-import pytest
from decimal import Decimal
from datetime import datetime, timezone
from unittest.mock import patch
@@ -8,11 +8,15 @@ from unittest.mock import patch
def test_settings_defaults():
"""Test that Settings has correct defaults."""
- with patch.dict(os.environ, {
- "BINANCE_API_KEY": "test_key",
- "BINANCE_API_SECRET": "test_secret",
- }):
+ with patch.dict(
+ os.environ,
+ {
+ "BINANCE_API_KEY": "test_key",
+ "BINANCE_API_SECRET": "test_secret",
+ },
+ ):
from shared.config import Settings
+
settings = Settings()
assert settings.redis_url == "redis://localhost:6379"
assert settings.database_url == "postgresql://trading:trading@localhost:5432/trading"
@@ -26,6 +30,7 @@ def test_settings_defaults():
def test_candle_creation():
"""Test Candle model creation."""
from shared.models import Candle
+
now = datetime.now(timezone.utc)
candle = Candle(
symbol="BTCUSDT",
@@ -49,6 +54,7 @@ def test_candle_creation():
def test_signal_creation():
"""Test Signal model creation."""
from shared.models import Signal, OrderSide
+
signal = Signal(
strategy="rsi_strategy",
symbol="BTCUSDT",
@@ -71,6 +77,7 @@ def test_order_creation():
"""Test Order model creation with defaults."""
from shared.models import Order, OrderSide, OrderType, OrderStatus
import uuid
+
signal_id = str(uuid.uuid4())
order = Order(
signal_id=signal_id,
@@ -90,6 +97,7 @@ def test_order_creation():
def test_position_unrealized_pnl():
"""Test Position unrealized_pnl computed property."""
from shared.models import Position
+
position = Position(
symbol="BTCUSDT",
quantity=Decimal("0.1"),