vectorbt
vectorbt copied to clipboard
Type must be <class 'vectorbt.utils.decorators.CacheCondition'>, not <class 'collections.CacheCondition'>
I'm trying to run an example from the doc
price = pd.Series([1, 2, 3, 4, 5], dtype=float)
vbt.MA.run(price, [2, 3]).ma
but is met with this assertion error
AssertionError: Type must be <class 'vectorbt.utils.decorators.CacheCondition'>, not <class 'collections.CacheCondition'>
Hi @n1cola2222, please print the entire error with stack trace.
Here you go:
vbt.MA.run(price, [2, 3]).ma Traceback (most recent call last):
Input In [47] in <cell line: 1> vbt.MA.run(price, [2, 3]).ma
File C:\ProgramData\Anaconda3\lib\site-packages\vectorbt\indicators\factory.py:2395 in output_prop return self.wrapper.wrap(getattr(self, '_' + _output_name))
File C:\ProgramData\Anaconda3\lib\site-packages\vectorbt\base\array_wrapper.py:532 in wrap _self = self.resolve(group_by=group_by)
File C:\ProgramData\Anaconda3\lib\site-packages\vectorbt\utils\decorators.py:418 in wrapper if not should_cache(wrapper.name, instance, func=_func, **wrapper.flags):
File C:\ProgramData\Anaconda3\lib\site-packages\vectorbt\utils\decorators.py:279 in should_cache white_rank = min(white_rank, _get_condition_rank(cond))
File C:\ProgramData\Anaconda3\lib\site-packages\vectorbt\utils\decorators.py:197 in _get_condition_rank checks.assert_instance_of(cond, CacheCondition)
File C:\ProgramData\Anaconda3\lib\site-packages\vectorbt\utils\checks.py:311 in assert_instance_of raise AssertionError(f"Type must be {types}, not {type(arg)}")
AssertionError: Type must be <class 'vectorbt.utils.decorators.CacheCondition'>, not <class 'collections.CacheCondition'>