CoinAlpha / hummingbot

Hummingbot is open source software that helps you build trading bots that run on any exchange or blockchain
https://www.hummingbot.org
Apache License 2.0
168 stars 81 forks source link

Failed Test PR#342 - Unexpected error while fetching account updates #347

Closed mrhzysbl closed 1 year ago

mrhzysbl commented 1 year ago

Summary and Screenshots

While monitoring the logs, random network errors were displaying.

image
2023-04-18 11:24:00,508 - 1594 - hummingbot.connector.derivative.phemex_perpetual.phemex_perpetual_derivative.PhemexPerpetualDerivative - NETWORK - Unexpected error while fetching account updates.
Traceback (most recent call last):
  File "/Users/admin/phemex/hummingbot/connector/exchange_py_base.py", line 813, in _status_polling_loop
    await self._status_polling_loop_fetch_updates()
  File "/Users/admin/phemex/hummingbot/connector/derivative/phemex_perpetual/phemex_perpetual_derivative.py", line 213, in _status_polling_loop_fetch_updates
    await safe_gather(
  File "/Users/admin/phemex/hummingbot/core/utils/async_utils.py", line 22, in safe_gather
    return await asyncio.gather(*args, **kwargs)
  File "/Users/admin/phemex/hummingbot/connector/derivative/phemex_perpetual/phemex_perpetual_derivative.py", line 581, in _update_balances
    raise IOError(f"{code} - {message}")
OSError: 39999 - Error in query account position
2023-04-18 11:24:01,243 - 1594 - hummingbot.connector.derivative.phemex_perpetual.phemex_perpetual_derivative.PhemexPerpetualDerivative - WARNING - Could not fetch account updates from Phemex_perpetual. Check API key and network connection.
2023-04-18 11:24:02,020 - 1594 - hummingbot.connector.derivative.phemex_perpetual.phemex_perpetual_derivative.PhemexPerpetualDerivative - NETWORK - Unexpected error while fetching account updates.
Traceback (most recent call last):
  File "/Users/admin/phemex/hummingbot/connector/exchange_py_base.py", line 813, in _status_polling_loop
    await self._status_polling_loop_fetch_updates()
  File "/Users/admin/phemex/hummingbot/connector/derivative/phemex_perpetual/phemex_perpetual_derivative.py", line 213, in _status_polling_loop_fetch_updates
    await safe_gather(
  File "/Users/admin/phemex/hummingbot/core/utils/async_utils.py", line 22, in safe_gather
    return await asyncio.gather(*args, **kwargs)
  File "/Users/admin/phemex/hummingbot/connector/derivative/phemex_perpetual/phemex_perpetual_derivative.py", line 601, in _update_positions
    for position in positions.get("data", {}).get("positions", []):
AttributeError: 'NoneType' object has no attribute 'get'

Steps to reproduce

  1. Clone and install the feat branch
  2. Create a Perpetual Market Making Strategy. Set tight spreads to fill in orders quickly.
  3. Start the strategy and monitor the logs

Expected Results

Test Result Comparison

n/a, new connector

Attachments

Network_error_Phemex.zip

vic-en commented 1 year ago

I pushed a commit that should prevent the second error. The first of properly logged which is fine.

mrhzysbl commented 1 year ago

Tested on commit 496c253 and verified that we are no longer getting the error.