diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a3b67e5e..8f98a8401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,24 +9,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added a hint about delayed market data to the markets overview - Added the asset profile count per data provider to the endpoint `GET api/v1/admin` ### Changed - Harmonized the data providers management style of the admin control panel +- Extended the data providers management of the admin control panel by the asset profile count +- Restricted the permissions of the demo user - Renamed `Order` to `activities` in the `User` database schema +- Removed the deprecated endpoint `GET api/v1/admin/market-data/:dataSource/:symbol` +- Removed the deprecated endpoint `POST api/v1/admin/market-data/:dataSource/:symbol` +- Removed the deprecated endpoint `PUT api/v1/admin/market-data/:dataSource/:symbol/:dateString` - Improved the language localization for Catalan (`ca`) - Improved the language localization for Chinese (`zh`) - Improved the language localization for Dutch (`nl`) - Improved the language localization for Español (`es`) +- Improved the language localization for French (`fr`) - Improved the language localization for German (`de`) - Improved the language localization for Italian (`it`) - Upgraded `countup.js` from version `2.8.0` to `2.8.2` - Upgraded `nestjs` from version `10.4.15` to `11.0.12` -- Upgraded `yahoo-finance2` from version `2.11.3` to `3.3.1` +- Upgraded `twitter-api-v2` from version `1.14.2` to `1.23.0` +- Upgraded `yahoo-finance2` from version `2.11.3` to `3.3.2` ### Fixed +- Displayed the button to fetch the current market price only if the activity is not in a custom currency - Fixed an issue in the watchlist endpoint (`POST`) related to the `HasPermissionGuard` ## 2.161.0 - 2025-05-06 diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts index d8507bbb0..736f6da33 100644 --- a/apps/api/src/app/admin/admin.controller.ts +++ b/apps/api/src/app/admin/admin.controller.ts @@ -3,7 +3,6 @@ import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard' import { TransformDataSourceInRequestInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.interceptor'; import { ApiService } from '@ghostfolio/api/services/api/api.service'; import { ManualService } from '@ghostfolio/api/services/data-provider/manual/manual.service'; -import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { PropertyDto } from '@ghostfolio/api/services/property/property.dto'; import { DataGatheringService } from '@ghostfolio/api/services/queues/data-gathering/data-gathering.service'; import { @@ -16,7 +15,6 @@ import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; import { AdminData, AdminMarketData, - AdminMarketDataDetails, AdminUsers, EnhancedSymbolProfile } from '@ghostfolio/common/interfaces'; @@ -50,8 +48,6 @@ import { StatusCodes, getReasonPhrase } from 'http-status-codes'; import { AdminService } from './admin.service'; import { UpdateAssetProfileDto } from './update-asset-profile.dto'; -import { UpdateBulkMarketDataDto } from './update-bulk-market-data.dto'; -import { UpdateMarketDataDto } from './update-market-data.dto'; @Controller('admin') export class AdminController { @@ -60,7 +56,6 @@ export class AdminController { private readonly apiService: ApiService, private readonly dataGatheringService: DataGatheringService, private readonly manualService: ManualService, - private readonly marketDataService: MarketDataService, @Inject(REQUEST) private readonly request: RequestWithUser ) {} @@ -214,19 +209,6 @@ export class AdminController { }); } - /** - * @deprecated - */ - @Get('market-data/:dataSource/:symbol') - @HasPermission(permissions.accessAdminControl) - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async getMarketDataBySymbol( - @Param('dataSource') dataSource: DataSource, - @Param('symbol') symbol: string - ): Promise { - return this.adminService.getMarketDataBySymbol({ dataSource, symbol }); - } - @HasPermission(permissions.accessAdminControl) @Post('market-data/:dataSource/:symbol/test') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) @@ -253,58 +235,6 @@ export class AdminController { } } - /** - * @deprecated - */ - @HasPermission(permissions.accessAdminControl) - @Post('market-data/:dataSource/:symbol') - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async updateMarketData( - @Body() data: UpdateBulkMarketDataDto, - @Param('dataSource') dataSource: DataSource, - @Param('symbol') symbol: string - ) { - const dataBulkUpdate: Prisma.MarketDataUpdateInput[] = data.marketData.map( - ({ date, marketPrice }) => ({ - dataSource, - marketPrice, - symbol, - date: parseISO(date), - state: 'CLOSE' - }) - ); - - return this.marketDataService.updateMany({ - data: dataBulkUpdate - }); - } - - /** - * @deprecated - */ - @HasPermission(permissions.accessAdminControl) - @Put('market-data/:dataSource/:symbol/:dateString') - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async update( - @Param('dataSource') dataSource: DataSource, - @Param('dateString') dateString: string, - @Param('symbol') symbol: string, - @Body() data: UpdateMarketDataDto - ) { - const date = parseISO(dateString); - - return this.marketDataService.updateMarketData({ - data: { marketPrice: data.marketPrice, state: 'CLOSE' }, - where: { - dataSource_date_symbol: { - dataSource, - date, - symbol - } - } - }); - } - @HasPermission(permissions.accessAdminControl) @Post('profile-data/:dataSource/:symbol') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index c580ce149..7e373c4cc 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -1249,7 +1249,7 @@ export class PortfolioService { const rules: PortfolioReportResponse['rules'] = { accountClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new AccountClusterRiskCurrentInvestment( @@ -1265,7 +1265,7 @@ export class PortfolioService { ) : undefined, assetClassClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new AssetClassClusterRiskEquity( @@ -1281,7 +1281,7 @@ export class PortfolioService { ) : undefined, currencyClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new CurrencyClusterRiskBaseCurrencyCurrentInvestment( @@ -1297,7 +1297,7 @@ export class PortfolioService { ) : undefined, economicMarketClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new EconomicMarketClusterRiskDevelopedMarkets( @@ -1338,7 +1338,7 @@ export class PortfolioService { userSettings ), regionalMarketClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new RegionalMarketClusterRiskAsiaPacific( @@ -1981,6 +1981,9 @@ export class PortfolioService { netPerformanceWithCurrencyEffect, totalBuy, totalSell, + activityCount: activities.filter(({ type }) => { + return ['BUY', 'SELL'].includes(type); + }).length, committedFunds: committedFunds.toNumber(), currentValueInBaseCurrency: currentValueInBaseCurrency.toNumber(), dividendInBaseCurrency: dividendInBaseCurrency.toNumber(), @@ -2008,9 +2011,6 @@ export class PortfolioService { interest: interest.toNumber(), items: valuables.toNumber(), liabilities: liabilities.toNumber(), - ordersCount: activities.filter(({ type }) => { - return ['BUY', 'SELL'].includes(type); - }).length, totalInvestment: totalInvestment.toNumber(), totalValueInBaseCurrency: netWorth }; diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index cf55b8862..87c82fa0b 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -394,9 +394,11 @@ export class UserService { // Reset holdings view mode user.Settings.settings.holdingsViewMode = undefined; } else if (user.subscription?.type === 'Premium') { - currentPermissions.push(permissions.createApiKey); - currentPermissions.push(permissions.enableDataProviderGhostfolio); - currentPermissions.push(permissions.reportDataGlitch); + if (!hasRole(user, Role.DEMO)) { + currentPermissions.push(permissions.createApiKey); + currentPermissions.push(permissions.enableDataProviderGhostfolio); + currentPermissions.push(permissions.reportDataGlitch); + } currentPermissions = without( currentPermissions, diff --git a/apps/api/src/helper/object.helper.spec.ts b/apps/api/src/helper/object.helper.spec.ts index b0370fa3f..d7caf9bc9 100644 --- a/apps/api/src/helper/object.helper.spec.ts +++ b/apps/api/src/helper/object.helper.spec.ts @@ -1515,6 +1515,7 @@ describe('redactAttributes', () => { } }, summary: { + activityCount: 29, annualizedPerformancePercent: 0.16690880197786, annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876, cash: null, @@ -1538,7 +1539,6 @@ describe('redactAttributes', () => { interest: null, items: null, liabilities: null, - ordersCount: 29, totalInvestment: null, totalValueInBaseCurrency: null, currentNetWorth: null @@ -3018,6 +3018,7 @@ describe('redactAttributes', () => { } }, summary: { + activityCount: 29, annualizedPerformancePercent: 0.16690880197786, annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876, cash: null, @@ -3041,7 +3042,6 @@ describe('redactAttributes', () => { interest: null, items: null, liabilities: null, - ordersCount: 29, totalInvestment: null, totalValueInBaseCurrency: null, currentNetWorth: null diff --git a/apps/client/src/app/components/admin-platform/admin-platform.component.html b/apps/client/src/app/components/admin-platform/admin-platform.component.html index c71594e45..47fee3c8a 100644 --- a/apps/client/src/app/components/admin-platform/admin-platform.component.html +++ b/apps/client/src/app/components/admin-platform/admin-platform.component.html @@ -1,115 +1,94 @@ -
-
-
- - - - - + +
- Name - - @if (element.url) { - - } - {{ element.name }} -
+ + + - - - - + + + + - - - - + + + + - - - - + + + + - - -
+ Name + + @if (element.url) { + + } + {{ element.name }} + - Url - - {{ element.url }} - + Url + + {{ element.url }} + - Accounts - - {{ element.accountCount }} - + Accounts + + {{ element.accountCount }} + - - - -
- -
-
+ + + +
+ +
+
-
-
-
+ + + diff --git a/apps/client/src/app/components/admin-settings/admin-settings.component.html b/apps/client/src/app/components/admin-settings/admin-settings.component.html index 997d34aa5..2dcdefdd0 100644 --- a/apps/client/src/app/components/admin-settings/admin-settings.component.html +++ b/apps/client/src/app/components/admin-settings/admin-settings.component.html @@ -38,14 +38,6 @@ }} -
- - {{ ghostfolioApiStatus.dailyRequests }} - of - {{ ghostfolioApiStatus.dailyRequestsMax }} - daily requests - -
} } @else { {{ element.name }} @@ -55,6 +47,40 @@ + + + Asset Profiles + + + {{ element.assetProfileCount }} + + + + + + + @if (isGhostfolioDataProvider(element)) { + @if (isGhostfolioApiKeyValid === true) { + + + {{ ghostfolioApiStatus.dailyRequests }} + of + {{ ghostfolioApiStatus.dailyRequestsMax }} + daily requests + + } + } + + + diff --git a/apps/client/src/app/components/admin-settings/admin-settings.component.scss b/apps/client/src/app/components/admin-settings/admin-settings.component.scss index 5d4e87f30..c08ba95bc 100644 --- a/apps/client/src/app/components/admin-settings/admin-settings.component.scss +++ b/apps/client/src/app/components/admin-settings/admin-settings.component.scss @@ -1,3 +1,15 @@ :host { display: block; + + .mat-mdc-progress-bar { + --mdc-linear-progress-active-indicator-height: 0.5rem; + --mdc-linear-progress-track-height: 0.5rem; + border-radius: 0.25rem; + + ::ng-deep { + .mdc-linear-progress__buffer-bar { + background-color: rgb(var(--palette-background-unselected-chip)); + } + } + } } diff --git a/apps/client/src/app/components/admin-settings/admin-settings.component.ts b/apps/client/src/app/components/admin-settings/admin-settings.component.ts index f18e49d10..5c071c60c 100644 --- a/apps/client/src/app/components/admin-settings/admin-settings.component.ts +++ b/apps/client/src/app/components/admin-settings/admin-settings.component.ts @@ -39,7 +39,7 @@ import { GhostfolioPremiumApiDialogParams } from './ghostfolio-premium-api-dialo export class AdminSettingsComponent implements OnDestroy, OnInit { public dataSource = new MatTableDataSource(); public defaultDateFormat: string; - public displayedColumns = ['name', 'actions']; + public displayedColumns = ['name', 'assetProfileCount', 'status', 'actions']; public ghostfolioApiStatus: DataProviderGhostfolioStatusResponse; public isGhostfolioApiKeyValid: boolean; public isLoading = false; diff --git a/apps/client/src/app/components/admin-settings/admin-settings.module.ts b/apps/client/src/app/components/admin-settings/admin-settings.module.ts index c5148f681..706f20a87 100644 --- a/apps/client/src/app/components/admin-settings/admin-settings.module.ts +++ b/apps/client/src/app/components/admin-settings/admin-settings.module.ts @@ -7,6 +7,7 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatMenuModule } from '@angular/material/menu'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatTableModule } from '@angular/material/table'; import { RouterModule } from '@angular/router'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; @@ -23,6 +24,7 @@ import { AdminSettingsComponent } from './admin-settings.component'; GfPremiumIndicatorComponent, MatButtonModule, MatMenuModule, + MatProgressBarModule, MatTableModule, NgxSkeletonLoaderModule, RouterModule diff --git a/apps/client/src/app/components/admin-tag/admin-tag.component.html b/apps/client/src/app/components/admin-tag/admin-tag.component.html index f69579ab8..5979d2778 100644 --- a/apps/client/src/app/components/admin-tag/admin-tag.component.html +++ b/apps/client/src/app/components/admin-tag/admin-tag.component.html @@ -1,108 +1,87 @@ -
-
-
- - - - - - + +
- Name - - {{ element.name }} -
+ + + + - - - - + + + + - - - - + + + + - - - - + + + + - - -
+ Name + + {{ element.name }} + - User - - {{ element.userId }} - + User + + {{ element.userId }} + - Activities - - {{ element.activityCount }} - + Activities + + {{ element.activityCount }} + - - - -
- -
-
+ + + +
+ +
+
-
-
-
+ + + diff --git a/apps/client/src/app/components/home-market/home-market.html b/apps/client/src/app/components/home-market/home-market.html index 2fcdb5716..189c87c8f 100644 --- a/apps/client/src/app/components/home-market/home-market.html +++ b/apps/client/src/app/components/home-market/home-market.html @@ -36,6 +36,14 @@ [locale]="user?.settings?.locale || undefined" [user]="user" /> + @if (benchmarks?.length > 0) { +
+ + Calculations are based on delayed market data and may not be + displayed in real-time. +
+ } 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 1a52bd646..265904b88 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 @@ -7,11 +7,11 @@
- {{ summary?.ordersCount }} - {summary?.ordersCount, plural, + {{ summary?.activityCount }} + {summary?.activityCount, plural, =1 {activity} other {activities} } diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts index dce045a4a..5f651195a 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts @@ -39,6 +39,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { return { id: assetSubClass, label: translate(assetSubClass) }; }); public currencies: string[] = []; + public currencyOfAssetProfile: string; public currentMarketPrice = null; public defaultDateFormat: string; public isLoading = false; @@ -63,8 +64,10 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { ) {} public ngOnInit() { - this.mode = this.data.activity.id ? 'update' : 'create'; + this.currencyOfAssetProfile = this.data.activity?.SymbolProfile?.currency; this.locale = this.data.user?.settings?.locale; + this.mode = this.data.activity?.id ? 'update' : 'create'; + this.dateAdapter.setLocale(this.locale); const { currencies, platforms } = this.dataService.fetchInfo(); @@ -210,7 +213,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.activityForm.get('type').value ) ) { - this.updateSymbol(); + this.updateAssetProfile(); } this.changeDetectorRef.markForCheck(); @@ -397,7 +400,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.dialogRef.close(activity); } else { - (activity as UpdateOrderDto).id = this.data.activity.id; + (activity as UpdateOrderDto).id = this.data.activity?.id; await validateObjectForForm({ classDto: UpdateOrderDto, @@ -422,7 +425,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.unsubscribeSubject.complete(); } - private updateSymbol() { + private updateAssetProfile() { this.isLoading = true; this.changeDetectorRef.markForCheck(); @@ -450,6 +453,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.activityForm.get('dataSource').setValue(dataSource); } + this.currencyOfAssetProfile = currency; this.currentMarketPrice = marketPrice; this.isLoading = false; diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html index b0521530f..08e1b5162 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html @@ -230,8 +230,10 @@
@if ( + currencyOfAssetProfile === + activityForm.get('currencyOfUnitPrice').value && currentMarketPrice && - (data.activity.type === 'BUY' || data.activity.type === 'SELL') && + ['BUY', 'SELL'].includes(data.activity.type) && isToday(activityForm.get('date')?.value) ) {