added fix for insufficient funds error from bitrex, looking at possibility to test it it

This commit is contained in:
Gert Wohlgemuth
2018-05-01 22:12:14 -07:00
parent 743a1f1604
commit 4c0f710a76
13 changed files with 57 additions and 38 deletions

View File

@@ -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,11 +63,19 @@ class Bittrex(Exchange):
data = _API.buy_limit(pair.replace('_', '-'), amount, rate)
if not data['success']:
Bittrex._validate_response(data)
raise OperationalException('{message} params=({pair}, {rate}, {amount})'.format(
message=data['message'],
pair=pair,
rate=rate,
amount=amount))
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,
rate=rate,
amount=amount))
return data['result']['uuid']
def sell(self, pair: str, rate: float, amount: float) -> str: