Add daily derived data pipeline
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
"""Base class for daily derived-data plugins."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class BaseDerivedData(ABC):
|
||||
"""Compute daily, symbol-keyed numeric derived data.
|
||||
|
||||
Derived-data plugins may use daily bars, minute bars, or both as inputs, but
|
||||
they must always return daily rows keyed by ``symbol_id,date``.
|
||||
"""
|
||||
|
||||
#: Unique registry key. Every concrete derived-data plugin must set this.
|
||||
name: str = ""
|
||||
|
||||
@abstractmethod
|
||||
def compute(
|
||||
self,
|
||||
daily: pd.DataFrame | None = None,
|
||||
minute: pd.DataFrame | None = None,
|
||||
) -> pd.DataFrame:
|
||||
"""Compute daily derived data.
|
||||
|
||||
Args:
|
||||
daily: Optional daily market data.
|
||||
minute: Optional raw minute bars.
|
||||
|
||||
Returns:
|
||||
DataFrame with ``symbol_id``, ``date``, and one or more numeric
|
||||
derived-data columns.
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
params = ", ".join(f"{k}={v!r}" for k, v in vars(self).items())
|
||||
return f"{type(self).__name__}({params})"
|
||||
|
||||
Reference in New Issue
Block a user