Skip to content

Commit 4fd6ac5

Browse files
committed
address comments
1 parent 5ab6cb3 commit 4fd6ac5

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

backtesting/_plotting.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,7 @@ def _plot_superimposed_ohlc():
425425
if not resample_rule:
426426
warnings.warn(
427427
f"'Can't superimpose OHLC data with rule '{resample_rule}'"
428-
f"(index datetime resolution: '{time_resolution}'). "
429-
"Skipping.",
428+
f"(index datetime resolution: '{time_resolution}'). Skipping.",
430429
stacklevel=4)
431430
return
432431

backtesting/backtesting.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
428-
of current 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 of current
428+
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
@@ -664,7 +664,7 @@ def __set_contingent(self, type, price):
664664
class _Broker:
665665
def __init__(self, *, data, cash, commission, margin,
666666
trade_on_close, hedging, exclusive_orders, index):
667-
assert 0 < cash, f"cash shosuld be >0, is {cash}"
667+
assert 0 < cash, f"cash should be >0, is {cash}"
668668
assert 0 <= commission < .1, f"commission should be between 0-10%, is {commission}"
669669
assert 0 < margin <= 1, f"margin should be between 0 and 1, is {margin}"
670670
self._data = data # type: _Data
@@ -705,12 +705,14 @@ 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(
709+
"Long orders require: "
710+
f"SL ({sl}) < LIMIT ({limit or stop or self.last_price}) < TP ({tp})")
710711
else:
711712
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})")
713+
raise ValueError(
714+
"Short orders require: "
715+
f"TP ({tp}) < LIMIT ({limit or stop or self.last_price}) < SL ({sl})")
714716

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

0 commit comments

Comments
 (0)