hummingbot
hummingbot copied to clipboard
Feat/xemm gateway
Before submitting this PR, please make sure:
- [x] Your code builds clean without any errors or warnings
- [x] You are using approved title ("feat/", "fix/", "docs/", "refactor/")
A description of the changes proposed in the pull request:
Adds an option to use DEX as taker exchanges through the gateway in the strategy.
Tests performed by the developer:
Added new unit tests Ran all existing unit tests Tested with binance paper & uniswap (kovan) Tested with binance paper & pangolin (fuji) Tested with binance & kucoin
Tips for QA testing:
Please test thoroughly both with CEX and DEX.
PRP: https://snapshot.org/#/hbot-prp.eth/proposal/0x1dae80eb568a0a9f31035d3b9763ef65711dda81f990389622933bbc39560283
Test performed: Gateway generate certs/create = OK create/start strategy using CEX/CEX = OK Filled orders, CSV, history showing for CEX/CEX connectors = OK
create/start strategy using Uniswap Kovan/CEX, Uniswap Kovan/PaperTrade Rate conversion = OK Filled orders, CSV = OK uniswap kovan showing txhash = OK create/start strategy using Pangolin/CEX, Pangolin/PaperTrade = OK Rate conversion = OK Filled orders, CSV = OK
Got the issue bot not showing history
and trades/assets/performance for history --verbose
Steps:
- Create a XEMM strategy using CEX /papertrade and for taker_market - uniswap (kovan) / pangolin mainnet
- Set up tight min_profitability to -1 to check history of filled trades
- Wait for orders filled for maker and taker
- Check
history
andhistory --verbose
Actual:
bot not showing trading history
and trades/assets/performance for history --verbose
Bot showing: ERROR - Unhandled error in background task: 'int' object has no attribute 'is_nan'
Expected:
Bot showing trading history
and trades/assets/performance for history --verbose
PR5550-xemm.zip logs_conf_xemm_8.log
2022-08-04 18:11:27,823 - 9545 - hummingbot.core.utils.async_utils - ERROR - Unhandled error in background task: 'int' object has no attribute 'is_nan'
Traceback (most recent call last):
File "/home/ubuntu/xemm5550/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper
return await c
File "/home/ubuntu/xemm5550/hummingbot/client/command/history_command.py", line 77, in history_report
self.report_performance_by_market(market, symbol, perf, precision)
File "/home/ubuntu/xemm5550/hummingbot/client/command/history_command.py", line 143, in report_performance_by_market
PerformanceMetrics.smart_round(perf.cur_base_bal, precision),
File "/home/ubuntu/xemm5550/hummingbot/client/performance.py", line 148, in smart_round
if value is None or value.is_nan():
AttributeError: 'int' object has no attribute 'is_nan'
Uniswap kovan - binance_paperTrade
Pangolin mainnet - gate.io
Same for uniswap kovan - gate.io
development-1.7.0/ this PR not showing this issue for CEX/CEX exchange (binance/gate.io)
@nikspz that seems to be an issue of the history command in how it handles gateway markets. The failure occurs in the current base balance query, which, looking into the history command's code, is taken from the market itself. This likely fails also for he amm_arb
with the gateway. If that's the case, then it's not an issue of this PR, which is just about integration of the gateway connector into the XEMM.
Looking more closely into the code it looks like get_all_balances()
of the gateway connector is returning a base asset balance as an integer, and not Decimal. Or not returning the base asset at all in the dictionary and instead in _initialize_metrics()
0 is taken, which is not a Decimal but an integer.
Whatever is the case, this is not an issue of this PR.
@nikspz that seems to be an issue of the history command in how it handles gateway markets. The failure occurs in the current base balance query, which, looking into the history command's code, is taken from the market itself. This likely fails also for he
amm_arb
with the gateway. If that's the case, then it's not an issue of this PR, which is just about integration of the gateway connector into the XEMM.
@mhrvth Yeah, similar issue was catched before in past versions here: https://github.com/hummingbot/hummingbot/issues/5115
however, for the amm_arb strategy
issue is not showing for latest dev-1.7.0
(using uniswap kovan and binance_paperTrade)
@nikspz beside my investigation that traced the true problem, since it happened for amm_arb
before and no fix was created, it means it's a shared bug and the common denominator is either the gateway or the core code, but neither of the strategies. Therefore it's not an issue of this PR.
Test performed: Cloned and installed feature branch
- Manually created a docker image from /gateway folder = OK
- Generated certs and gateway created = OK
- Setup Cross-Exchange market making strategy = OK
- Setup xemm with CEX and Kovan testnet = OK Ethereum
- Setup xemm with CEX and Mainnet = OK
- Setup xemm with papertrade and kovan testnet = OK
- Setup xemm with papertrade and Mainnet = OK Avalanche
- Setup xemm using CEX and Avalanche = OK
- Setup xemm using papertrade and Avalanche = OK CEX
- Setup xemm on any CEX connectors = OK
ongoing issues: bot not showing history and trades/assets/performance for history --verbose (https://github.com/hummingbot/hummingbot/issues/5115)
PR update:
- Manually created a docker image from /gateway folder
- Setup docker client + gateway
- Tested XEMM configs with gateway
- Does not support when order_amount is
0
- Notice some issues not related to PR, created separate ticket
- Does not support when order_amount is
- Setup XEMM Binance + uniswap_kovan: ok
Pending:
- XEMM pangolin + traderJoe
- XEMM CEX + avalanche
- XEMM CEX + CEX
PR update:
- Setup XEMM with Binance_paper_trade + uniswap kovan: ok
- Setup XEMM with Binance + uniswap kovan: ok
- Setup XEMM with Binance_paper_trade + TraderJoe or Pangolin: ok but there is
ongoing issue not related to this PR
- Setup XEMM with Binance + TraderJoe or Pangolin : ok
- Setup XEMM with Pangolin + TraderJoe avalanche: Not possible,
GW connectors cant be assigned as maker
- Setup XEMM with CEX + CEX: ok
- Setup XEMM with CEX + Paper: ok
- Run test on source and docker build:
Test bot running overnight for monitoring possible long term issues. Will review the log files tomorrow. If no other issues then PR is good to be approved. Thank you!
🤝
@cardosofede @JeremyKono this PR has been approved by the community and by QA almost a week ago. Is there any reason why it is not merged into development?