fix: add User-Agent header to Yahoo Finance price requests
Without it the API returns "Too Many Requests" (not JSON), prices map stays empty, currentValue = 0, and every holding shows -100% P&L with an empty allocation chart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5d30b5eaee
commit
d77020dcc5
@ -167,7 +167,12 @@ func fetchPricesByISIN(isins []string) (map[string]int64, error) {
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("https://query1.finance.yahoo.com/v8/finance/chart/%s", ticker)
|
||||
resp, err := client.Get(url)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (compatible; homelab-finance/1.0)")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
slog.Warn("price fetch failed", "isin", isin, "ticker", ticker, "err", err)
|
||||
continue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user