diff --git a/Base/Library/CONDccxt.py b/Base/Library/CONDccxt.py index 7b2a333..1664750 100755 --- a/Base/Library/CONDccxt.py +++ b/Base/Library/CONDccxt.py @@ -171,6 +171,7 @@ def OrderProcessor(Orphan): relay.JRLog.Write(LogMSG,stdOut=False) resp=relay.GetOrderDetails(id=oid,symbol=relay.Order['Asset']) # Order must be closed as it succedded + relay.JRLog.Write(json.dumps(resp),stdOut=False) sprice=float(resp['price']) # find trade close time and duration @@ -187,9 +188,9 @@ def OrderProcessor(Orphan): rpl=round((amount*price)-(amount*sprice),8) else: if spricesl: # ticker['Ask'] - rpl=round((amount*sprice)-(amount*price),8) + rpl=round((abs(amount)*sprice)-(abs(amount)*price),8) # rpl is reported by broker. This is the actual profit/loss of trade. if rpl>=0: diff --git a/Base/Library/CONDmimic.py b/Base/Library/CONDmimic.py index 0580873..66b5287 100755 --- a/Base/Library/CONDmimic.py +++ b/Base/Library/CONDmimic.py @@ -168,6 +168,7 @@ def OrderProcessor(Orphan): resp=relay.GetOrderDetails(id=oid,symbol=relay.Order['Asset']) # Order must be closed as it succedded newOrder['ID']=oid + relay.JRLog.Write(json.dumps(resp),stdOut=False) sprice=float(resp['Price']) # find trade close time and duration @@ -178,15 +179,15 @@ def OrderProcessor(Orphan): rpl=0 if dir=='long': - if sprice>tp: # ticker['Bid'] - rpl=round((amount*sprice)-(amount*price),8) - if sl!=0 and spricetp + rpl=round((abs(amount)*sprice)-(abs(amount)*price),8) + if sl!=0 and ticker['Bid']sl: # ticker['Ask'] - rpl=round((amount*sprice)-(amount*price),8) + if ticker['Ask']sl + rpl=round((abs(amount)*sprice)-(abs(amount)*price),8) # rpl is reported by broker. This is the actual profit/loss of trade. if rpl>=0: