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.
15 lines
286 B
Python
15 lines
286 B
Python
from typing import List
|
|
import pandas as pd
|
|
|
|
|
|
def add_lag_features(df: pd.DataFrame, col: str, lags: List[int]) -> pd.DataFrame:
|
|
result = df.copy()
|
|
|
|
for lag in lags:
|
|
result[f"{col}_lag_{lag}"] = result[col].shift(lag)
|
|
|
|
return result
|
|
|
|
|
|
__all__ = ["add_lag_features"]
|