@@ -405,18 +405,20 @@ def _replace(self, **kwargs):
405
405
setattr (self , f'_{ self .__class__ .__qualname__ } __{ k } ' , v )
406
406
return self
407
407
408
+
408
409
def __repr__ (self ):
409
- return '<Order {}>' .format (', ' .join (f'{ param } ={ round ( value , 5 ) } '
410
+ return '<Order {}>' .format (', ' .join (f'{ param } ={ value } '
410
411
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 ),
416
417
('contingent' , self .is_contingent ),
417
418
('tag' , self .__tag ),
418
419
) if value is not None ))
419
420
421
+
420
422
def cancel (self ):
421
423
"""Cancel the order."""
422
424
self .__broker .orders .remove (self )
0 commit comments