Repository navigation
Conversation
…es.base
Hermes /v2/price_feeds no longer returns attributes.base, so fetch_price_feed
threw "Cannot read properties of undefined (reading 'toLowerCase')" in
TypeScript and returned "Error fetching price feed: 'base'" in Python for
every symbol. Fall back to the base in attributes.symbol
("Crypto.BTC/USD", "Equity.US.AAPL/USD.PRE") when base is missing.
🟡 Heimdall Review Status
|
This branch has not been deployed
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.
Description
The Pyth
fetch_price_feedaction fails for every symbol on main, in both packages. Hermes/v2/price_feedsno longer returnsattributes.base(I checked crypto, equity, fx and metal queries: none of the returned feeds has it), and the filter reads it unguarded:TypeError: Cannot read properties of undefined (reading 'toLowerCase'){"success": false, "error": "Error fetching price feed: 'base'"}A current Hermes item looks like this:
{ "id": "e62d...5b43", "attributes": { "asset_type": "Crypto", "display_symbol": "BTCUSD", "quote_currency": "USD", "symbol": "Crypto.BTC/USD" } }The fix keeps
attributes.basewhen present and otherwise takes the base fromattributes.symbol(the part before/, after the last., e.g.Crypto.BTC/USDandEquity.US.AAPL/USD.PREgiveBTCandAAPL). The equity regular-market selection and everything after the filter are unchanged.flowchart TD A[Agent asks for the BTC price feed] --> B{Hermes item without base} B -->|Before| C[TypeError or KeyError and no feed] B -->|After| D[Base read from symbol and BTC USD feed returned]Narrated recording, before then after (sound on):
evidence.mp4
Separate from this PR: the follow-up
fetch_priceaction now getsHTTP error! status: 401fromhttps://hermes.pyth.network/v2/updates/price/latestwithout an API key. That needs a decision on how keys are configured, so I left it out.Tests
Shown in the recording, against the live public Hermes metadata endpoint (no keys, no wallet).
TypeScript (Node REPL with the workspace
@coinbase/agentkitbuild):Python (
python/coinbase-agentkitvenv):Edge cases and unchanged behaviour checked (TypeScript, live Hermes, in the recording):
eth/ crypto returns theETHUSDfeedAAPL/ equity returns the regular-marketAAPLfeedXAU/ metal returns theXAUUSDfeedNOTATOKENstill returnsNo price feed found for NOTATOKENbase(crypto, metals, commodities, equities, FX, pre/post market preference) pass as beforeUnit tests (a new test in each package mocks the current Hermes shape, without
base; both fail on main):eslint,prettier --check,tsc --noEmit,ruff checkandruff format --checkpass on the touched files. I did not run the full suites or a chatbot.Checklist
@coinbase/agentkit,changelog.d/pyth-feed-without-base.bugfix.mdfor Python)AI assistance (Claude Code) was used to find and fix this and to prepare the PR.
🤖 Generated with Claude Code