mirror of
https://github.com/glanceapp/glance.git
synced 2024-11-29 03:45:31 +01:00
#236 fixed change rate calc bug
This commit is contained in:
parent
d80f4872dc
commit
5f27218dcb
@ -108,12 +108,13 @@ func FetchMarketsDataFromYahoo(marketRequests []MarketRequest) (Markets, error)
|
|||||||
if marketRequests[i].Currency != "" {
|
if marketRequests[i].Currency != "" {
|
||||||
exchangeRate, err := FetchUSDExchangeRate(marketRequests[i].Currency)
|
exchangeRate, err := FetchUSDExchangeRate(marketRequests[i].Currency)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("Failed to fetch USD/EUR exchange rate", "error", err)
|
slog.Error("Failed to fetch USD exchange rate", "error", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if response.Chart.Result[0].Meta.Currency == "USD" {
|
if response.Chart.Result[0].Meta.Currency == "USD" {
|
||||||
response.Chart.Result[0].Meta.RegularMarketPrice *= exchangeRate
|
response.Chart.Result[0].Meta.RegularMarketPrice *= exchangeRate
|
||||||
|
previous *= exchangeRate
|
||||||
currency = currencyToSymbol[marketRequests[i].Currency]
|
currency = currencyToSymbol[marketRequests[i].Currency]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user