simplify some error message statements
This commit is contained in:
parent
160af91f9a
commit
67ad9e9351
@ -109,8 +109,7 @@ class Bittrex(Exchange):
|
|||||||
if not data.get('result') or\
|
if not data.get('result') or\
|
||||||
not all(key in data.get('result', {}) for key in keys) or\
|
not all(key in data.get('result', {}) for key in keys) or\
|
||||||
not all(data.get('result', {})[key] is not None for key in keys):
|
not all(data.get('result', {})[key] is not None for key in keys):
|
||||||
raise ContentDecodingError('{message} params=({pair})'.format(
|
raise ContentDecodingError('Invalid response from Bittrex params=({pair})'.format(
|
||||||
message='Invalid response from Bittrex',
|
|
||||||
pair=pair))
|
pair=pair))
|
||||||
# Update the pair
|
# Update the pair
|
||||||
self.cached_ticker[pair] = {
|
self.cached_ticker[pair] = {
|
||||||
@ -138,16 +137,14 @@ class Bittrex(Exchange):
|
|||||||
|
|
||||||
# These sanity check are necessary because bittrex cannot keep their API stable.
|
# These sanity check are necessary because bittrex cannot keep their API stable.
|
||||||
if not data.get('result'):
|
if not data.get('result'):
|
||||||
raise ContentDecodingError('{message} params=({pair})'.format(
|
raise ContentDecodingError('Invalid response from Bittrex params=({pair})'.format(
|
||||||
message='Invalid response from Bittrex',
|
|
||||||
pair=pair))
|
pair=pair))
|
||||||
|
|
||||||
for prop in ['C', 'V', 'O', 'H', 'L', 'T']:
|
for prop in ['C', 'V', 'O', 'H', 'L', 'T']:
|
||||||
for tick in data['result']:
|
for tick in data['result']:
|
||||||
if prop not in tick.keys():
|
if prop not in tick.keys():
|
||||||
raise ContentDecodingError('{message} params=({pair})'.format(
|
raise ContentDecodingError('Required property {} not present '
|
||||||
message='Required property {} not present in response'.format(prop),
|
'in response params=({})'.format(prop, pair))
|
||||||
pair=pair))
|
|
||||||
|
|
||||||
if not data['success']:
|
if not data['success']:
|
||||||
Bittrex._validate_response(data)
|
Bittrex._validate_response(data)
|
||||||
@ -191,21 +188,21 @@ class Bittrex(Exchange):
|
|||||||
data = _API.get_markets()
|
data = _API.get_markets()
|
||||||
if not data['success']:
|
if not data['success']:
|
||||||
Bittrex._validate_response(data)
|
Bittrex._validate_response(data)
|
||||||
raise OperationalException('{message}'.format(message=data['message']))
|
raise OperationalException(data['message'])
|
||||||
return [m['MarketName'].replace('-', '_') for m in data['result']]
|
return [m['MarketName'].replace('-', '_') for m in data['result']]
|
||||||
|
|
||||||
def get_market_summaries(self) -> List[Dict]:
|
def get_market_summaries(self) -> List[Dict]:
|
||||||
data = _API.get_market_summaries()
|
data = _API.get_market_summaries()
|
||||||
if not data['success']:
|
if not data['success']:
|
||||||
Bittrex._validate_response(data)
|
Bittrex._validate_response(data)
|
||||||
raise OperationalException('{message}'.format(message=data['message']))
|
raise OperationalException(data['message'])
|
||||||
return data['result']
|
return data['result']
|
||||||
|
|
||||||
def get_wallet_health(self) -> List[Dict]:
|
def get_wallet_health(self) -> List[Dict]:
|
||||||
data = _API_V2.get_wallet_health()
|
data = _API_V2.get_wallet_health()
|
||||||
if not data['success']:
|
if not data['success']:
|
||||||
Bittrex._validate_response(data)
|
Bittrex._validate_response(data)
|
||||||
raise OperationalException('{message}'.format(message=data['message']))
|
raise OperationalException(data['message'])
|
||||||
return [{
|
return [{
|
||||||
'Currency': entry['Health']['Currency'],
|
'Currency': entry['Health']['Currency'],
|
||||||
'IsActive': entry['Health']['IsActive'],
|
'IsActive': entry['Health']['IsActive'],
|
||||||
|
Loading…
Reference in New Issue
Block a user