diff --git a/.prettierrc.json b/.prettierrc.json index 0f8f159..f08cae8 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,5 +3,6 @@ "semi": false, "singleQuote": true, "trailingComma": "none", - "endOfLine": "auto" + "endOfLine": "auto", + "printWidth": 120 } \ No newline at end of file diff --git a/MMM-Jast.js b/MMM-Jast.js index 57aedab..5c54019 100644 --- a/MMM-Jast.js +++ b/MMM-Jast.js @@ -1 +1 @@ -(()=>{"use strict";var e={429:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.config=e,this.currentValueStyle={style:e.showCurrency?"currency":"decimal",useGrouping:e.useGrouping,currencyDisplay:e.currencyStyle,minimumFractionDigits:e.numberDecimalsValues<=8?e.numberDecimalsValues:8},this.changeValueStyle={style:e.showChangeValueCurrency?"currency":"decimal",useGrouping:e.useGrouping,currencyDisplay:e.currencyStyle,minimumFractionDigits:e.numberDecimalsValues<=8?e.numberDecimalsValues:8},this.percentStyle={style:"percent",useGrouping:e.useGrouping,minimumFractionDigits:e.numberDecimalsPercentages<=8?e.numberDecimalsPercentages:8}}getStockChange(e){var t;return null===(t=e.price)||void 0===t?void 0:t.regularMarketChange}getStockChangePercent(e){var t;return null===(t=e.price)||void 0===t?void 0:t.regularMarketChangePercent}getCurrentValue(e){var t;return null===(t=e.price)||void 0===t?void 0:t.regularMarketPrice}getStockChangeAsString(e){return this.getStockChange(e).toLocaleString(this.config.locale,Object.assign(this.changeValueStyle,{currency:e.price.currency}))}getStockChangePercentAsString(e){return this.getStockChangePercent(e).toLocaleString(this.config.locale,this.percentStyle)}getCurrentValueAsString(e){return this.getCurrentValue(e).toLocaleString(this.config.locale,Object.assign(this.currentValueStyle,{currency:e.price.currency}))}getStockName(e){return e.meta.name||e.price.longName}getDepotValueAsString(e){return e.value.toLocaleString(this.config.locale,Object.assign(this.currentValueStyle,{currency:e.currency}))}getDepotChangeAsString(e){return(e.value-e.oldValue).toLocaleString(this.config.locale,Object.assign(this.currentValueStyle,{currency:e.currency}))}getDepotChangePercentAsString(e){return((e.value-e.oldValue)/e.oldValue).toLocaleString(this.config.locale,this.percentStyle)}getDepot(e){var t,n,r;let a=[];for(const c of e)try{const e=null===(t=this.config.stocks)||void 0===t?void 0:t.find((e=>{var t;return e.symbol===(null===(t=c.meta)||void 0===t?void 0:t.symbol)}));if(null==e?void 0:e.quantity){const t=(null===(n=c.price)||void 0===n?void 0:n.regularMarketPrice)*e.quantity,s=(null===(r=c.price)||void 0===r?void 0:r.regularMarketPreviousClose)*e.quantity,o=a.find((e=>e.currency===c.price.currency));o?(o.value=o.value+t,o.oldValue=o.oldValue+s):a.push({value:t,oldValue:s,currency:c.price.currency})}}catch(e){console.warn("There was a problem calculating the detpot growth",e)}return console.debug("Depot",a),a}}}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var c=t[r]={exports:{}};return e[r](c,c.exports,n),c.exports}(()=>{const e=n(429);Module.register("MMM-Jast",{defaults:{locale:config.locale||"en-GB",updateIntervalInSeconds:600,useGrouping:!1,currencyStyle:"code",fadeSpeedInSeconds:3.5,stocks:[{name:"BASF",symbol:"BAS.DE",quantity:100},{name:"SAP",symbol:"SAP.DE",quantity:200},{name:"Henkel",symbol:"HEN3.DE"},{name:"AbbVie",symbol:"4AB.DE"},{name:"Bitcoin",symbol:"BTC-EUR"},{name:"Alibaba",symbol:"BABA"}],scroll:"vertical",maxWidth:"100%",numberDecimalsValues:2,numberDecimalsPercentages:1,showColors:!0,showCurrency:!0,showChangePercent:!0,showChangeValue:!1,showChangeValueCurrency:!1,showDepot:!1,showDepotGrowth:!1,showDepotGrowthPercent:!1,virtualHorizontalMultiplier:2},getStyles:()=>["MMM-Jast.css"],getTranslations:()=>({en:"translations/en.json",de:"translations/de.json"}),getTemplate:()=>"templates/MMM-Jast.njk",getTemplateData(){const t=new e.default(this.config);return{config:this.config,stocks:this.stocks,utils:t}},start(){this.nunjucksEnvironment().loaders[0].async=!1,this.nunjucksEnvironment().loaders[0].useCache=!0,this.stocks=[],this.loadData(),this.scheduleUpdate(),this.updateDom()},scheduleUpdate(){const e=this;this.config.updateIntervalInSeconds=this.config.updateIntervalInSeconds<120?120:this.config.updateIntervalInSeconds,setInterval((()=>{e.loadData()}),1e3*this.config.updateIntervalInSeconds)},loadData(){this.sendSocketNotification("GET_STOCKS",this.config)},socketNotificationReceived(e,t){"STOCKS_RESULT"===e&&(this.stocks=t,this.updateDom(),console.debug("Stocks",this.stocks))}})})()})(); \ No newline at end of file +(()=>{"use strict";var e={429:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.config=e,this.currentValueStyle={style:e.showCurrency?"currency":"decimal",useGrouping:e.useGrouping,currencyDisplay:e.currencyStyle,minimumFractionDigits:e.numberDecimalsValues<=8?e.numberDecimalsValues:8},this.changeValueStyle={style:e.showChangeValueCurrency?"currency":"decimal",useGrouping:e.useGrouping,currencyDisplay:e.currencyStyle,minimumFractionDigits:e.numberDecimalsValues<=8?e.numberDecimalsValues:8},this.percentStyle={style:"percent",useGrouping:e.useGrouping,minimumFractionDigits:e.numberDecimalsPercentages<=8?e.numberDecimalsPercentages:8}}getStockChange(e){var t;return null===(t=e.price)||void 0===t?void 0:t.regularMarketChange}getStockChangePercent(e){var t;return null===(t=e.price)||void 0===t?void 0:t.regularMarketChangePercent}getCurrentValue(e){var t;return null===(t=e.price)||void 0===t?void 0:t.regularMarketPrice}getStockChangeAsString(e){return this.getStockChange(e).toLocaleString(this.config.locale,Object.assign(this.changeValueStyle,{currency:e.price.currency}))}getStockChangePercentAsString(e){return this.getStockChangePercent(e).toLocaleString(this.config.locale,this.percentStyle)}getCurrentValueAsString(e){return this.getCurrentValue(e).toLocaleString(this.config.locale,Object.assign(this.currentValueStyle,{currency:e.price.currency}))}getStockName(e){return e.meta.name||e.price.longName}getPortfolioValueAsString(e){return e.value.toLocaleString(this.config.locale,Object.assign(this.currentValueStyle,{currency:e.currency}))}getPortfolioChangeAsString(e){return(e.value-e.oldValue).toLocaleString(this.config.locale,Object.assign(this.currentValueStyle,{currency:e.currency}))}getPortfolioChangePercentAsString(e){return((e.value-e.oldValue)/e.oldValue).toLocaleString(this.config.locale,this.percentStyle)}getPortfolio(e){var t,o,r;let n=[];for(const i of e)try{const e=null===(t=this.config.stocks)||void 0===t?void 0:t.find((e=>{var t;return e.symbol===(null===(t=i.meta)||void 0===t?void 0:t.symbol)}));if(null==e?void 0:e.quantity){const t=(null===(o=i.price)||void 0===o?void 0:o.regularMarketPrice)*e.quantity,s=(null===(r=i.price)||void 0===r?void 0:r.regularMarketPreviousClose)*e.quantity,c=n.find((e=>e.currency===i.price.currency));c?(c.value=c.value+t,c.oldValue=c.oldValue+s):n.push({value:t,oldValue:s,currency:i.price.currency})}}catch(e){console.warn("There was a problem calculating the detpot growth",e)}return console.debug("Portfolio",n),n}}}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}(()=>{const e=o(429);Module.register("MMM-Jast",{defaults:{locale:config.locale||"en-GB",updateIntervalInSeconds:600,useGrouping:!1,currencyStyle:"code",fadeSpeedInSeconds:3.5,stocks:[{name:"BASF",symbol:"BAS.DE",quantity:100},{name:"SAP",symbol:"SAP.DE",quantity:200},{name:"Henkel",symbol:"HEN3.DE"},{name:"AbbVie",symbol:"4AB.DE"},{name:"Bitcoin",symbol:"BTC-EUR"},{name:"Alibaba",symbol:"BABA"}],scroll:"vertical",maxWidth:"100%",numberDecimalsValues:2,numberDecimalsPercentages:1,showColors:!0,showCurrency:!0,showChangePercent:!0,showChangeValue:!1,showChangeValueCurrency:!1,showPortfolioValue:!1,showPortfolioGrowth:!1,showPortfolioGrowthPercent:!1,virtualHorizontalMultiplier:2},getStyles:()=>["MMM-Jast.css"],getTranslations:()=>({en:"translations/en.json",de:"translations/de.json"}),getTemplate:()=>"templates/MMM-Jast.njk",getTemplateData(){const t=new e.default(this.config);return{config:this.config,stocks:this.stocks,utils:t}},start(){this.config.showPortfolioValue=this.config.showDepot||this.config.showPortfolioValue,this.config.showPortfolioGrowth=this.config.showDepotGrowth||this.config.showPortfolioGrowth,this.config.showPortfolioGrowthPercent=this.config.showDepotGrowthPercent||this.config.showPortfolioGrowthPercent,this.nunjucksEnvironment().loaders[0].async=!1,this.nunjucksEnvironment().loaders[0].useCache=!0,this.stocks=[],this.loadData(),this.scheduleUpdate(),this.updateDom()},scheduleUpdate(){const e=this;this.config.updateIntervalInSeconds=this.config.updateIntervalInSeconds<120?120:this.config.updateIntervalInSeconds,setInterval((()=>{e.loadData()}),1e3*this.config.updateIntervalInSeconds)},loadData(){this.sendSocketNotification("GET_STOCKS",this.config)},socketNotificationReceived(e,t){"STOCKS_RESULT"===e&&(this.stocks=t,this.updateDom(),console.debug("Stocks",this.stocks))}})})()})(); \ No newline at end of file diff --git a/README.md b/README.md index 278f7d8..32d16f5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Click here for the Magic Mirror [Forum Thread](https://forum.magicmirror.builder * cryptocurrencies * No API Key required * Vertical or horizontal scrolling or static list -* Depot value growth summary +* Share Portfolio value and growth summary * Very customizable * Easy to use @@ -51,9 +51,9 @@ To use this module, add it to the modules array in the `MagicMirror/config/confi showChangePercent: true, showChangeValue: false, showChangeValueCurrency: false, - showDepot: false, - showDepotGrowthPercent: false, - showDepotGrowth: false, + showPortfolioValue: false, + showPortfolioGrowthPercent: false, + showPortfolioGrowth: false, numberDecimalsValues: 2, numberDecimalsPercentages: 1, virtualHorizontalMultiplier: 2, @@ -82,9 +82,9 @@ To use this module, add it to the modules array in the `MagicMirror/config/confi | showChangePercent | (Boolean) Show stocks change against last close in percent | true | | showChangeValue | (Boolean) Show stocks change against last close in absolute value | false | | showChangeValueCurrency | (Boolean) Show currency for change value | false | -| showDepot | (Boolean) Show depot value | false | -| showDepotGrowth | (Boolean) Show depot value growth summary | false | -| showDepotGrowthPercent | (Boolean) Show depot value growth summary in percent | false | +| showPortfolioValue | (Boolean) Show portfolio value | false | +| showPortfolioGrowth | (Boolean) Show portfolio value growth summary | false | +| showPortfolioGrowthPercent | (Boolean) Show portfolio value growth summary in percent | false | | useGrouping | (Boolean) Add grouping to high value numbers (i.e. BTC 60,000.00 EUR) | false | | virtualHorizontalMultiplier | (Number) Virtually repeats the stocklist in horizontal mode to avoid whitespaces | 2 | @@ -93,7 +93,7 @@ To use this module, add it to the modules array in the `MagicMirror/config/confi | -------- | -------- | -------- | | symbol | (String) Stock's symbol/key | "BABA" | | name | (String) Optional: Stock's display name | "Alibaba" | -| quantity | (Integer) Optional: To calculate depotGrowth | 500 | +| quantity | (Integer) Optional: To calculate portfolio value and growth | 500 | ### Where the hack do I get the symbol for my favorite stocks?! The easiest way to get the symbol for your stock is to open [finance.yahoo.com](https://finance.yahoo.com) and use the search field on the top. You'll find the symbol either in the search preview or in the result page's URL (i.e. https://finance.yahoo.com/quote/BMW.DE?p=BMW.DE where BMW.DE would be the symbol). diff --git a/schema.json b/schema.json index c09be1b..5f8d7bd 100644 --- a/schema.json +++ b/schema.json @@ -120,6 +120,15 @@ "showDepotGrowthPercent": { "type": "boolean" }, + "showPortfolioValue": { + "type": "boolean" + }, + "showPortfolioGrowth": { + "type": "boolean" + }, + "showPortfolioGrowthPercent": { + "type": "boolean" + }, "virtualHorizontalMultiplier": { "type": "integer" } @@ -228,20 +237,35 @@ "key": "MMM-Jast.config.showChangeValueCurrency", "description": "Show currency for change value" }, + { + "title": "showPortfolioValue", + "key": "MMM-Jast.config.showPortfolioValue", + "description": "Show portfolio value" + }, + { + "title": "showPortfolioGrowth", + "key": "MMM-Jast.config.showPortfolioGrowth", + "description": "Show portfolio value growth summary" + }, + { + "title": "showPortfolioGrowthPercent", + "key": "MMM-Jast.config.showPortfolioGrowthPercent", + "description": "Show portfolio value growth summary in percent" + }, { "title": "showDepot", "key": "MMM-Jast.config.showDepot", - "description": "Show depot value" + "description": "[DEPRECATED] This property was replaced by 'showPortfolio'. This field should be set to false, as it will be removed in laters versions." }, { "title": "showDepotGrowth", "key": "MMM-Jast.config.showDepotGrowth", - "description": "Show depot value growth summary" + "description": "[DEPRECATED] This property was replaced by 'showPortfolioGrowth'. This field should be set to false, as it will be removed in laters versions." }, { "title": "showDepotGrowthPercent", "key": "MMM-Jast.config.showDepotGrowthPercent", - "description": "Show depot value growth summary in percent" + "description": "[DEPRECATED] This property was replaced by 'showPortfolioGrowthPercent'. This field should be set to false, as it will be removed in laters versions." }, { "title": "virtualHorizontalMultiplier", @@ -303,6 +327,9 @@ "showDepot": false, "showDepotGrowth": false, "showDepotGrowthPercent": false, + "showPortfolioValue": false, + "showPortfolioGrowth": false, + "showPortfolioGrowthPercent": false, "virtualHorizontalMultiplier": 2 } } diff --git a/src/client/Client.ts b/src/client/Client.ts index 5695334..c261d53 100644 --- a/src/client/Client.ts +++ b/src/client/Client.ts @@ -1,23 +1,23 @@ -import Utils from "./Utils"; -import { Config } from "../models/Config"; +import Utils from './Utils' +import { Config } from '../models/Config' -Module.register("MMM-Jast", { +Module.register('MMM-Jast', { defaults: { - locale: config.locale || "en-GB", + locale: config.locale || 'en-GB', updateIntervalInSeconds: 600, useGrouping: false, - currencyStyle: "code", + currencyStyle: 'code', fadeSpeedInSeconds: 3.5, // Higher value: vertical -> faster // horizontal -> slower stocks: [ - { name: "BASF", symbol: "BAS.DE", quantity: 100 }, - { name: "SAP", symbol: "SAP.DE", quantity: 200 }, - { name: "Henkel", symbol: "HEN3.DE" }, - { name: "AbbVie", symbol: "4AB.DE" }, - { name: "Bitcoin", symbol: "BTC-EUR" }, - { name: "Alibaba", symbol: "BABA" } + { name: 'BASF', symbol: 'BAS.DE', quantity: 100 }, + { name: 'SAP', symbol: 'SAP.DE', quantity: 200 }, + { name: 'Henkel', symbol: 'HEN3.DE' }, + { name: 'AbbVie', symbol: '4AB.DE' }, + { name: 'Bitcoin', symbol: 'BTC-EUR' }, + { name: 'Alibaba', symbol: 'BABA' } ], - scroll: "vertical", - maxWidth: "100%", + scroll: 'vertical', + maxWidth: '100%', numberDecimalsValues: 2, numberDecimalsPercentages: 1, showColors: true, @@ -25,66 +25,70 @@ Module.register("MMM-Jast", { showChangePercent: true, showChangeValue: false, showChangeValueCurrency: false, - showDepot: false, - showDepotGrowth: false, - showDepotGrowthPercent: false, + showPortfolioValue: false, + showPortfolioGrowth: false, + showPortfolioGrowthPercent: false, virtualHorizontalMultiplier: 2 } as Config, getStyles() { - return ["MMM-Jast.css"]; + return ['MMM-Jast.css'] }, getTranslations() { return { - en: "translations/en.json", - de: "translations/de.json" - }; + en: 'translations/en.json', + de: 'translations/de.json' + } }, getTemplate() { - return "templates/MMM-Jast.njk"; + return 'templates/MMM-Jast.njk' }, getTemplateData() { - const utils = new Utils(this.config); + const utils = new Utils(this.config) return { config: this.config, stocks: this.stocks, utils - }; + } }, start() { + // Config compatibility to older versions + this.config.showPortfolioValue = this.config.showDepot || this.config.showPortfolioValue + this.config.showPortfolioGrowth = this.config.showDepotGrowth || this.config.showPortfolioGrowth + this.config.showPortfolioGrowthPercent = + this.config.showDepotGrowthPercent || this.config.showPortfolioGrowthPercent + // Override defaults - this.nunjucksEnvironment().loaders[0].async = false; - this.nunjucksEnvironment().loaders[0].useCache = true; - this.stocks = []; - this.loadData(); - this.scheduleUpdate(); - this.updateDom(); + this.nunjucksEnvironment().loaders[0].async = false + this.nunjucksEnvironment().loaders[0].useCache = true + this.stocks = [] + this.loadData() + this.scheduleUpdate() + this.updateDom() }, scheduleUpdate() { - const self = this; + const self = this this.config.updateIntervalInSeconds = - this.config.updateIntervalInSeconds < 120 - ? 120 - : this.config.updateIntervalInSeconds; + this.config.updateIntervalInSeconds < 120 ? 120 : this.config.updateIntervalInSeconds setInterval(() => { - self.loadData(); - }, this.config.updateIntervalInSeconds * 1000); + self.loadData() + }, this.config.updateIntervalInSeconds * 1000) }, loadData() { - this.sendSocketNotification("GET_STOCKS", this.config); + this.sendSocketNotification('GET_STOCKS', this.config) }, socketNotificationReceived(notificationIdentifier: string, payload: any) { - if (notificationIdentifier === "STOCKS_RESULT") { - this.stocks = payload; - this.updateDom(); - console.debug("Stocks", this.stocks); + if (notificationIdentifier === 'STOCKS_RESULT') { + this.stocks = payload + this.updateDom() + console.debug('Stocks', this.stocks) } } -}); +}) diff --git a/src/client/Utils.ts b/src/client/Utils.ts index deb50e2..d49cc56 100644 --- a/src/client/Utils.ts +++ b/src/client/Utils.ts @@ -1,4 +1,4 @@ -import { Depot } from '../models/Depot' +import { Portfolio } from '../models/Portfolio' import { StockResponse } from '../models/StockResponse' import { Config } from '../models/Config' @@ -91,27 +91,27 @@ export default class JastUtils { return stock.meta.name || stock.price.longName } - getDepotValueAsString(depot: Depot) { - return depot.value.toLocaleString( + getPortfolioValueAsString(portfolio: Portfolio) { + return portfolio.value.toLocaleString( this.config.locale, Object.assign(this.currentValueStyle, { - currency: depot.currency + currency: portfolio.currency }) ) } - getDepotChangeAsString(depot: Depot) { - const change = depot.value - depot.oldValue + getPortfolioChangeAsString(portfolio: Portfolio) { + const change = portfolio.value - portfolio.oldValue return change.toLocaleString( this.config.locale, Object.assign(this.currentValueStyle, { - currency: depot.currency + currency: portfolio.currency }) ) } - getDepotChangePercentAsString(depot: Depot): string { - const change = (depot.value - depot.oldValue) / depot.oldValue + getPortfolioChangePercentAsString(portfolio: Portfolio): string { + const change = (portfolio.value - portfolio.oldValue) / portfolio.oldValue return change.toLocaleString( this.config.locale, this.percentStyle @@ -119,8 +119,8 @@ export default class JastUtils { } - getDepot(stocks: StockResponse[]): Depot[] { - let depot: Depot[] = [] + getPortfolio(stocks: StockResponse[]): Portfolio[] { + let portfolio: Portfolio[] = [] for (const stock of stocks) { try { const configStock = this.config.stocks?.find( @@ -131,7 +131,7 @@ export default class JastUtils { stock.price?.regularMarketPrice * configStock.quantity const lastStockValue = stock.price?.regularMarketPreviousClose * configStock.quantity - const existingCurrency = depot.find( + const existingCurrency = portfolio.find( (growth) => growth.currency === stock.price.currency ) @@ -139,7 +139,7 @@ export default class JastUtils { existingCurrency.value = existingCurrency.value + currentStockValue existingCurrency.oldValue = existingCurrency.oldValue + lastStockValue } else { - depot.push({ + portfolio.push({ value: currentStockValue, oldValue: lastStockValue, currency: stock.price.currency @@ -151,7 +151,7 @@ export default class JastUtils { } } - console.debug("Depot", depot) - return depot + console.debug("Portfolio", portfolio) + return portfolio } } diff --git a/src/models/Config.ts b/src/models/Config.ts index a731713..e0c8370 100644 --- a/src/models/Config.ts +++ b/src/models/Config.ts @@ -15,9 +15,9 @@ export type Config = { showChangePercent: boolean showChangeValue: boolean showChangeValueCurrency: boolean - showDepot: boolean - showDepotGrowth: boolean - showDepotGrowthPercent: boolean + showPortfolioValue: boolean + showPortfolioGrowth: boolean + showPortfolioGrowthPercent: boolean virtualHorizontalMultiplier: number } diff --git a/src/models/Depot.ts b/src/models/Portfolio.ts similarity index 68% rename from src/models/Depot.ts rename to src/models/Portfolio.ts index 33d5c50..9bda383 100644 --- a/src/models/Depot.ts +++ b/src/models/Portfolio.ts @@ -1,4 +1,4 @@ -export type Depot = { +export type Portfolio = { value: number oldValue: number currency: string diff --git a/templates/HorizontalStockList.njk b/templates/HorizontalStockList.njk index 34f1a2b..0c8d149 100755 --- a/templates/HorizontalStockList.njk +++ b/templates/HorizontalStockList.njk @@ -24,10 +24,10 @@ {% endfor %} - {% if config.showDepot or config.showDepotGrowth or config.showDepotGrowthPercent%} - {% set depot = utils.getDepot(stocks) %} - {{ "depot" | translate | safe }} - {% for entry in depot %} + {% if config.showPortfolioValue or config.showPortfolioGrowth or config.showPortfolioGrowthPercent%} + {% set portfolio = utils.getPortfolio(stocks) %} + {{ "portfolio" | translate | safe }} + {% for entry in portfolio %} {% if entry.value > entry.oldValue %} {% set colorClass = "high" %} {% elif entry.value < entry.oldValue %} @@ -36,13 +36,13 @@ {% set colorClass = "" %} {% endif %} - {% if config.showDepot %} {{ utils.getDepotValueAsString(entry) }} {% endif %} + {% if config.showPortfolioValue %} {{ utils.getPortfolioValueAsString(entry) }} {% endif %} - {% if config.showDepotGrowth or config.showDepotGrowthPercent %} - {% if config.showDepot %}({% endif %} - {% if config.showDepotGrowth %}{% if colorClass == "high" %}+{%endif%}{{ utils.getDepotChangeAsString(entry) }}{% endif %} - {% if config.showDepotGrowthPercent %}{% if colorClass == "high" %}+{%endif%}{{ utils.getDepotChangePercentAsString(entry) }}{% endif %} - {% if config.showDepot %}){% endif %} + {% if config.showPortfolioGrowth or config.showPortfolioGrowthPercent %} + {% if config.showPortfolioValue %}({% endif %} + {% if config.showPortfolioGrowth %}{% if colorClass == "high" %}+{%endif%}{{ utils.getPortfolioChangeAsString(entry) }}{% endif %} + {% if config.showPortfolioGrowthPercent %}{% if colorClass == "high" %}+{%endif%}{{ utils.getPortfolioChangePercentAsString(entry) }}{% endif %} + {% if config.showPortfolioValue %}){% endif %} {% endif %} diff --git a/templates/VerticalScrollStyle.njk b/templates/VerticalScrollStyle.njk index d6ea492..406ed13 100755 --- a/templates/VerticalScrollStyle.njk +++ b/templates/VerticalScrollStyle.njk @@ -1,5 +1,5 @@ {% macro render() %} - {% if config.showDepotGrowth %} + {% if config.showPortfolioGrowth %} {% set itemCount = stocks.length + 1 %} {% else %} {% set itemCount = stocks.length %} diff --git a/templates/VerticalStockList.njk b/templates/VerticalStockList.njk index 46531fd..f2dcbc0 100755 --- a/templates/VerticalStockList.njk +++ b/templates/VerticalStockList.njk @@ -3,7 +3,7 @@ {% macro render() %} {% if config.scroll == "vertical" %} {{ vss.render(config) }} - {% if config.showDepotGrowth %} + {% if config.showPortfolioGrowth %} {% set fadeSpeed = stocks.length + 1 %} {% else %} {% set fadeSpeed = stocks.length %} @@ -31,10 +31,10 @@ {% endfor %} - {% if config.showDepot or config.showDepotGrowth or config.showDepotGrowthPercent%} - {% set depot = utils.getDepot(stocks) %} -
  • {{ "depot" | translate | safe }} - {% for entry in depot %} + {% if config.showPortfolioValue or config.showPortfolioGrowth or config.showPortfolioGrowthPercent%} + {% set portfolio = utils.getPortfolio(stocks) %} +
  • {{ "portfolio" | translate | safe }} + {% for entry in portfolio %} {% if entry.value > entry.oldValue %} {% set colorClass = "high" %} {% elif entry.value < entry.oldValue %} @@ -43,12 +43,12 @@ {% set colorClass = "" %} {% endif %} - {% if config.showDepot %} {{ utils.getDepotValueAsString(entry) }} {% endif %} - {% if config.showDepotGrowth or config.showDepotGrowthPercent %} - {% if config.showDepot %}({% endif %} - {% if config.showDepotGrowth %}{% if colorClass == "high" %}+{%endif%}{{ utils.getDepotChangeAsString(entry) }}{% endif %} - {% if config.showDepotGrowthPercent %}{% if colorClass == "high" %}+{%endif%}{{ utils.getDepotChangePercentAsString(entry) }}{% endif %} - {% if config.showDepot %}){% endif %} + {% if config.showPortfolioValue %} {{ utils.getPortfolioValueAsString(entry) }} {% endif %} + {% if config.showPortfolioGrowth or config.showPortfolioGrowthPercent %} + {% if config.showPortfolioValue %}({% endif %} + {% if config.showPortfolioGrowth %}{% if colorClass == "high" %}+{%endif%}{{ utils.getPortfolioChangeAsString(entry) }}{% endif %} + {% if config.showPortfolioGrowthPercent %}{% if colorClass == "high" %}+{%endif%}{{ utils.getPortfolioChangePercentAsString(entry) }}{% endif %} + {% if config.showPortfolioValue %}){% endif %} {% endif %} diff --git a/translations/de.json b/translations/de.json index 4b2e837..c6bca55 100644 --- a/translations/de.json +++ b/translations/de.json @@ -1,3 +1,3 @@ { - "depot": "Depot:" + "portfolio": "Depot:" } diff --git a/translations/en.json b/translations/en.json index 4b2e837..3e89127 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1,3 +1,3 @@ { - "depot": "Depot:" + "portfolio": "Portfolio:" }