CoinAlpha / gateway-api

Apache License 2.0
47 stars 25 forks source link

[BUG] Unable to get arbitrage opportunity #133

Closed PtrckM closed 2 years ago

PtrckM commented 2 years ago
2021-08-14 00:29:17,700 - 35379 - hummingbot.connector.connector.uniswap.uniswap_connector - WARNING - '<' not supported between instances of 'decimal.Decimal' and 'dict'
2021-08-14 00:29:19,437 - 35379 - hummingbot.connector.connector.uniswap.uniswap_connector - NETWORK - Error getting quote price for WETH-DAI  buy order for 0.02 amount.
Traceback (most recent call last):
  File "/home/ubuntu/hummingbot/hummingbot/core/utils/__init__.py", line 15, in memoize
    return cache[key]
  File "/home/ubuntu/miniconda3/envs/hummingbot/lib/python3.8/site-packages/cachetools/ttl.py", line 82, in __getitem__
    return self.__missing__(key)
  File "/home/ubuntu/miniconda3/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 0x7f6a1cbe5340>, 'WETH-DAI', True, Decimal('0.02')), {})"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/hummingbot/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 217, in get_quote_price
    exceptions = check_transaction_exceptions(account_standing)
  File "/home/ubuntu/hummingbot/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-14 00:29:19,437 - 35379 - hummingbot.connector.connector.uniswap.uniswap_connector - WARNING - '<' not supported between instances of 'decimal.Decimal' and 'dict'

Client version: 0.42.0 Gateway version: 0.8.0

PtrckM commented 2 years ago

FYI: Traceback and found b7e2b416def592cc3a67b578a17d6ad6a42b04ec working for uniswap only.

Screen Shot 2021-08-14 at 9 32 12 AM
fengtality commented 2 years ago

I am also seeing this bug - it looks like it was introduced in the gas changes after commit b7e2b41: https://github.com/CoinAlpha/gateway-api/compare/b7e2b41..master

vic-en commented 2 years ago

So far, I cannot reproduce this problem. From inspecting the files from Patrick, I see this error would only occur when the gateway doesn't return a proper response when fetching price which could be due to issues with network or config parameters.

@mifeng I'd like to see your logs if this issue persists on your end.

fengtality commented 2 years ago

@vic-en Here's my log file: logs_conf_amm_arb_2.log

This appears to be the relevant error:

Traceback (most recent call last):
  File "/Users/feng/Code/hummingbot/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 217, in get_quote_price
    exceptions = check_transaction_exceptions(account_standing)
  File "/Users/feng/Code/hummingbot/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-18 17:33:06,601 - 3737 - hummingbot.connector.connector.uniswap.uniswap_connector - WARNING - '<' not supported between instances of 'decimal.Decimal' and 'dict'
2021-08-18 17:33:08,257 - 3737 - hummingbot.connector.connector.uniswap.uniswap_connector - NETWORK - Error getting quote price for WETH-DAI  sell order for 0.02 amount.
Traceback (most recent call last):
  File "/Users/feng/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 0x7ff0d8d6a9a0>, 'WETH-DAI', False, Decimal('0.02')), {})"

If you're not seeing this, it's likely due to a difference in our Gateway environments. I'll try running this on a fresh VM and see if I can isolate the difference.