if buy order is rejected or expired the bot should exit the buy loop

This commit is contained in:
misagh 2018-11-27 19:05:59 +01:00
parent 3131788639
commit 4ffc74d5fa

View File

@ -474,9 +474,21 @@ class FreqtradeBot(object):
amount = stake_amount / buy_limit
order_id = self.exchange.buy(pair=pair, ordertype=self.strategy.order_types['buy'],
order = self.exchange.buy(pair=pair, ordertype=self.strategy.order_types['buy'],
amount=amount, rate=buy_limit,
time_in_force=self.strategy.order_time_in_force['buy'])['id']
time_in_force=self.strategy.order_time_in_force['buy'])
order_id = order['id']
order_info = order['info']
# check if order is expired (in case of FOC or IOC orders)
# or rejected by the exchange.
if order_info['status'] == 'EXPIRED' or order_info['status'] == 'REJECTED':
order_type = self.strategy.order_types['buy']
status = order_info['status']
logger.warning('Buy %s order for %s is %s by %s.',
order_type, pair_s, status, self.exchange.name)
return False
self.rpc.send_msg({
'type': RPCMessageType.BUY_NOTIFICATION,