fix(rates): repoint rate_finder to renamed hummingbot token normalizer#192
Open
fengtality wants to merge 1 commit into
Open
fix(rates): repoint rate_finder to renamed hummingbot token normalizer#192fengtality wants to merge 1 commit into
fengtality wants to merge 1 commit into
Conversation
Hummingbot commit a71a92a5 deleted hummingbot/core/gateway/utils.py and renamed unwrap_token_symbol -> normalize_token_symbol in hummingbot.core.rate_oracle.utils, so HAPI failed at startup with ModuleNotFoundError when built against hummingbot dev newer than June 28. Import the helper from its new location. Also fix a latent bug in the find_rate port: after normalizing USD -> USDT it never re-checked the direct normalized pair, so e.g. HBOT-USD returned None even with HBOT-USDT in the ticker pool. Add the re-check to match upstream find_rate. Fixes #191 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #191
Problem
HAPI fails at startup with
ModuleNotFoundError: No module named 'hummingbot.core.gateway.utils'when built against hummingbotdevelopmentnewer than June 28. Hummingbot commita71a92a5deletedhummingbot/core/gateway/utils.pyand renamed the helperunwrap_token_symbol→normalize_token_symbol, relocating it tohummingbot.core.rate_oracle.utils.utils/rate_finder.py(introduced inf067c37) still imported from the deleted path, killing the whole app import chain (main.py→ routers → deps → services →rate_finder).Changes
rate_finder.pynow importsnormalize_token_symbolfromhummingbot.core.rate_oracle.utils(its new name and location).find_rateport never re-checked the direct pair after USD→USDT normalization, so e.g.HBOT-USDreturnedNoneeven withHBOT-USDTpresent in the ticker pool. Added the normalized-pair re-check to match upstream hummingbot'sfind_rate.Compatibility note for QA
This PR requires a hummingbot wheel built from
developmentat/aftera71a92a5(the module rename). It will not import against older wheels (e.g.20260515), which only have the oldunwrap_token_symbolpath — pair this with a current dev wheel when testing.build/libnever propagates source-file deletions, so wheels rebuilt from an existing hummingbot checkout silently re-include the deletedcore/gateway/utils.py(and three stalehummingbot/cli/files). If a rebuilt wheel still "works" with the old import, checkunzip -l dist/hummingbot-*.whl | grep gateway/utilsand purge stale files frombuild/lib.*(or delete the build dir) before building.Testing
ModuleNotFoundErrorfrom the issue by importingrate_finderagainst post-a71a92a5hummingbot source.main.py(the uvicorn entrypoint) imports cleanly end-to-end.find_ratematrix passes: direct, direct-after-normalization (HBOT-USD), reverse, reverse-after-normalization, both cross-rate bridging paths, identity after normalization (USD-USDT→ 1), and no-path →None.from hummingbot...import across routers/services/utils/models against the new layout —hummingbot.core.gateway.utilswas the only break.🤖 Generated with Claude Code