@@ -424,8 +424,8 @@ def size(self) -> float:
424
424
"""
425
425
Order size (negative for short orders).
426
426
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).
429
429
A value greater than or equal to 1 indicates an absolute number of units.
430
430
"""
431
431
return self .__size
@@ -664,7 +664,7 @@ def __set_contingent(self, type, price):
664
664
class _Broker :
665
665
def __init__ (self , * , data , cash , commission , margin ,
666
666
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 } "
668
668
assert 0 <= commission < .1 , f"commission should be between 0-10%, is { commission } "
669
669
assert 0 < margin <= 1 , f"margin should be between 0 and 1, is { margin } "
670
670
self ._data = data # type: _Data
@@ -705,12 +705,14 @@ def new_order(self,
705
705
706
706
if is_long :
707
707
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 } )" )
710
711
else :
711
712
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 } )" )
714
716
715
717
order = Order (self , size , limit , stop , sl , tp , trade )
716
718
# Put the new order in the order queue,
0 commit comments