@@ -405,18 +405,20 @@ def _replace(self, **kwargs):
405405 setattr (self , f'_{ self .__class__ .__qualname__ } __{ k } ' , v )
406406 return self
407407
408+
408409 def __repr__ (self ):
409- return '<Order {}>' .format (', ' .join (f'{ param } ={ round ( value , 5 ) } '
410+ return '<Order {}>' .format (', ' .join (f'{ param } ={ value } '
410411 for param , value in (
411- ('size' , self .__size ),
412- ('limit' , self .__limit_price ),
413- ('stop' , self .__stop_price ),
414- ('sl' , self .__sl_price ),
415- ('tp' , self .__tp_price ),
412+ ('size' , round ( self .__size , 5 ) ),
413+ ('limit' , round ( self .__limit_price , 5 ) if self . __limit_price is not None else None ),
414+ ('stop' , round ( self .__stop_price , 5 ) if self . __stop_price is not None else None ),
415+ ('sl' , round ( self .__sl_price , 5 ) if self . __sl_price is not None else None ),
416+ ('tp' , round ( self .__tp_price , 0 ) if self . __tp_price is not None else None ),
416417 ('contingent' , self .is_contingent ),
417418 ('tag' , self .__tag ),
418419 ) if value is not None ))
419420
421+
420422 def cancel (self ):
421423 """Cancel the order."""
422424 self .__broker .orders .remove (self )
0 commit comments