mirror of
https://github.com/kernc/backtesting.py.git
synced 2024-01-28 15:29:30 +03:00
BUG: More robust index computation in lib.resample_apply
Fixes https://github.com/kernc/backtesting.py/issues/19
This commit is contained in:
@@ -221,8 +221,10 @@ def resample_apply(rule: str,
|
||||
|
||||
# Resample back to data index
|
||||
def wrap_func(resampled, *args, **kwargs):
|
||||
ind = func(resampled, *args, **kwargs)
|
||||
ind = ind.reindex(index=series.index | ind.index,
|
||||
ind = pd.Series(np.asarray(func(resampled, *args, **kwargs)),
|
||||
index=resampled.index,
|
||||
name=resampled.name)
|
||||
ind = ind.reindex(index=series.index | resampled.index,
|
||||
method='ffill').reindex(series.index)
|
||||
return ind
|
||||
|
||||
|
||||
Reference in New Issue
Block a user