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:
14
backend/app/ml/features/lag_features.py
Normal file
14
backend/app/ml/features/lag_features.py
Normal file
@@ -0,0 +1,14 @@
|
||||
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"]
|
||||
Reference in New Issue
Block a user