Skip to content

Commit 6c633bc

Browse files
authored
Update backtesting.py
1 parent 732068a commit 6c633bc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

backtesting/backtesting.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def init():
145145
if not is_arraylike or not 1 <= value.ndim <= 2 or value.shape[-1] != len(self._data.Close):
146146
raise ValueError(
147147
'Indicators must return (optionally a tuple of) numpy.arrays of same '
148-
f'length as `data` (data shape: {self._data.Close.shape}; indicator "{name}"' \
148+
f'length as `data` (data shape: {self._data.Close.shape}; indicator "{name}"'
149149
f'shape: {getattr(value, "shape" , "")}, returned value: {value})')
150150

151151
if plot and overlay is None and np.issubdtype(value.dtype, np.number):
@@ -424,8 +424,8 @@ def size(self) -> float:
424424
"""
425425
Order size (negative for short orders).
426426
427-
If size is a value between 0 and 1, it is interpreted as a fraction of current
428-
available liquidity (cash plus `Position.pl` minus used margin).
427+
If size is a value between 0 and 1, it is interpreted as a fraction
428+
of current available liquidity (cash plus `Position.pl` minus used margin).
429429
A value greater than or equal to 1 indicates an absolute number of units.
430430
"""
431431
return self.__size
@@ -705,12 +705,12 @@ def new_order(self,
705705

706706
if is_long:
707707
if not (sl or -np.inf) <= (limit or stop or self.last_price) <= (tp or np.inf):
708-
raise ValueError(f"Long orders require:"
709-
f"SL ({sl}) < LIMIT ({limit or stop or self.last_price}) < TP ({tp})")
708+
raise ValueError(f"Long orders require: "
709+
f"SL ({sl}) < LIMIT ({limit or stop or self.last_price}) < TP ({tp})")
710710
else:
711711
if not (tp or -np.inf) <= (limit or stop or self.last_price) <= (sl or np.inf):
712-
raise ValueError(f"Short orders require: "
713-
f"TP ({tp}) < LIMIT ({limit or stop or self.last_price}) < SL ({sl})")
712+
raise ValueError(f"Short orders require: "
713+
f"TP ({tp}) < LIMIT ({limit or stop or self.last_price}) < SL ({sl})")
714714

715715
order = Order(self, size, limit, stop, sl, tp, trade)
716716
# Put the new order in the order queue,

0 commit comments

Comments
 (0)