Address some PR comments

This commit is contained in:
xmatthias 2018-07-01 19:54:26 +02:00
parent d5ad066f8d
commit e39d88ef65
2 changed files with 4 additions and 10 deletions

View File

@ -62,7 +62,7 @@ CONF_SCHEMA = {
},
'stoploss': {'type': 'number', 'maximum': 0, 'exclusiveMaximum': True},
'trailing_stop': {'type': 'boolean'},
'trailing_stop_positive': {'type': 'number', 'minimum': 0},
'trailing_stop_positive': {'type': 'number', 'minimum': 0, 'maximum': 1},
'unfilledtimeout': {'type': 'integer', 'minimum': 0},
'bid_strategy': {
'type': 'object',

View File

@ -184,14 +184,8 @@ class Trade(_DECL_BASE):
arrow.get(self.open_date).humanize() if self.is_open else 'closed'
)
def adjust_stop_loss(self, current_price: float, stoploss: float, initial: bool =False):
"""
this adjusts the stop loss to it's most recently observed setting
:param current_price:
:param stoploss in percent:
:param initial:
:return:
"""
def adjust_stop_loss(self, current_price: float, stoploss: float, initial: bool = False):
"""this adjusts the stop loss to it's most recently observed setting"""
if initial and not (self.stop_loss is None or self.stop_loss == 0):
# Don't modify if called with initial and nothing to do
@ -207,7 +201,7 @@ class Trade(_DECL_BASE):
self.max_rate = current_price
# no stop loss assigned yet
if self.stop_loss is None or self.stop_loss == 0:
if not self.stop_loss:
logger.debug("assigning new stop loss")
self.stop_loss = new_loss
self.initial_stop_loss = new_loss