Skip to content

Commit

Permalink
#36: Fixed GBp/GBP bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Litzenburger committed Jan 25, 2022
1 parent 8fd21f0 commit 5a5f781
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 10 deletions.
2 changes: 1 addition & 1 deletion MMM-Jast.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions node_helper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 60 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmm-jast",
"version": "2.6.1",
"version": "2.6.2",
"description": "A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform.",
"main": "MMM-Jast.js",
"repository": {
Expand Down
6 changes: 6 additions & 0 deletions src/backend/JastBackendUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export default class JastBackendUtils {
name: config.stocks[index].name,
quantity: config.stocks[index].quantity
}
// Manually convert GBp to GBP
if (response.price.currency === 'GBp') {
response.price.regularMarketPrice /= 100
response.price.regularMarketChange /= 100
response.price.currency = 'GBP'
}
stocks.push({ price: response.price, meta })
} else {
Log.warn(`Response for ${config.stocks[index].symbol} does not satisfy expected payload.`)
Expand Down

0 comments on commit 5a5f781

Please sign in to comment.