Skip to content

Commit

Permalink
REF: Minor typing annotation fixes with new mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Dec 12, 2021
1 parent 8b36a6b commit e7981c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backtesting/_util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import warnings
from typing import Dict, List, Optional, Sequence, Union
from typing import Dict, List, Optional, Sequence, Union, cast
from numbers import Number

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

def __get_array(self, key) -> _Array:
arr = self.__cache.get(key)
if arr is None:
arr = self.__cache[key] = self.__arrays[key][:self.__i]
arr = self.__cache[key] = cast(_Array, self.__arrays[key][:self.__i])
return arr

@property
Expand Down

0 comments on commit e7981c7

Please sign in to comment.