Skip to content

Commit 5996786

Browse files
committed
BUG: Fix filterwarnings in FractionalBacktest
From the docs: > _message_ is a string containing a regular expression > that *the start of the warning message* must match
1 parent 07e2906 commit 5996786

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

backtesting/lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ def __init__(self,
539539
self.__data[col] = self.__data[col] * self._fractional_unit
540540
for col in ('Volume',):
541541
self.__data[col] = self.__data[col] / self._fractional_unit
542-
with warnings.catch_warnings(record=True):
543-
warnings.filterwarnings(action='ignore', message='frac')
542+
with warnings.catch_warnings():
543+
warnings.filterwarnings(action='ignore', message='.*?fraction')
544544
super().__init__(data, *args, **kwargs)
545545

546546
def run(self, **kwargs) -> pd.Series:

0 commit comments

Comments
 (0)