Address some PR comments
This commit is contained in:
parent
d5ad066f8d
commit
e39d88ef65
@ -62,7 +62,7 @@ CONF_SCHEMA = {
|
|||||||
},
|
},
|
||||||
'stoploss': {'type': 'number', 'maximum': 0, 'exclusiveMaximum': True},
|
'stoploss': {'type': 'number', 'maximum': 0, 'exclusiveMaximum': True},
|
||||||
'trailing_stop': {'type': 'boolean'},
|
'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},
|
'unfilledtimeout': {'type': 'integer', 'minimum': 0},
|
||||||
'bid_strategy': {
|
'bid_strategy': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
@ -184,14 +184,8 @@ class Trade(_DECL_BASE):
|
|||||||
arrow.get(self.open_date).humanize() if self.is_open else 'closed'
|
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):
|
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"""
|
||||||
this adjusts the stop loss to it's most recently observed setting
|
|
||||||
:param current_price:
|
|
||||||
:param stoploss in percent:
|
|
||||||
:param initial:
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
|
|
||||||
if initial and not (self.stop_loss is None or self.stop_loss == 0):
|
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
|
# Don't modify if called with initial and nothing to do
|
||||||
@ -207,7 +201,7 @@ class Trade(_DECL_BASE):
|
|||||||
self.max_rate = current_price
|
self.max_rate = current_price
|
||||||
|
|
||||||
# no stop loss assigned yet
|
# 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")
|
logger.debug("assigning new stop loss")
|
||||||
self.stop_loss = new_loss
|
self.stop_loss = new_loss
|
||||||
self.initial_stop_loss = new_loss
|
self.initial_stop_loss = new_loss
|
||||||
|
Loading…
Reference in New Issue
Block a user