Skip to content

Commit e7981c7

Browse files
committed
REF: Minor typing annotation fixes with new mypy
1 parent 8b36a6b commit e7981c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backtesting/_util.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import warnings
2-
from typing import Dict, List, Optional, Sequence, Union
2+
from typing import Dict, List, Optional, Sequence, Union, cast
33
from numbers import Number
44

55
import numpy as np
@@ -153,14 +153,14 @@ def df(self) -> pd.DataFrame:
153153
@property
154154
def pip(self) -> float:
155155
if self.__pip is None:
156-
self.__pip = 10**-np.median([len(s.partition('.')[-1])
157-
for s in self.__arrays['Close'].astype(str)])
156+
self.__pip = float(10**-np.median([len(s.partition('.')[-1])
157+
for s in self.__arrays['Close'].astype(str)]))
158158
return self.__pip
159159

160160
def __get_array(self, key) -> _Array:
161161
arr = self.__cache.get(key)
162162
if arr is None:
163-
arr = self.__cache[key] = self.__arrays[key][:self.__i]
163+
arr = self.__cache[key] = cast(_Array, self.__arrays[key][:self.__i])
164164
return arr
165165

166166
@property

0 commit comments

Comments
 (0)