initial test added for TSL on exchange

This commit is contained in:
misagh
2019-01-15 11:04:32 +01:00
parent e025ad3918
commit cfe00c2f0c
3 changed files with 29 additions and 18 deletions

View File

@@ -222,11 +222,13 @@ class Trade(_DECL_BASE):
logger.debug("assigning new stop loss")
self.stop_loss = new_loss
self.initial_stop_loss = new_loss
self.stoploss_last_update = datetime.utcnow()
# evaluate if the stop loss needs to be updated
else:
if new_loss > self.stop_loss: # stop losses only walk up, never down!
self.stop_loss = new_loss
self.stoploss_last_update = datetime.utcnow()
logger.debug("adjusted stop loss")
else:
logger.debug("keeping current stop loss")