From f781eb207ca24c1e8d0dec80b81541fbba0158aa Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 12 Mar 2022 18:40:09 +0100 Subject: [PATCH 1/9] Release 1.125.0 (#752) --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f3cf93b..b2080c09a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 1.125.0 - 12.03.2022 ### Added diff --git a/package.json b/package.json index f2d990a6e..f64fd1a18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "1.124.0", + "version": "1.125.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "scripts": { From 122ba9046faa883cf9e7062cd2ac486af0c0fafc Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 13 Mar 2022 21:00:40 +0100 Subject: [PATCH 2/9] Add type (#751) * Add type * Refactor import to import type --- .../data-provider/yahoo-finance/yahoo-finance.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts index 95a14c1ab..ef4328fc8 100644 --- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts @@ -21,6 +21,7 @@ import Big from 'big.js'; import { countries } from 'countries-list'; import { addDays, format, isSameDay } from 'date-fns'; import yahooFinance from 'yahoo-finance2'; +import type { Price } from 'yahoo-finance2/dist/esm/src/modules/quoteSummary-iface'; @Injectable() export class YahooFinanceService implements DataProviderInterface { @@ -303,7 +304,7 @@ export class YahooFinanceService implements DataProviderInterface { return { items }; } - private parseAssetClass(aPrice: any): { + private parseAssetClass(aPrice: Price): { assetClass: AssetClass; assetSubClass: AssetSubClass; } { From 5a369f29d421d7e8dcf579da45039565f09687e6 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 13 Mar 2022 21:01:15 +0100 Subject: [PATCH 3/9] Feature/restructure portfolio summary tab (#754) * Restructure portfolio summary * Update changelog --- CHANGELOG.md | 6 +++++ .../portfolio-summary.component.html | 26 +++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2080c09a..ea930a8ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Restructured the portfolio summary tab on the home page + ## 1.125.0 - 12.03.2022 ### Added diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html index 5335b77a7..5206aaedc 100644 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html +++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html @@ -119,7 +119,7 @@

-
Value
+
Total
+
+
Valuables
+
+ +
+
Emergency Fund
-
Cash (Buying Power)
+
Buying Power
-
-
Items
-
- -
-

From e769fabbaeac67edf173e4aadb0b4da3d3ef1a39 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 13 Mar 2022 21:39:06 +0100 Subject: [PATCH 4/9] Feature/add multilines to tooltips in proportion chart (#753) * Introduce multilines for tooltips * Update changelog --- CHANGELOG.md | 1 + .../portfolio-proportion-chart.component.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea930a8ca..3502aef38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Restructured the portfolio summary tab on the home page +- Improved the tooltips in the portfolio proportion chart component by introducing multilines ## 1.125.0 - 12.03.2022 diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts index 9fee13d0e..803e52fea 100644 --- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts +++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts @@ -324,16 +324,16 @@ export class PortfolioProportionChartComponent const percentage = (context.parsed * 100) / sum; if (this.isInPercent) { - return `${name ?? symbol} (${percentage.toFixed(2)}%)`; + return [`${name ?? symbol}`, `${percentage.toFixed(2)}%`]; } else { const value = context.raw; - return `${name ?? symbol}: ${value.toLocaleString( - this.locale, - { + return [ + `${name ?? symbol}`, + `${value.toLocaleString(this.locale, { maximumFractionDigits: 2, minimumFractionDigits: 2 - } - )} ${this.baseCurrency} (${percentage.toFixed(2)}%)`; + })} ${this.baseCurrency} (${percentage.toFixed(2)}%)` + ]; } } } From d8da574ae416f33371669d21da3933880003faed Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 14 Mar 2022 17:39:09 +0100 Subject: [PATCH 5/9] Feature/add support for bonds (#755) * Add support for bonds * Update changelog --- CHANGELOG.md | 8 ++++++++ .../migration.sql | 2 ++ .../migration.sql | 2 ++ prisma/schema.prisma | 2 ++ 4 files changed, 14 insertions(+) create mode 100644 prisma/migrations/20220313200604_added_fixed_income_to_asset_class/migration.sql create mode 100644 prisma/migrations/20220313200721_added_bond_to_asset_sub_class/migration.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 3502aef38..146f17e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added support for bonds + ### Changed - Restructured the portfolio summary tab on the home page - Improved the tooltips in the portfolio proportion chart component by introducing multilines +### Todo + +- Apply data migration (`yarn database:migrate`) + ## 1.125.0 - 12.03.2022 ### Added diff --git a/prisma/migrations/20220313200604_added_fixed_income_to_asset_class/migration.sql b/prisma/migrations/20220313200604_added_fixed_income_to_asset_class/migration.sql new file mode 100644 index 000000000..c9e812f64 --- /dev/null +++ b/prisma/migrations/20220313200604_added_fixed_income_to_asset_class/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "AssetClass" ADD VALUE 'FIXED_INCOME'; diff --git a/prisma/migrations/20220313200721_added_bond_to_asset_sub_class/migration.sql b/prisma/migrations/20220313200721_added_bond_to_asset_sub_class/migration.sql new file mode 100644 index 000000000..4dd560edb --- /dev/null +++ b/prisma/migrations/20220313200721_added_bond_to_asset_sub_class/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "AssetSubClass" ADD VALUE 'BOND'; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 738797ed6..6dea69159 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -171,9 +171,11 @@ enum AssetClass { CASH COMMODITY EQUITY + FIXED_INCOME } enum AssetSubClass { + BOND CRYPTOCURRENCY ETF MUTUALFUND From 5356bf568e9db71f3e2d66244b768a0797106b12 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 14 Mar 2022 17:41:23 +0100 Subject: [PATCH 6/9] Release 1.126.0 (#756) --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 146f17e7f..f2c8aff60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 1.126.0 - 14.03.2022 ### Added diff --git a/package.json b/package.json index f64fd1a18..74c29aee8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "1.125.0", + "version": "1.126.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "scripts": { From 4826a51199a8ad0e0e9de72fb7a24be7eeb6a324 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 15 Mar 2022 17:13:42 +0100 Subject: [PATCH 7/9] Feature/improve handling of scraper configuration (#757) * Improve handling of missing scraper configuration * Update changelog --- CHANGELOG.md | 6 ++++++ .../ghostfolio-scraper-api.service.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2c8aff60..ce8e7faca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Improved the error handling in the scraper configuration + ## 1.126.0 - 14.03.2022 ### Added diff --git a/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts b/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts index 35c53bc7a..bd126e235 100644 --- a/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts +++ b/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts @@ -50,16 +50,18 @@ export class GhostfolioScraperApiService implements DataProviderInterface { const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles( [symbol] ); - const scraperConfiguration = symbolProfile?.scraperConfiguration; + const { selector, url } = symbolProfile.scraperConfiguration; - const get = bent(scraperConfiguration?.url, 'GET', 'string', 200, {}); + if (selector === undefined || url === undefined) { + return {}; + } + + const get = bent(url, 'GET', 'string', 200, {}); const html = await get(); const $ = cheerio.load(html); - const value = this.extractNumberFromString( - $(scraperConfiguration?.selector).text() - ); + const value = this.extractNumberFromString($(selector).text()); return { [symbol]: { From 402d73a12c9e7ab011c86d9dfa36c80b04c7c3bd Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 16 Mar 2022 22:07:18 +0100 Subject: [PATCH 8/9] Bugfix/fix get quotes for multiple ghostfolio symbols (#758) * Support multiple symbols in getQuotes() * Update changelog --- CHANGELOG.md | 4 +++ .../ghostfolio-scraper-api.service.ts | 33 ++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce8e7faca..691f1b259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the error handling in the scraper configuration +### Fixed + +- Fixed the support for multiple symbols of the data source `GHOSTFOLIO` + ## 1.126.0 - 14.03.2022 ### Added diff --git a/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts b/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts index bd126e235..fb4df11e8 100644 --- a/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts +++ b/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts @@ -84,33 +84,42 @@ export class GhostfolioScraperApiService implements DataProviderInterface { public async getQuotes( aSymbols: string[] ): Promise<{ [symbol: string]: IDataProviderResponse }> { + const response: { [symbol: string]: IDataProviderResponse } = {}; + if (aSymbols.length <= 0) { - return {}; + return response; } try { - const [symbol] = aSymbols; - const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles( - [symbol] + const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( + aSymbols ); - const { marketPrice } = await this.prismaService.marketData.findFirst({ + const marketData = await this.prismaService.marketData.findMany({ + distinct: ['symbol'], orderBy: { date: 'desc' }, + take: aSymbols.length, where: { - symbol + symbol: { + in: aSymbols + } } }); - return { - [symbol]: { - marketPrice, - currency: symbolProfile?.currency, + for (const symbolProfile of symbolProfiles) { + response[symbolProfile.symbol] = { + currency: symbolProfile.currency, dataSource: this.getName(), + marketPrice: marketData.find((marketDataItem) => { + return marketDataItem.symbol === symbolProfile.symbol; + }).marketPrice, marketState: MarketState.delayed - } - }; + }; + } + + return response; } catch (error) { Logger.error(error, 'GhostfolioScraperApiService'); } From 6e582fe50517fd7b7673b301c00ae057c49b4213 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 16 Mar 2022 22:08:48 +0100 Subject: [PATCH 9/9] Release 1.127.0 (#759) --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 691f1b259..ebe008da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 1.127.0 - 16.03.2022 ### Changed diff --git a/package.json b/package.json index 74c29aee8..ceb78f57a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "1.126.0", + "version": "1.127.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "scripts": {