From d32dd5e8605ad4a8bdb1833d9348a7b464460921 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:16:20 +0100 Subject: [PATCH 1/9] Feature/upgrade countries list to version 3.1.0 (#3131) * Upgrade countries-list to version 3.1.0 * Update changelog --- CHANGELOG.md | 4 ++++ .../data-enhancer/trackinsight/trackinsight.service.ts | 9 ++++----- .../services/symbol-profile/symbol-profile.service.ts | 5 ++--- package.json | 2 +- yarn.lock | 8 ++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44b641f7f..f7ca1dc34 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 - Extended the content of the _Self-Hosting_ section by available home server systems on the Frequently Asked Questions (FAQ) page +### Changed + +- Upgraded `countries-list` from version `2.6.1` to `3.1.0` + ### Fixed - Fixed an issue in the performance calculation caused by multiple `SELL` activities on the same day diff --git a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts index 63d785253..ddc3d79f8 100644 --- a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts +++ b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts @@ -5,12 +5,12 @@ import { Sector } from '@ghostfolio/common/interfaces/sector.interface'; import { Injectable } from '@nestjs/common'; import { SymbolProfile } from '@prisma/client'; +import { countries } from 'countries-list'; import got from 'got'; @Injectable() export class TrackinsightDataEnhancerService implements DataEnhancerInterface { private static baseUrl = 'https://www.trackinsight.com/data-api'; - private static countries = require('countries-list/dist/countries.json'); private static countriesMapping = { 'Russian Federation': 'Russia' }; @@ -131,20 +131,19 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { (response.countries as unknown as Country[]).length === 0 ) { response.countries = []; + for (const [name, value] of Object.entries( holdings?.countries ?? {} )) { let countryCode: string; - for (const [key, country] of Object.entries( - TrackinsightDataEnhancerService.countries - )) { + for (const [code, country] of Object.entries(countries)) { if ( country.name === name || country.name === TrackinsightDataEnhancerService.countriesMapping[name] ) { - countryCode = key; + countryCode = code; break; } } diff --git a/apps/api/src/services/symbol-profile/symbol-profile.service.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.ts index a87b00d95..751feda22 100644 --- a/apps/api/src/services/symbol-profile/symbol-profile.service.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.service.ts @@ -189,9 +189,8 @@ export class SymbolProfileService { return { code, weight, - continent: - continents[countries[code as string]?.continent] ?? UNKNOWN_KEY, - name: countries[code as string]?.name ?? UNKNOWN_KEY + continent: continents[countries[code]?.continent] ?? UNKNOWN_KEY, + name: countries[code]?.name ?? UNKNOWN_KEY }; }); } diff --git a/package.json b/package.json index ddd5de1cf..5b92172e4 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "class-validator": "0.14.0", "color": "4.2.3", "countries-and-timezones": "3.4.1", - "countries-list": "2.6.1", + "countries-list": "3.1.0", "countup.js": "2.3.2", "date-fns": "2.29.3", "envalid": "7.3.1", diff --git a/yarn.lock b/yarn.lock index f71e7ad80..ba7e811ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9739,10 +9739,10 @@ countries-and-timezones@3.4.1: resolved "https://registry.yarnpkg.com/countries-and-timezones/-/countries-and-timezones-3.4.1.tgz#0ec2540f57e42f0f740eb2acaede786043347fe1" integrity sha512-INeHGCony4XUUR8iGL/lmt9s1Oi+n+gFHeJAMfbV5hJfYeDOB8JG1oxz5xFQu5oBZoRCJe/87k1Vzue9DoIauA== -countries-list@2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-2.6.1.tgz#d479757ac873b1e596ccea0a925962d20396c0cb" - integrity sha512-jXM1Nv3U56dPQ1DsUSsEaGmLHburo4fnB7m+1yhWDUVvx5gXCd1ok/y3gXCjXzhqyawG+igcPYcAl4qjkvopaQ== +countries-list@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-3.1.0.tgz#1cbe32f58659c7d6a1e744917689f24c84333ea8" + integrity sha512-HpTBLZba1VPTZSjUnUwR7SykxV7Z/7/+ZM5x5wi5tO99Qvom6bE2SC+AQ18016ujg3jSlYBbMITrHNnPAHSM9Q== countup.js@2.3.2: version "2.3.2" From e792924606dd98849008855c9320ff3f7eacf35d Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:15:32 +0100 Subject: [PATCH 2/9] Update OSS friends (#3132) --- apps/client/src/assets/oss-friends.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/client/src/assets/oss-friends.json b/apps/client/src/assets/oss-friends.json index 73674e8dd..cbbbd5987 100644 --- a/apps/client/src/assets/oss-friends.json +++ b/apps/client/src/assets/oss-friends.json @@ -1,5 +1,5 @@ { - "createdAt": "2024-02-29T00:00:00.000Z", + "createdAt": "2024-03-11T00:00:00.000Z", "data": [ { "name": "Aptabase", @@ -8,7 +8,7 @@ }, { "name": "Argos", - "description": "Argos provides the developer tools to debug tests and detect visual regressions..", + "description": "Argos provides the developer tools to debug tests and detect visual regressions.", "href": "https://argos-ci.com" }, { From 59c064e3c8ccfcbe0b6f2b9cbbcd28586f40c904 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:15:55 +0100 Subject: [PATCH 3/9] Feature/upgrade yahoo finance2 to version 2.10.0 (#3127) * Upgrade yahoo-finance2 to version 2.10.0 * Update changelog --- CHANGELOG.md | 1 + package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ca1dc34..242dd9dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Upgraded `countries-list` from version `2.6.1` to `3.1.0` +- Upgraded `yahoo-finance2` from version `2.9.1` to `2.10.0` ### Fixed diff --git a/package.json b/package.json index 5b92172e4..bdac1e9b1 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "svgmap": "2.6.0", "twitter-api-v2": "1.14.2", "uuid": "9.0.1", - "yahoo-finance2": "2.9.1", + "yahoo-finance2": "2.10.0", "zone.js": "0.14.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index ba7e811ef..8cf31c64b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19242,10 +19242,10 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yahoo-finance2@2.9.1: - version "2.9.1" - resolved "https://registry.yarnpkg.com/yahoo-finance2/-/yahoo-finance2-2.9.1.tgz#43e22465403f48c688ff8e762f3894aac8014d70" - integrity sha512-s+i5arE6+zUwHRJnze4EsU5aCTmsMFKFeBc9sMzSceDOjH+BSeEZG9twMYtWlSCjKbWLCmUEUCxtH1fvcq+f6Q== +yahoo-finance2@2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/yahoo-finance2/-/yahoo-finance2-2.10.0.tgz#90a9d7984e3b35a11fff9850c55d1cd322ddbee3" + integrity sha512-yKHjMEnFVkgIvgyxjsNAMLf4xGCKM+HzThorCNuCoE71yoie75lR+WTd0HshdCnb8tpsCclFaP045I+p6Mu6aA== dependencies: "@types/tough-cookie" "^4.0.2" ajv "8.10.0" From 7a364472c83662f770f9c319e1040590146dea2f Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:16:56 +0100 Subject: [PATCH 4/9] Bugfix/fix liability issue in allocations (#3133) * Remove liabilities from allocations calculation * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/portfolio/portfolio.controller.ts | 7 +++++-- apps/api/src/app/portfolio/portfolio.service.ts | 4 ++-- .../home-summary/home-summary.component.ts | 2 +- apps/client/src/app/services/data.service.ts | 12 ++++++++++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 242dd9dfe..2fddca32c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed an issue in the performance calculation caused by multiple `SELL` activities on the same day +- Fixed an issue in the calculation on the allocations page caused by liabilities ## 2.62.0 - 2024-03-09 diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 748850204..557e8a5f5 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -76,8 +76,11 @@ export class PortfolioController { @Query('accounts') filterByAccounts?: string, @Query('assetClasses') filterByAssetClasses?: string, @Query('range') dateRange: DateRange = 'max', - @Query('tags') filterByTags?: string + @Query('tags') filterByTags?: string, + @Query('withLiabilities') withLiabilitiesParam = 'false' ): Promise { + const withLiabilities = withLiabilitiesParam === 'true'; + let hasDetails = true; let hasError = false; const hasReadRestrictedAccessPermission = @@ -101,8 +104,8 @@ export class PortfolioController { dateRange, filters, impersonationId, + withLiabilities, userId: this.request.user.id, - withLiabilities: true, withSummary: true }); diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 9880abcc4..74d7b382a 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -146,8 +146,7 @@ export class PortfolioService { filters, withExcludedAccounts, impersonationId: userId, - userId: this.request.user.id, - withLiabilities: true + userId: this.request.user.id }) ]); @@ -393,6 +392,7 @@ export class PortfolioService { }); const holdings: PortfolioDetails['holdings'] = {}; + const totalValueInBaseCurrency = currentPositions.currentValueInBaseCurrency.plus( cashDetails.balanceInBaseCurrency diff --git a/apps/client/src/app/components/home-summary/home-summary.component.ts b/apps/client/src/app/components/home-summary/home-summary.component.ts index b67b67ce5..bb68a4627 100644 --- a/apps/client/src/app/components/home-summary/home-summary.component.ts +++ b/apps/client/src/app/components/home-summary/home-summary.component.ts @@ -102,7 +102,7 @@ export class HomeSummaryComponent implements OnDestroy, OnInit { this.isLoading = true; this.dataService - .fetchPortfolioDetails() + .fetchPortfolioDetails({ withLiabilities: true }) .pipe(takeUntil(this.unsubscribeSubject)) .subscribe(({ summary }) => { this.summary = summary; diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index 7741fd601..0c8781eb1 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -390,13 +390,21 @@ export class DataService { } public fetchPortfolioDetails({ - filters + filters, + withLiabilities = false }: { filters?: Filter[]; + withLiabilities?: boolean; } = {}): Observable { + let params = this.buildFiltersAsQueryParams({ filters }); + + if (withLiabilities) { + params = params.append('withLiabilities', withLiabilities); + } + return this.http .get('/api/v1/portfolio/details', { - params: this.buildFiltersAsQueryParams({ filters }) + params }) .pipe( map((response) => { From d23cb5f1902f3b5aca249e5b08e671253d117f38 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:17:47 +0100 Subject: [PATCH 5/9] Feature/upgrade simplewebauthn dependencies to version 9.0 (#3130) * Upgrade @simplewebauthn/browser and @simplewebauthn/server to version 9.0 * Update changelog --- CHANGELOG.md | 1 + package.json | 6 +-- yarn.lock | 116 +++++++++++++-------------------------------------- 3 files changed, 34 insertions(+), 89 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fddca32c..18c2f4fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Upgraded `@simplewebauthn/browser` and `@simplewebauthn/server` from version `8.3` to `9.0` - Upgraded `countries-list` from version `2.6.1` to `3.1.0` - Upgraded `yahoo-finance2` from version `2.9.1` to `2.10.0` diff --git a/package.json b/package.json index bdac1e9b1..c8d2cbdba 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,8 @@ "@nestjs/schedule": "3.0.2", "@nestjs/serve-static": "4.0.0", "@prisma/client": "5.10.2", - "@simplewebauthn/browser": "8.3.1", - "@simplewebauthn/server": "8.3.2", + "@simplewebauthn/browser": "9.0.1", + "@simplewebauthn/server": "9.0.3", "@stripe/stripe-js": "1.47.0", "alphavantage": "2.2.0", "big.js": "6.2.1", @@ -159,7 +159,7 @@ "@nx/web": "18.0.4", "@nx/workspace": "18.0.4", "@schematics/angular": "17.1.3", - "@simplewebauthn/typescript-types": "8.0.0", + "@simplewebauthn/types": "9.0.1", "@storybook/addon-essentials": "7.6.5", "@storybook/angular": "7.6.5", "@storybook/core-server": "7.6.5", diff --git a/yarn.lock b/yarn.lock index 8cf31c64b..7092b4b93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2744,36 +2744,6 @@ resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz#923ca57e173c6b232bbbb07347b1be982f03e783" integrity sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A== -"@cbor-extract/cbor-extract-darwin-arm64@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.1.1.tgz#5721f6dd3feae0b96d23122853ce977e0671b7a6" - integrity sha512-blVBy5MXz6m36Vx0DfLd7PChOQKEs8lK2bD1WJn/vVgG4FXZiZmZb2GECHFvVPA5T7OnODd9xZiL3nMCv6QUhA== - -"@cbor-extract/cbor-extract-darwin-x64@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-darwin-x64/-/cbor-extract-darwin-x64-2.1.1.tgz#c25e7d0133950d87d101d7b3afafea8d50d83f5f" - integrity sha512-h6KFOzqk8jXTvkOftyRIWGrd7sKQzQv2jVdTL9nKSf3D2drCvQB/LHUxAOpPXo3pv2clDtKs3xnHalpEh3rDsw== - -"@cbor-extract/cbor-extract-linux-arm64@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-linux-arm64/-/cbor-extract-linux-arm64-2.1.1.tgz#48f78e7d8f0fcc84ed074b6bfa6d15dd83187c63" - integrity sha512-SxAaRcYf8S0QHaMc7gvRSiTSr7nUYMqbUdErBEu+HYA4Q6UNydx1VwFE68hGcp1qvxcy9yT5U7gA+a5XikfwSQ== - -"@cbor-extract/cbor-extract-linux-arm@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-linux-arm/-/cbor-extract-linux-arm-2.1.1.tgz#7507d346389cb682e44fab8fae9534edd52e2e41" - integrity sha512-ds0uikdcIGUjPyraV4oJqyVE5gl/qYBpa/Wnh6l6xLE2lj/hwnjT2XcZCChdXwW/YFZ1LUHs6waoYN8PmK0nKQ== - -"@cbor-extract/cbor-extract-linux-x64@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-linux-x64/-/cbor-extract-linux-x64-2.1.1.tgz#b7c1d2be61c58ec18d58afbad52411ded63cd4cd" - integrity sha512-GVK+8fNIE9lJQHAlhOROYiI0Yd4bAZ4u++C2ZjlkS3YmO6hi+FUxe6Dqm+OKWTcMpL/l71N6CQAmaRcb4zyJuA== - -"@cbor-extract/cbor-extract-win32-x64@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-win32-x64/-/cbor-extract-win32-x64-2.1.1.tgz#21b11a1a3f18c3e7d62fd5f87438b7ed2c64c1f7" - integrity sha512-2Niq1C41dCRIDeD8LddiH+mxGlO7HJ612Ll3D/E73ZWBmycued+8ghTr/Ho3CMOWPUEr08XtyBMVXAjqF+TcKw== - "@codewithdan/observable-store@2.2.15": version "2.2.15" resolved "https://registry.yarnpkg.com/@codewithdan/observable-store/-/observable-store-2.2.15.tgz#6d27e0988e182853def59a714b712f4389e558d2" @@ -3839,6 +3809,11 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== +"@levischuck/tiny-cbor@^0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@levischuck/tiny-cbor/-/tiny-cbor-0.2.2.tgz#84239ce80e1107b810f1fe9f66546d4f79f31aea" + integrity sha512-f5CnPw997Y2GQ8FAvtuVVC19FX8mwNNC+1XJcIi16n/LTJifKO6QBgGLgN3YEmqtGMk17SKSuoWES3imJVxAVw== + "@ljharb/through@^2.3.11": version "2.3.12" resolved "https://registry.yarnpkg.com/@ljharb/through/-/through-2.3.12.tgz#c418c43060eee193adce48b15c2206096a28e9ea" @@ -5214,7 +5189,7 @@ tslib "^2.3.0" yargs-parser "21.1.1" -"@peculiar/asn1-android@^2.3.6": +"@peculiar/asn1-android@^2.3.10": version "2.3.10" resolved "https://registry.yarnpkg.com/@peculiar/asn1-android/-/asn1-android-2.3.10.tgz#a2dde6227fa1ddea33d8ae7835768674e7a0baa6" integrity sha512-z9Rx9cFJv7UUablZISe7uksNbFJCq13hO0yEAOoIpAymALTLlvUOSLnGiQS7okPaM5dP42oTLhezH6XDXRXjGw== @@ -5223,7 +5198,7 @@ asn1js "^3.0.5" tslib "^2.6.2" -"@peculiar/asn1-ecc@^2.3.6": +"@peculiar/asn1-ecc@^2.3.8": version "2.3.8" resolved "https://registry.yarnpkg.com/@peculiar/asn1-ecc/-/asn1-ecc-2.3.8.tgz#6b1a18f64f221ae862c1038bb125fbf4342918a0" integrity sha512-Ah/Q15y3A/CtxbPibiLM/LKcMbnLTdUdLHUgdpB5f60sSvGkXzxJCu5ezGTFHogZXWNX3KSmYqilCrfdmBc6pQ== @@ -5233,7 +5208,7 @@ asn1js "^3.0.5" tslib "^2.6.2" -"@peculiar/asn1-rsa@^2.3.6": +"@peculiar/asn1-rsa@^2.3.8": version "2.3.8" resolved "https://registry.yarnpkg.com/@peculiar/asn1-rsa/-/asn1-rsa-2.3.8.tgz#6a6a0eaafc0aded9a44b679b522cc2417b09a3ba" integrity sha512-ES/RVEHu8VMYXgrg3gjb1m/XG0KJWnV4qyZZ7mAg7rrF3VTmRbLxO8mk+uy0Hme7geSMebp+Wvi2U6RLLEs12Q== @@ -5243,7 +5218,7 @@ asn1js "^3.0.5" tslib "^2.6.2" -"@peculiar/asn1-schema@^2.3.6", "@peculiar/asn1-schema@^2.3.8": +"@peculiar/asn1-schema@^2.3.8": version "2.3.8" resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.8.tgz#04b38832a814e25731232dd5be883460a156da3b" integrity sha512-ULB1XqHKx1WBU/tTFIA+uARuRoBVZ4pNdOA878RDrRbBfBGcSzi5HBkdScC6ZbHn8z7L8gmKCgPC1LHRrP46tA== @@ -5252,7 +5227,7 @@ pvtsutils "^1.3.5" tslib "^2.6.2" -"@peculiar/asn1-x509@^2.3.6", "@peculiar/asn1-x509@^2.3.8": +"@peculiar/asn1-x509@^2.3.8": version "2.3.8" resolved "https://registry.yarnpkg.com/@peculiar/asn1-x509/-/asn1-x509-2.3.8.tgz#865896e2b849cc3c55497ca685040ef889d357a3" integrity sha512-voKxGfDU1c6r9mKiN5ZUsZWh3Dy1BABvTM3cimf0tztNwyMJPhiXY94eRTgsMQe6ViLfT6EoXxkWVzcm3mFAFw== @@ -5725,37 +5700,32 @@ "@sigstore/protobuf-specs" "^0.2.1" tuf-js "^2.1.0" -"@simplewebauthn/browser@8.3.1": - version "8.3.1" - resolved "https://registry.yarnpkg.com/@simplewebauthn/browser/-/browser-8.3.1.tgz#f5c1aed6313d61944a9e13f16ae4495750bddf93" - integrity sha512-bMW7oOkxX4ydRAkkPtJ1do2k9yOoIGc/hZYebcuEOVdJoC6wwVpu97mYY7Mz8B9hLlcaR5WFgBsLl5tSJVzm8A== +"@simplewebauthn/browser@9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@simplewebauthn/browser/-/browser-9.0.1.tgz#46a12c2bcefcb199f7fcb6a7e883531cd6efde17" + integrity sha512-wD2WpbkaEP4170s13/HUxPcAV5y4ZXaKo1TfNklS5zDefPinIgXOpgz1kpEvobAsaLPa2KeH7AKKX/od1mrBJw== dependencies: - "@simplewebauthn/typescript-types" "^8.0.0" + "@simplewebauthn/types" "^9.0.1" -"@simplewebauthn/server@8.3.2": - version "8.3.2" - resolved "https://registry.yarnpkg.com/@simplewebauthn/server/-/server-8.3.2.tgz#dfdbe7af4c1258e786c4a0b1c83c54743ba7568c" - integrity sha512-ceo8t5gdO5W/JOePQWPDH+rAd8tO6QNalLU56rc9ItdzaTjk+qcYwQg/BKXDDg6117P3HKrRBkZwBrMJl4dOdA== +"@simplewebauthn/server@9.0.3": + version "9.0.3" + resolved "https://registry.yarnpkg.com/@simplewebauthn/server/-/server-9.0.3.tgz#5f73c19ff2420be94cc71a49085879c111d7872d" + integrity sha512-FMZieoBosrVLFxCnxPFD9Enhd1U7D8nidVDT4MsHc6l4fdVcjoeHjDueeXCloO1k5O/fZg1fsSXXPKbY2XTzDA== dependencies: "@hexagon/base64" "^1.1.27" - "@peculiar/asn1-android" "^2.3.6" - "@peculiar/asn1-ecc" "^2.3.6" - "@peculiar/asn1-rsa" "^2.3.6" - "@peculiar/asn1-schema" "^2.3.6" - "@peculiar/asn1-x509" "^2.3.6" - "@simplewebauthn/typescript-types" "^8.0.0" - cbor-x "^1.5.2" + "@levischuck/tiny-cbor" "^0.2.2" + "@peculiar/asn1-android" "^2.3.10" + "@peculiar/asn1-ecc" "^2.3.8" + "@peculiar/asn1-rsa" "^2.3.8" + "@peculiar/asn1-schema" "^2.3.8" + "@peculiar/asn1-x509" "^2.3.8" + "@simplewebauthn/types" "^9.0.1" cross-fetch "^4.0.0" -"@simplewebauthn/typescript-types@8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@simplewebauthn/typescript-types/-/typescript-types-8.0.0.tgz#1698a7228aba880c5c1deba1f13a4f9fd8851cb3" - integrity sha512-d7Izb2H+LZJteXMkS8DmpAarD6mZdpIOu/av/yH4/u/3Pd6DKFLyBM3j8BMmUvUqpzvJvHARNrRfQYto58mtTQ== - -"@simplewebauthn/typescript-types@^8.0.0": - version "8.3.3" - resolved "https://registry.yarnpkg.com/@simplewebauthn/typescript-types/-/typescript-types-8.3.3.tgz#4292656f4fae6c9e9c25e5b94a60fa038a7d11cc" - integrity sha512-YLfmT+HzzUuRtBPp93XgKzQPrFJ1F6f1vl7ltfmm6R9d2SZfr8E15B5CC7hkCwSTioJDCaEw4p3NZt3+nubaxA== +"@simplewebauthn/types@9.0.1", "@simplewebauthn/types@^9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@simplewebauthn/types/-/types-9.0.1.tgz#3a68d50e63d8821cf2067de3324c68d5e8120d0c" + integrity sha512-tGSRP1QvsAvsJmnOlRQyw/mvK9gnPtjEc5fg2+m8n+QUa+D7rvrKkOYyfpy42GTs90X3RDOnqJgfHt+qO67/+w== "@sinclair/typebox@^0.27.8": version "0.27.8" @@ -9078,27 +9048,6 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== -cbor-extract@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/cbor-extract/-/cbor-extract-2.1.1.tgz#f154b31529fdb6b7c70fb3ca448f44eda96a1b42" - integrity sha512-1UX977+L+zOJHsp0mWFG13GLwO6ucKgSmSW6JTl8B9GUvACvHeIVpFqhU92299Z6PfD09aTXDell5p+lp1rUFA== - dependencies: - node-gyp-build-optional-packages "5.0.3" - optionalDependencies: - "@cbor-extract/cbor-extract-darwin-arm64" "2.1.1" - "@cbor-extract/cbor-extract-darwin-x64" "2.1.1" - "@cbor-extract/cbor-extract-linux-arm" "2.1.1" - "@cbor-extract/cbor-extract-linux-arm64" "2.1.1" - "@cbor-extract/cbor-extract-linux-x64" "2.1.1" - "@cbor-extract/cbor-extract-win32-x64" "2.1.1" - -cbor-x@^1.5.2: - version "1.5.4" - resolved "https://registry.yarnpkg.com/cbor-x/-/cbor-x-1.5.4.tgz#8f0754fa8589cbd7339b613b2b5717d133508e98" - integrity sha512-PVKILDn+Rf6MRhhcyzGXi5eizn1i0i3F8Fe6UMMxXBnWkalq9+C5+VTmlIjAYM4iF2IYF2N+zToqAfYOp+3rfw== - optionalDependencies: - cbor-extract "^2.1.1" - chalk@^1.0.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -15213,11 +15162,6 @@ node-forge@^1, node-forge@^1.3.1: resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== -node-gyp-build-optional-packages@5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.3.tgz#92a89d400352c44ad3975010368072b41ad66c17" - integrity sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA== - node-gyp-build-optional-packages@5.0.7: version "5.0.7" resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz#5d2632bbde0ab2f6e22f1bbac2199b07244ae0b3" From 9a3db919827cd2d1a0e05810ec4d33c2a4c49067 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:19:23 +0100 Subject: [PATCH 6/9] Release 2.63.0 (#3134) --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18c2f4fcf..425aa20cb 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 +## 2.63.0 - 2024-03-11 ### Added diff --git a/package.json b/package.json index c8d2cbdba..b5f7d9c3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.62.0", + "version": "2.63.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio", From 473136e9aa4c9144cafacc56d6a7cd0f0b939cf9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 11 Mar 2024 21:35:43 +0100 Subject: [PATCH 7/9] Release 2.63.1 (#3135) * Release 2.63.1 --- CHANGELOG.md | 4 ++- .../src/assets/cryptocurrencies/custom.json | 1 + .../eod-historical-data.service.ts | 31 +++++++------------ package.json | 2 +- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 425aa20cb..0877bcf74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +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). -## 2.63.0 - 2024-03-11 +## 2.63.1 - 2024-03-11 ### Added - Extended the content of the _Self-Hosting_ section by available home server systems on the Frequently Asked Questions (FAQ) page +- Added support for the cryptocurrency _Real Smurf Cat_ (`SMURFCAT-USD`) ### Changed @@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed an issue in the performance calculation caused by multiple `SELL` activities on the same day - Fixed an issue in the calculation on the allocations page caused by liabilities +- Fixed an issue with the currency in the request to get quotes from _EOD Historical Data_ ## 2.62.0 - 2024-03-09 diff --git a/apps/api/src/assets/cryptocurrencies/custom.json b/apps/api/src/assets/cryptocurrencies/custom.json index ffda9c526..ef08ca449 100644 --- a/apps/api/src/assets/cryptocurrencies/custom.json +++ b/apps/api/src/assets/cryptocurrencies/custom.json @@ -4,6 +4,7 @@ "LUNA1": "Terra", "LUNA2": "Terra", "SGB1": "Songbird", + "SMURFCAT": "Real Smurf Cat", "UNI1": "Uniswap", "UNI7083": "Uniswap", "UST": "TerraUSD" diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index af67d62e9..d8e7a2e0b 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -11,7 +11,6 @@ import { IDataProviderHistoricalResponse, IDataProviderResponse } from '@ghostfolio/api/services/interfaces/interfaces'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { DEFAULT_CURRENCY, REPLACE_NAME_PARTS @@ -36,8 +35,7 @@ export class EodHistoricalDataService implements DataProviderInterface { private readonly URL = 'https://eodhistoricaldata.com/api'; public constructor( - private readonly configurationService: ConfigurationService, - private readonly symbolProfileService: SymbolProfileService + private readonly configurationService: ConfigurationService ) { this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA'); } @@ -232,29 +230,24 @@ export class EodHistoricalDataService implements DataProviderInterface { ? [realTimeResponse] : realTimeResponse; - const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( - symbols.map((symbol) => { - return { - symbol, - dataSource: this.getName() - }; - }) - ); - response = quotes.reduce( - ( + async ( result: { [symbol: string]: IDataProviderResponse }, { close, code, timestamp } ) => { - const currency = symbolProfiles.find(({ symbol }) => { - return symbol === code; - })?.currency; + let currency: string; + + if (symbols.length === 1) { + const { items } = await this.search({ query: symbols[0] }); + + if (items.length === 1) { + currency = items[0].currency; + } + } if (isNumber(close)) { result[this.convertFromEodSymbol(code)] = { - currency: - currency ?? - this.convertFromEodSymbol(code)?.replace(DEFAULT_CURRENCY, ''), + currency, dataSource: this.getName(), marketPrice: close, marketState: isToday(new Date(timestamp * 1000)) diff --git a/package.json b/package.json index b5f7d9c3d..579c4151e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.63.0", + "version": "2.63.1", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio", From 671e4e316b3db329b2ba53ecd2d25acf35acdcd7 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:50:32 +0100 Subject: [PATCH 8/9] Release 2.63.2 (#3138) --- CHANGELOG.md | 2 +- .../eod-historical-data.service.ts | 76 +++++++++++-------- package.json | 2 +- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0877bcf74..6f1c07500 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). -## 2.63.1 - 2024-03-11 +## 2.63.2 - 2024-03-12 ### Added diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index d8e7a2e0b..99104a78d 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -11,6 +11,7 @@ import { IDataProviderHistoricalResponse, IDataProviderResponse } from '@ghostfolio/api/services/interfaces/interfaces'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { DEFAULT_CURRENCY, REPLACE_NAME_PARTS @@ -35,7 +36,8 @@ export class EodHistoricalDataService implements DataProviderInterface { private readonly URL = 'https://eodhistoricaldata.com/api'; public constructor( - private readonly configurationService: ConfigurationService + private readonly configurationService: ConfigurationService, + private readonly symbolProfileService: SymbolProfileService ) { this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA'); } @@ -230,41 +232,53 @@ export class EodHistoricalDataService implements DataProviderInterface { ? [realTimeResponse] : realTimeResponse; - response = quotes.reduce( - async ( - result: { [symbol: string]: IDataProviderResponse }, - { close, code, timestamp } - ) => { - let currency: string; + const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( + symbols.map((symbol) => { + return { + symbol, + dataSource: this.getName() + }; + }) + ); - if (symbols.length === 1) { - const { items } = await this.search({ query: symbols[0] }); + for (const { close, code, timestamp } of quotes) { + let currency: string; - if (items.length === 1) { - currency = items[0].currency; - } - } + if (code.endsWith('.FOREX')) { + currency = this.convertFromEodSymbol(code)?.replace( + DEFAULT_CURRENCY, + '' + ); + } - if (isNumber(close)) { - result[this.convertFromEodSymbol(code)] = { - currency, - dataSource: this.getName(), - marketPrice: close, - marketState: isToday(new Date(timestamp * 1000)) - ? 'open' - : 'closed' - }; - } else { - Logger.error( - `Could not get quote for ${this.convertFromEodSymbol(code)} (${this.getName()})`, - 'EodHistoricalDataService' - ); + if (!currency) { + currency = symbolProfiles.find(({ symbol }) => { + return symbol === code; + })?.currency; + } + + if (!currency) { + const { items } = await this.search({ query: code }); + + if (items.length === 1) { + currency = items[0].currency; } + } - return result; - }, - {} - ); + if (isNumber(close)) { + response[this.convertFromEodSymbol(code)] = { + currency, + dataSource: this.getName(), + marketPrice: close, + marketState: isToday(new Date(timestamp * 1000)) ? 'open' : 'closed' + }; + } else { + Logger.error( + `Could not get quote for ${this.convertFromEodSymbol(code)} (${this.getName()})`, + 'EodHistoricalDataService' + ); + } + } return response; } catch (error) { diff --git a/package.json b/package.json index 579c4151e..c32114cf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.63.1", + "version": "2.63.2", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio", From 40d93066ff3f3f9c883670b60bd98408f59d2de9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 13 Mar 2024 20:21:54 +0100 Subject: [PATCH 9/9] Introduce .env.dev (#3120) --- .env.dev | 25 +++++++++++++++++++++++++ .env.example | 3 ++- README.md | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .env.dev diff --git a/.env.dev b/.env.dev new file mode 100644 index 000000000..c4c8a0d35 --- /dev/null +++ b/.env.dev @@ -0,0 +1,25 @@ +COMPOSE_PROJECT_NAME=ghostfolio-development + +# CACHE +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_PASSWORD= + +# POSTGRES +POSTGRES_DB=ghostfolio-db +POSTGRES_USER=user +POSTGRES_PASSWORD= + +# VARIOUS +ACCESS_TOKEN_SALT= +DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?connect_timeout=300&sslmode=prefer +JWT_SECRET_KEY= + +# DEVELOPMENT + +# Nx 18 enables using plugins to infer targets by default +# This is disabled for existing workspaces to maintain compatibility +# For more info, see: https://nx.dev/concepts/inferred-tasks +NX_ADD_PLUGINS=false + +NX_NATIVE_COMMAND_RUNNER=false diff --git a/.env.example b/.env.example index 8df547e37..766894992 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -COMPOSE_PROJECT_NAME=ghostfolio-development +COMPOSE_PROJECT_NAME=ghostfolio # CACHE REDIS_HOST=localhost @@ -10,6 +10,7 @@ POSTGRES_DB=ghostfolio-db POSTGRES_USER=user POSTGRES_PASSWORD= +# VARIOUS ACCESS_TOKEN_SALT= DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?connect_timeout=300&sslmode=prefer JWT_SECRET_KEY= diff --git a/README.md b/README.md index eb302936e..9602d88c9 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Ghostfolio is available for various home server systems, including [CasaOS](http - [Node.js](https://nodejs.org/en/download) (version 18+) - [Yarn](https://yarnpkg.com/en/docs/install) - Create a local copy of this Git repository (clone) -- Copy the file `.env.example` to `.env` and populate it with your data (`cp .env.example .env`) +- Copy the file `.env.dev` to `.env` and populate it with your data (`cp .env.dev .env`) ### Setup