diff --git a/backtesting/backtesting.py b/backtesting/backtesting.py index 9c168703..bd76d55e 100644 --- a/backtesting/backtesting.py +++ b/backtesting/backtesting.py @@ -24,7 +24,9 @@ try: from tqdm.auto import tqdm as _tqdm + from tqdm.auto import trange as _trange _tqdm = partial(_tqdm, leave=False) + _trange = partial(_trange, leave=False) except ImportError: def _tqdm(seq, **_): return seq @@ -1202,7 +1204,7 @@ def run(self, **kwargs) -> pd.Series: # np.nan >= 3 is not invalid; it's False. with np.errstate(invalid='ignore'): - for i in range(start, len(self._data)): + for i in _trange(start, len(self._data),): # Prepare data and indicators for `next` call data._set_length(i + 1) for attr, indicator in indicator_attrs: