refactoring
This commit is contained in:
parent
89eb3d9f36
commit
dedf1ff703
@ -669,6 +669,7 @@ class FreqtradeBot(object):
|
|||||||
# Check uf trade is fulfulled in which case the stoploss
|
# Check uf trade is fulfulled in which case the stoploss
|
||||||
# on exchange should be added immediately if stoploss on exchnage
|
# on exchange should be added immediately if stoploss on exchnage
|
||||||
# is on
|
# is on
|
||||||
|
result = False
|
||||||
if trade.is_open and trade.open_order_id is None and trade.stoploss_order_id is None:
|
if trade.is_open and trade.open_order_id is None and trade.stoploss_order_id is None:
|
||||||
if self.edge:
|
if self.edge:
|
||||||
stoploss = self.edge.stoploss(pair=trade.pair)
|
stoploss = self.edge.stoploss(pair=trade.pair)
|
||||||
@ -684,9 +685,7 @@ class FreqtradeBot(object):
|
|||||||
stoploss_order_id = self.exchange.stoploss_limit(
|
stoploss_order_id = self.exchange.stoploss_limit(
|
||||||
pair=trade.pair, amount=trade.amount, stop_price=stop_price, rate=limit_price
|
pair=trade.pair, amount=trade.amount, stop_price=stop_price, rate=limit_price
|
||||||
)['id']
|
)['id']
|
||||||
|
|
||||||
trade.stoploss_order_id = str(stoploss_order_id)
|
trade.stoploss_order_id = str(stoploss_order_id)
|
||||||
return False
|
|
||||||
|
|
||||||
# Or Check if there is a stoploss on exchnage and it is hit
|
# Or Check if there is a stoploss on exchnage and it is hit
|
||||||
elif trade.stoploss_order_id:
|
elif trade.stoploss_order_id:
|
||||||
@ -695,9 +694,10 @@ class FreqtradeBot(object):
|
|||||||
if order['status'] == 'closed':
|
if order['status'] == 'closed':
|
||||||
trade.sell_reason = SellType.STOPLOSS_ON_EXCHNAGE.value
|
trade.sell_reason = SellType.STOPLOSS_ON_EXCHNAGE.value
|
||||||
trade.update(order)
|
trade.update(order)
|
||||||
return True
|
result = True
|
||||||
else:
|
else:
|
||||||
return False
|
result = False
|
||||||
|
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:
|
||||||
if self.edge:
|
if self.edge:
|
||||||
|
Loading…
Reference in New Issue
Block a user