added fix for insufficient funds error from bitrex, looking at possibility to test it it
This commit is contained in:
parent
743a1f1604
commit
4c0f710a76
@ -14,3 +14,10 @@ class OperationalException(BaseException):
|
||||
Requires manual intervention.
|
||||
This happens when an exchange returns an unexpected error during runtime.
|
||||
"""
|
||||
|
||||
|
||||
class NotEnoughFundsExeption(BaseException):
|
||||
"""
|
||||
This happens when the exchange reports that not enough funds where available. We do not want to stop
|
||||
the bot in this case and just keep it going and suppress this message
|
||||
"""
|
||||
|
@ -5,7 +5,7 @@ from bittrex.bittrex import API_V1_1, API_V2_0
|
||||
from bittrex.bittrex import Bittrex as _Bittrex
|
||||
from requests.exceptions import ContentDecodingError
|
||||
|
||||
from freqtrade import OperationalException
|
||||
from freqtrade import OperationalException, NotEnoughFundsExeption
|
||||
from freqtrade.exchange.interface import Exchange
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -63,6 +63,14 @@ class Bittrex(Exchange):
|
||||
data = _API.buy_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,
|
||||
|
@ -15,8 +15,8 @@ import requests
|
||||
from cachetools import cached, TTLCache
|
||||
|
||||
from freqtrade import (
|
||||
DependencyException, OperationalException, exchange, persistence, __version__
|
||||
)
|
||||
DependencyException, OperationalException, exchange, persistence, __version__,
|
||||
NotEnoughFundsExeption)
|
||||
from freqtrade.analyze import Analyze
|
||||
from freqtrade import constants
|
||||
from freqtrade.fiat_convert import CryptoToFiatConverter
|
||||
@ -24,7 +24,6 @@ from freqtrade.persistence import Trade
|
||||
from freqtrade.rpc.rpc_manager import RPCManager
|
||||
from freqtrade.state import State
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -166,7 +165,11 @@ class FreqtradeBot(object):
|
||||
|
||||
# Then looking for buy opportunities
|
||||
if len(trades) < self.config['max_open_trades']:
|
||||
try:
|
||||
state_changed = self.process_maybe_execute_buy()
|
||||
except NotEnoughFundsExeption:
|
||||
logger.warning('insufficient funds to execute this buy order, ignoring it!')
|
||||
state_changed = False
|
||||
|
||||
if 'unfilledtimeout' in self.config:
|
||||
# Check and handle any timed out open orders
|
||||
@ -176,6 +179,7 @@ class FreqtradeBot(object):
|
||||
except (requests.exceptions.RequestException, json.JSONDecodeError) as error:
|
||||
logger.warning('%s, retrying in 30 seconds...', error)
|
||||
time.sleep(constants.RETRY_TIMEOUT)
|
||||
|
||||
except OperationalException:
|
||||
self.rpc.send_msg(
|
||||
'*Status:* OperationalException:\n```\n{traceback}```{hint}'
|
||||
|
2
freqtrade/tests/testdata/BTC_ADA-5.json
vendored
2
freqtrade/tests/testdata/BTC_ADA-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_DASH-5.json
vendored
2
freqtrade/tests/testdata/BTC_DASH-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_ETC-5.json
vendored
2
freqtrade/tests/testdata/BTC_ETC-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_ETH-5.json
vendored
2
freqtrade/tests/testdata/BTC_ETH-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_LTC-5.json
vendored
2
freqtrade/tests/testdata/BTC_LTC-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_NXT-5.json
vendored
2
freqtrade/tests/testdata/BTC_NXT-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_POWR-5.json
vendored
2
freqtrade/tests/testdata/BTC_POWR-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_XLM-5.json
vendored
2
freqtrade/tests/testdata/BTC_XLM-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_XMR-5.json
vendored
2
freqtrade/tests/testdata/BTC_XMR-5.json
vendored
File diff suppressed because one or more lines are too long
2
freqtrade/tests/testdata/BTC_ZEC-5.json
vendored
2
freqtrade/tests/testdata/BTC_ZEC-5.json
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user