working on catching the 'sell insufficient funds error'
This commit is contained in:
parent
00aa1bee9d
commit
4322d40967
@ -82,6 +82,13 @@ class Bittrex(Exchange):
|
||||
data = _API.sell_limit(pair.replace('_', '-'), amount, rate)
|
||||
if not data['success']:
|
||||
Bittrex._validate_response(data)
|
||||
if data['message'] == "INSUFFICIENT_FUNDS":
|
||||
raise NotEnoughFundsExeption('{message} params=({pair}, {rate}, {amount})'.format(
|
||||
message=data['message'],
|
||||
pair=pair,
|
||||
rate=rate,
|
||||
amount=amount))
|
||||
else:
|
||||
raise OperationalException('{message} params=({pair}, {rate}, {amount})'.format(
|
||||
message=data['message'],
|
||||
pair=pair,
|
||||
|
@ -472,6 +472,9 @@ class FreqtradeBot(object):
|
||||
:return: None
|
||||
"""
|
||||
# Execute sell and update trade record
|
||||
|
||||
# check if we have these funds first
|
||||
try:
|
||||
order_id = exchange.sell(str(trade.pair), limit, trade.amount)
|
||||
trade.open_order_id = order_id
|
||||
|
||||
@ -528,3 +531,5 @@ class FreqtradeBot(object):
|
||||
# Send the message
|
||||
self.rpc.send_msg(message)
|
||||
Trade.session.flush()
|
||||
except NotEnoughFundsExeption:
|
||||
logger.warning('Sell order failed, due to not having enough funds for %s.', trade)
|
||||
|
Loading…
Reference in New Issue
Block a user