Skip to content

Commit

Permalink
retrieve currency from price object
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Litzenburger authored and Jan Litzenburger committed Jun 21, 2021
1 parent ee9e483 commit fad2d4a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 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.

2 changes: 1 addition & 1 deletion node_helper.js

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

4 changes: 2 additions & 2 deletions src/client/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class JastUtils {
return this.getStockChange(stock).toLocaleString(
this.config.locale,
Object.assign(this.changeValueStyle, {
currency: stock.summaryDetail.currency
currency: stock.price.currency
})
)
}
Expand All @@ -82,7 +82,7 @@ export default class JastUtils {
return this.getCurrentValue(stock).toLocaleString(
this.config.locale,
Object.assign(this.currentValueStyle, {
currency: stock.summaryDetail.currency
currency: stock.price.currency
})
)
}
Expand Down
8 changes: 5 additions & 3 deletions src/server/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ module.exports = NodeHelper.create({
let results = []
for (const stock of config.stocks) {
try {
const { summaryDetail, price } = await yahooFinance.quoteSummary(
const { price } = await yahooFinance.quoteSummary(
stock.symbol
)
if (summaryDetail && price) {
if (price) {
const meta = {
symbol: stock.symbol,
name: stock.name,
quantity: stock.quantity
}
results.push({ summaryDetail, price, meta })
results.push({ price, meta })
} else {
console.warn(`Response for ${stock.symbol} does not satisfy expected payload.`)
}
} catch (err) {
console.error('There was an error requesting the API.', err.message)
Expand Down

0 comments on commit fad2d4a

Please sign in to comment.