Implements FastAPI backend with ML model support for energy trading, including price prediction models and RL-based battery trading policy. Features dashboard, trading, backtest, and settings API routes with WebSocket support for real-time updates.
33 lines
668 B
Python
33 lines
668 B
Python
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from app.main import app
|
|
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
return TestClient(app)
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_price_data():
|
|
return {
|
|
"timestamp": "2024-01-01T00:00:00",
|
|
"region": "FR",
|
|
"day_ahead_price": 50.0,
|
|
"real_time_price": 55.0,
|
|
"volume_mw": 1000.0,
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_battery_state():
|
|
return {
|
|
"timestamp": "2024-01-01T00:00:00",
|
|
"battery_id": "battery_1",
|
|
"capacity_mwh": 100.0,
|
|
"charge_level_mwh": 50.0,
|
|
"charge_rate_mw": 50.0,
|
|
"discharge_rate_mw": 50.0,
|
|
"efficiency": 0.9,
|
|
}
|