Output index differs from input index (stoch, td_seq)
See original GitHub issueHello @twopirllc,
upon releasing vectorbt v0.20 I noticed some pandas-ta tests failing. As you know, I previously created a simple parser to extract the meta of each pandas-ta indicator (it builds a dummy DataFrame with 50 random floating elements and passes it to pandas-ta to see what outputs to expect). The parser started to fail for some of the indicators:
>>> import vectorbt as vbt
>>> vbt.IndicatorFactory.get_pandas_ta_indicators(silence_warnings=False)
Function stoch: Couldn't parse the output: mismatching index
Function td_seq: Couldn't parse the output: mismatching index
Function trix: Couldn't parse the indicator: inputs are all NaN
Function ichimoku: 'NoneType' object has no attribute 'index'
UserWarning: Function kvo: 'NoneType' object has no attribute 'index'
I can’t remember which ones I wasn’t able to parse previously (probably Ichimoku), but the new ones are definitely stoch
and td_seq
. Upon looking closer, I noticed that stoch
removes head entries that are NaN, while td_seq
returns a simple range index instead of a datetime-like index.
To address this, I can quickly patch vectorbt to 1) fill the missing index if the output index is of the same type and 2) copy the input index if the output index has another type but the same length.
Would love to hear your thoughts on this matter.
Edit: I’m running 0.3.14b0
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@twopirllc,
perfect, I’ll look into the other two and maybe tweak the parser a bit. Thank you!
@bennycode,
It has the required inputs to calculate
ta.stoch
as described inhelp(ta.stoch)
, which is closer to 7. Some (offset, fillna, fill_method
) you won’t use unless you actually need them.Is
ta.stoch
not working as expected?However, I should probably add another
mamode
like TA-Lib does:Kind Regards, KJ