vectorbt
vectorbt copied to clipboard
AttributeError: 'MA' object has no attribute 'ma_crossed_above'
Run example code and got the error, use dir to dump the fast_ma object not see the attribute. What I missing?
2 fast_ma = vbt.MA.run(price, 50, short_name='fast_ma')
3 slow_ma = vbt.MA.run(price, 200, short_name='slow_ma')
----> 4 entries = fast_ma.ma_crossed_above(slow_ma) 5 exits = fast_ma.ma_crossed_below(slow_ma) 6 pf = vbt.Portfolio.from_signals(price, entries, exits, fees=0.005)
AttributeError: 'MA' object has no attribute 'ma_crossed_above'
dir(fast_ma) don't show "ma_crossed_above" method defined
['annotations', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'getitem', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_close', '_config', '_ewm_list', '_ewm_loc', '_ewm_mapper', '_iloc', '_in_output_names', '_indexing_kwargs', '_input_mapper', '_input_names', '_level_names', '_loc', '_ma', '_metrics', '_output_flags', '_output_names', '_param_names', '_run', '_run_combs', '_short_name', '_subplots', '_tuple_loc', '_tuple_mapper', '_window_list', '_window_loc', '_window_mapper', '_wrapper', 'apply_func', 'build_metrics_doc', 'build_subplots_doc', 'close', 'close_above', 'close_below', 'close_equal', 'close_stats', 'config', 'copy', 'custom_func', 'deep_getattr', 'dumps', 'ewm_list', 'ewm_loc', 'iloc', 'in_output_names', 'indexing_func', 'indexing_kwargs', 'input_names', 'level_names', 'load', 'loads', 'loc', 'ma', 'ma_above', 'ma_below', 'ma_equal', 'ma_stats', 'metrics', 'output_flags', 'output_names', 'override_metrics_doc', 'override_subplots_doc', 'param_names', 'plot', 'plots', 'plots_defaults', 'post_resolve_attr', 'pre_resolve_attr', 'regroup', 'replace', 'resolve_attr', 'resolve_self', 'run', 'run_combs', 'save', 'select_one', 'select_one_from_obj', 'self_aliases', 'short_name', 'stats', 'stats_defaults', 'subplots', 'to_doc', 'tuple_loc', 'update_config', 'window_list', 'window_loc', 'wrapper', 'writeable_attrs', 'xs']
@jihuang-taipei make sure to update to the lastest version of vectorbt.
Thanks, uninstall and then did a full install to resolve this issue - pip install -U "vectorbt[full]"