Skip to content

A self-hosted dashboard that puts all your feeds in one place

Fix misleading currency symbol for certain markets

Svilen Markov283de667bfe5
diff --git a/internal/glance/templates/markets.html b/internal/glance/templates/markets.html
index cd47cab..8775acc 100644
--- a/internal/glance/templates/markets.html
+++ b/internal/glance/templates/markets.html
@@ -17,7 +17,7 @@
<div class="market-values shrink-0">
<div class="size-h3 text-right {{ if eq .PercentChange 0.0 }}{{ else if gt .PercentChange 0.0 }}color-positive{{ else }}color-negative{{ end }}">{{ printf "%+.2f" .PercentChange }}%</div>
- <div class="text-right">{{ .Currency }}{{ .Price | formatPriceWithPrecision .PriceHint }}</div>
+ <div class="text-right" title="{{ .Currency }}">{{ .CurrencySymbol }}{{ .Price | formatPriceWithPrecision .PriceHint }}</div>
</div>
</div>
{{ end }}
diff --git a/internal/glance/widget-markets.go b/internal/glance/widget-markets.go
index b53b10a..3c609fe 100644
--- a/internal/glance/widget-markets.go
+++ b/internal/glance/widget-markets.go
@@ -78,6 +78,7 @@ type market struct {
marketRequest
Name string
Currency string
+ CurrencySymbol string
Price float64
PriceHint int
PercentChange float64
@@ -169,16 +170,12 @@ func fetchMarketsDataFromYahoo(marketRequests []marketRequest) (marketList, erro
points := svgPolylineCoordsFromYValues(100, 50, maybeCopySliceWithoutZeroValues(prices))
- currency, exists := currencyToSymbol[strings.ToUpper(result.Meta.Currency)]
- if !exists {
- currency = result.Meta.Currency
- }
-
markets = append(markets, market{
- marketRequest: marketRequests[i],
- Price: result.Meta.RegularMarketPrice,
- Currency: currency,
- PriceHint: result.Meta.PriceHint,
+ marketRequest: marketRequests[i],
+ Price: result.Meta.RegularMarketPrice,
+ CurrencySymbol: currencyToSymbol[result.Meta.Currency],
+ Currency: result.Meta.Currency,
+ PriceHint: result.Meta.PriceHint,
Name: ternary(marketRequests[i].CustomName == "",
result.Meta.ShortName,
marketRequests[i].CustomName,