mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-02 21:57:46 +00:00
8dd2d88740
* chore(Linter): reformatted code with black * Create black.yaml
11 lines
340 B
Python
11 lines
340 B
Python
import pandas as pd
|
|
from data_loader.types import ForwardReturnSeries
|
|
|
|
|
|
def create_forward_returns(series: pd.Series, period: int) -> ForwardReturnSeries:
|
|
assert period > 0
|
|
indexer = pd.api.indexers.FixedForwardWindowIndexer(window_size=period)
|
|
|
|
forward_returns = series.rolling(window=indexer).sum()
|
|
return forward_returns
|