Add FastAPI backend for energy trading system

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.
This commit is contained in:
2026-02-12 00:59:26 +07:00
parent a22a13f6f4
commit fe76bc7629
72 changed files with 2931 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
from typing import List
import pandas as pd
def add_rolling_features(df: pd.DataFrame, col: str, windows: List[int]) -> pd.DataFrame:
result = df.copy()
for window in windows:
result[f"{col}_rolling_mean_{window}"] = result[col].rolling(window=window).mean()
result[f"{col}_rolling_std_{window}"] = result[col].rolling(window=window).std()
result[f"{col}_rolling_min_{window}"] = result[col].rolling(window=window).min()
result[f"{col}_rolling_max_{window}"] = result[col].rolling(window=window).max()
return result
__all__ = ["add_rolling_features"]