ccxt-websockets-db-updater icon indicating copy to clipboard operation
ccxt-websockets-db-updater copied to clipboard

Fix ob_updater subscribe_ws error handling

Open firepol opened this issue 6 years ago • 1 comments

In ob_updater, subscribe_ws I removed these lines and added a TODO to this issue.

    error_message = type(err).__name__ + ":" + str(err)
    logging.error(f'{exchange.id}: {error_message}')
    logging.error(error_stack)

The problem is that the error is not logged. Try to run binance and cexio at the same time to get some errors.

Also, I removed these lines:

    await exchange.close()
    raise WsError(exchange.id)

This was causing binance websockets to stop. My idea was to close the channel with the problematic exchange/pair, not shut down ALL channels from one exchange.

Ideally I'd like to re-subscribe the websocket that is causing errors (or that got disconnected).

To reproduce:

settings.ini

[config]
db_url: postgres://dbusr:dbpwd@localhost:5432/cryptows
order_book_entries_limit: 1

[binance]
symbols: BTC/USDT
         EOS/USDT
         ETH/USDT

[cex]
symbols: BTC/USD
         BTC/EUR

Run:

./ob_updater.py --reset_db

Error I get:

subscribed: cex BTC/USD subscribed: cex BTC/EUR subscribed: binance BTC/USDT binance, 2019-01-17 23:27:57.255584, [<FrameSummary file /home/paul/projects-python/ccxtws/ob_updater.py, line 142 in >, <FrameSummary file /home/paul/projects-python/ccxtws/ob_updater.py, line 68 in main>, <FrameSummary file /usr/lib/python3.6/asyncio/base_events.py, line 427 in run_forever>, <FrameSummary file /usr/lib/python3.6/asyncio/base_events.py, line 1440 in _run_once>, <FrameSummary file /usr/lib/python3.6/asyncio/events.py, line 145 in _run>, <FrameSummary file /home/paul/projects-python/ccxtws/ob_updater.py, line 88 in websocket_error>] subscribed: binance EOS/USDT subscribed: binance ETH/USDT

firepol avatar Jan 13 '19 23:01 firepol

Sorry @firepol I don't have a cex account to test, I have reported to cex support, but still doesn't work ( I don't receive any confirmation email from CEX). It's weird that you get this issue only in combination with cex. Maybe something wrong in cex implementaion, I couldn't check it out recently.

lfern avatar Jan 25 '19 10:01 lfern