don't raise exceptions from get_ticker_history

This commit is contained in:
Matthias Voppichler 2018-03-25 13:01:33 +02:00
parent b07ee26e08
commit dbb0a6261f
1 changed files with 5 additions and 9 deletions

View File

@ -185,10 +185,8 @@ def get_ticker_history(pair: str, tick_interval) -> List[Dict]:
# TODO: tickers need to be in format 1m,5m # TODO: tickers need to be in format 1m,5m
# fetch_ohlcv returns an [[datetime,o,h,l,c,v]] # fetch_ohlcv returns an [[datetime,o,h,l,c,v]]
if 'fetchOHLCV' not in _API.has or not _API.has['fetchOHLCV']: if 'fetchOHLCV' not in _API.has or not _API.has['fetchOHLCV']:
raise OperationalException( logger.warning('Exhange %s does not support fetching historical candlestick data.', _API.name)
'Exhange {} does not support fetching historical candlestick data.'.format( return []
_API.name)
)
try: try:
history = _API.fetch_ohlcv(pair, timeframe=str(tick_interval)+"m") history = _API.fetch_ohlcv(pair, timeframe=str(tick_interval)+"m")
@ -205,13 +203,11 @@ def get_ticker_history(pair: str, tick_interval) -> List[Dict]:
return history_json return history_json
except IndexError as e: except IndexError as e:
logger.warning('Empty ticker history. Msg %s', str(e)) logger.warning('Empty ticker history. Msg %s', str(e))
return []
except ccxt.NetworkError as e: except ccxt.NetworkError as e:
raise NetworkException( logger.warning('Could not load ticker history due to networking error. Message: %s', str(e))
'Could not load ticker history due to networking error. Message: {}'.format(e)
)
except ccxt.BaseError as e: except ccxt.BaseError as e:
raise OperationalException('Could not fetch ticker data. Msg: {}'.format(e)) logger.warning('Could not fetch ticker data. Msg: %s', str(e))
return []
def cancel_order(order_id: str) -> None: def cancel_order(order_id: str) -> None: