Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Fix the percentage value error (/100)
Browse files Browse the repository at this point in the history
  • Loading branch information
librehat committed Aug 30, 2020
1 parent 7f227f2 commit 1e4479e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plasmoid/contents/code/yahoofinance.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function resolveChart(symbol, range, interval) {
currentPrice: meta.regularMarketPrice,
previousClose: meta.previousClose,
priceChange: meta.regularMarketPrice - meta.previousClose,
priceChangePercentage: (meta.regularMarketPrice - meta.previousClose) / meta.previousClose,
priceChangePercentage: (meta.regularMarketPrice - meta.previousClose) / meta.previousClose * 100,
priceDecimals: meta.priceHint === null ? 2 : meta.priceHint,
updatedDateTime: new Date(meta.regularMarketTime * 1000),
exchange: {
Expand Down
2 changes: 1 addition & 1 deletion plasmoid/contents/ui/StockQuoteDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PlasmaComponents.ListItem {
PlasmaComponents3.Label {
Layout.alignment: Qt.AlignRight

text: `${localiseNumber(priceChange, true, true)} (${priceChangePercentage > 0 ? locale.positiveSign : ""}${Number(priceChangePercentage * 100).toLocaleString(locale, 'f', 2)}${locale.percent})`
text: `${localiseNumber(priceChange, true, true)} (${priceChangePercentage > 0 ? locale.positiveSign : ""}${Number(priceChangePercentage).toLocaleString(locale, 'f', 2)}${locale.percent})`
color: priceChange === 0 ? theme.neutralTextColor : (priceChange > 0 ? theme.positiveTextColor : theme.negativeTextColor)
clip: true
}
Expand Down

0 comments on commit 1e4479e

Please sign in to comment.