Open Haakam21 opened 3 years ago
This breaks in .mean()
:
https://github.com/kernc/backtesting.py/blob/e3cccdfc0fdf8f6f1fe0b5c7b84fd5a2b15fab2d/backtesting/_plotting.py#L113-L118
I'm assuming, is your strategy creating an indicator that is not numeric? Such as:
self.I(np.random.choice, ['a', 'b'], len(self.data))
In some sense you are correct. I am using Tulip and for lagging indicators, it returns shorter arrays. To circumvent this, I pad the array with None
values. This causes the plotting error when resampling. So the fix is to use 0
or some numerical value for padding.
So the fix is to use
0
or some numerical value for padding.
The standard for numeric arrays is NaN: np.nan
.
I think we might want to catch/mitigate this.
Oh ok. Yes, Nan
is better. Sorry for preemptively closing the issue.
Expected Behavior
No errors, plot shows.
Actual Behavior
Steps to Reproduce
Dataframe:
Code:
Additional info