Repository navigation
Fix Yahoo Finance module showing all zeroes - #2142
Merged
Merged
Conversation
…finance-go
Yahoo's v7/v10 finance/quote endpoints (used by piquette/finance-go) now
require a session cookie + crumb token that the unmaintained library never
sends, causing Yahoo to silently return zero-valued quotes instead of an
error.
Replace it with a direct call to Yahoo's v8/finance/chart/{symbol}
endpoint, which is still accessible without any crumb/cookie and provides
everything the widget needs (price, previous close, currency, trading
session windows). Market state (PRE/REGULAR/POST/CLOSED) is now derived
from the reported trading period windows instead of the API.
Fixes wtfutil#1701
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add tests for GetTrend, GetTrendIcon, GetMarketIcon, tableStyle, NewSettingsFromYAML, NewWidget, Widget.content, and Widget.Refresh. Also add fetchChartMeta/quotes tests for the API-error, malformed-JSON, previous-close-fallback, network-error, and success paths that weren't previously exercised. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Seanstoppable
force-pushed
the
seanstoppable-issue-1701-yahoo-finance-module-shows-all-zeroes-0bb588
branch
from
July 26, 2026 03:28
3d6c9b4 to
d67d29f
Compare
Seanstoppable
enabled auto-merge (squash)
July 26, 2026 03:31
Seanstoppable
deleted the
seanstoppable-issue-1701-yahoo-finance-module-shows-all-zeroes-0bb588
branch
July 26, 2026 03:35
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.
Problem
Fixes #1701 (and duplicate #1709). Also addresses #1785 (
piquette/finance-go dep is a dead project). Theyfinancemodule rendered every field as0.00for all symbols.Root cause
modules/stocks/yfinanceusedgithub.com/piquette/finance-go, which calls Yahoo's legacyv7/v10finance/quoteendpoints. Yahoo now requires a session cookie + crumb token on those endpoints, and the library (unmaintained since ~2021, flagged as a dead dependency in #1785) never supplies one — Yahoo responds with a quote object that deserializes to all zeroes instead of an error, so the widget couldn't tell anything had gone wrong.There's no official Yahoo Finance Go library; the unofficial alternatives are newer/single-maintainer projects with no real advantage over calling the endpoint directly, so this avoids adding a new dependency.
Fix
piquette/finance-godependency and fetch quotes directly from Yahoo'sv8/finance/chart/{symbol}endpoint, which is still reachable without any crumb/cookie and returns everything the widget needs (regularMarketPrice,chartPreviousClose,currency, trading-period windows).PRE/REGULAR/POST/CLOSED) is now derived from the reported trading-period windows instead of a field Yahoo no longer reliably returns for this endpoint.NIFTY50) still fall back to the existing"?"display.github.com/piquette/finance-gofromgo.mod/go.sumviago mod tidy(verified unused elsewhere in the repo), which also resolves piquette/finance-go dep is a dead project #1785.Tests
yquote_test.go,settings_test.go, andwidget_test.gocovering: equity/FX chart parsing, API-error and malformed-JSON responses, previous-close fallback, network errors, unknown-symbol fallback, market-state transitions, settings parsing, widget construction, and content rendering (including sort-by-change).Verification
go build ./...,go vet ./modules/stocks/yfinance/..., andgolangci-lint run ./modules/stocks/yfinance/...all pass with 0 issues.go test ./modules/stocks/yfinance/...passes.AMD,^NSEI,EURUSD=X, and the invalidNIFTY50) — all return correct non-zero prices/changes, withNIFTY50gracefully falling back to?.yfinancemodule block to my localconfig.ymlfor manual verification of the rendered widget.