adjusting trailing stoploss on exchange
This commit is contained in:
parent
c8d40e81f0
commit
821e299afb
@ -648,7 +648,17 @@ class FreqtradeBot(object):
|
|||||||
trade.update(order)
|
trade.update(order)
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
result = False
|
# check if trailing stoploss is enabled and stoploss value has changed
|
||||||
|
# in which case we cancel stoploss order and put another one with new
|
||||||
|
# value immediately
|
||||||
|
if self.config.get('trailing_stop', False) and trade.stop_loss > order['price']:
|
||||||
|
if self.exchange.cancel_order(order['id'], trade.pair):
|
||||||
|
stoploss_order_id = self.exchange.stoploss_limit(
|
||||||
|
pair=trade.pair, amount=trade.amount,
|
||||||
|
stop_price=stop_price, rate=limit_price
|
||||||
|
)['id']
|
||||||
|
trade.stoploss_order_id = str(stoploss_order_id)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def check_sell(self, trade: Trade, sell_rate: float, buy: bool, sell: bool) -> bool:
|
def check_sell(self, trade: Trade, sell_rate: float, buy: bool, sell: bool) -> bool:
|
||||||
|
Loading…
Reference in New Issue
Block a user