@@ -91,8 +91,8 @@ def I(self, # noqa: E743
91
91
92
92
In the plot legend, the indicator is labeled with
93
93
function name, unless `name` overrides it. If `func` returns
94
- multiple arrays, `name` can be a collection of strings, and
95
- the size must agree with the number of arrays returned.
94
+ multiple arrays, `name` can be a sequence of strings, and
95
+ its size must agree with the number of arrays returned.
96
96
97
97
If `plot` is `True`, the indicator is plotted on the resulting
98
98
`backtesting.backtesting.Backtest.plot`.
@@ -130,8 +130,7 @@ def _format_name(name: str) -> str:
130
130
elif try_ (lambda : all (isinstance (item , str ) for item in name ), False ):
131
131
name = [_format_name (item ) for item in name ]
132
132
else :
133
- raise TypeError (f'Unexpected `name` type { type (name )} , `str` or `Iterable[str]` '
134
- 'was expected.' )
133
+ raise TypeError (f'Unexpected `name=` type { type (name )} ; expected `str` or `Sequence[str]`' )
135
134
136
135
try :
137
136
value = func (* args , ** kwargs )
@@ -151,8 +150,8 @@ def _format_name(name: str) -> str:
151
150
152
151
if isinstance (name , list ) and (value .ndim != 2 or value .shape [0 ] != len (name )):
153
152
raise ValueError (
154
- f'The number of `name` elements ({ len (name )} ) must agree with the nubmer '
155
- f 'of arrays ({ value .shape [0 ]} ) the indicator returns .' )
153
+ f'Length of `name=` ({ len (name )} ) must agree with the number '
154
+ 'of arrays the indicator returns ({value.shape[0]}).' )
156
155
157
156
if not is_arraylike or not 1 <= value .ndim <= 2 or value .shape [- 1 ] != len (self ._data .Close ):
158
157
raise ValueError (
0 commit comments