From 0110941ac77d2c1bf9bc360735b4f6e8d6a21121 Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Wed, 7 May 2025 11:57:33 -0600 Subject: [PATCH] attempt to avoid yahoo finance rate limiting --- providers/staticjsonYahooFinance/providerImpl.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/providers/staticjsonYahooFinance/providerImpl.go b/providers/staticjsonYahooFinance/providerImpl.go index 10f2363..857c989 100644 --- a/providers/staticjsonYahooFinance/providerImpl.go +++ b/providers/staticjsonYahooFinance/providerImpl.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "time" ) type security struct { @@ -62,6 +63,7 @@ func (p *Provider) GetBalances() ([]int, []string, error) { return balances, ynabAccountIDs, fmt.Errorf("failed to get quote for security with symbol '%s': %v", p.data.Accounts[i].Securities[j].Symbol, err) } balance += price * p.data.Accounts[i].Securities[j].Quantity + time.Sleep(time.Second) // Disgusting way to avoid HTTP 429 rate limiting } balances = append(balances, balance) ynabAccountIDs = append(ynabAccountIDs, p.data.Accounts[i].YnabAccountID)