CoinAlpha / gateway-api

Apache License 2.0
47 stars 25 forks source link

Uniswap/Balancer - Error getting quote price when running amm_arb #131

Closed rxlxrxsx closed 2 years ago

rxlxrxsx commented 2 years ago

When running the amm_arb strategy using uniswap or balancer the bot throws a warning and error related to getting the quote price.

Screen Shot 2021-08-12 at 3 58 09 PM Screen Shot 2021-08-12 at 3 51 03 PM

Some of the error and warning I encountered:

2021-08-12 15:58:33,142 - 12494 - hummingbot.connector.connector.uniswap.uniswap_connector - NETWORK - Error getting quote price for DAI-USDC  buy order for 1.0 amount.
Traceback (most recent call last):
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/cache.py", line 39, in __getitem__
    return self.__data[key]
KeyError: "((<hummingbot.connector.connector.uniswap.uniswap_connector.UniswapConnector object at 0x7fda9e538d60>, 'DAI-USDC', True, Decimal('1.0')), {})"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/reiniersalazar/development/hummingbot/core/utils/__init__.py", line 15, in memoize
    return cache[key]
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/ttl.py", line 84, in __getitem__
    return cache_getitem(self, key)
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/cache.py", line 41, in __getitem__
    return self.__missing__(key)
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/cache.py", line 68, in __missing__
    raise KeyError(key)
KeyError: "((<hummingbot.connector.connector.uniswap.uniswap_connector.UniswapConnector object at 0x7fda9e538d60>, 'DAI-USDC', True, Decimal('1.0')), {})"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/reiniersalazar/development/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 188, in get_quote_price
    resp = await self._api_request("post",
  File "/Users/reiniersalazar/development/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 591, in _api_request
    raise IOError(f"Error fetching data from {url}. HTTP status is {response.status}.{err_msg}")
OSError: Error fetching data from https://localhost:5001/eth/uniswap/price. HTTP status is 500. Message: Invariant failed: DECIMALS
2021-08-12 14:16:46,862 - 11151 - hummingbot.connector.connector.uniswap.uniswap_connector - NETWORK - Error getting quote price for WETH-DAI  sell order for 0.01 amount.
Traceback (most recent call last):
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/cache.py", line 39, in __getitem__
    return self.__data[key]
KeyError: "((<hummingbot.connector.connector.uniswap.uniswap_connector.UniswapConnector object at 0x7fadd02bf5e0>, 'WETH-DAI', False, Decimal('0.01')), {})"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/reiniersalazar/development/hummingbot/core/utils/__init__.py", line 15, in memoize
    return cache[key]
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/ttl.py", line 84, in __getitem__
    return cache_getitem(self, key)
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/cache.py", line 41, in __getitem__
    return self.__missing__(key)
  File "/Users/reiniersalazar/opt/anaconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/cache.py", line 68, in __missing__
    raise KeyError(key)
KeyError: "((<hummingbot.connector.connector.uniswap.uniswap_connector.UniswapConnector object at 0x7fadd02bf5e0>, 'WETH-DAI', False, Decimal('0.01')), {})"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/reiniersalazar/development/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 217, in get_quote_price
    exceptions = check_transaction_exceptions(account_standing)
  File "/Users/reiniersalazar/development/hummingbot/core/utils/ethereum.py", line 60, in check_transaction_exceptions
    if eth_balance < gas_cost:
TypeError: '<' not supported between instances of 'decimal.Decimal' and 'dict'
2021-08-12 14:16:46,872 - 11151 - hummingbot.connector.connector.uniswap.uniswap_connector - WARNING - '<' not supported between instances of 'decimal.Decimal' and 'dict'

Gateway release version version-0.8.0

Attachments amm_arb.zip

fengtality commented 2 years ago

duplicated by #133