diff --git a/CHANGELOG.md b/CHANGELOG.md index 839d69ccc..6cfbf3cc7 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 + +- Deprecated `firstOrderDate` in favor of `dateOfFirstActivity` in the `GET api/v2/portfolio/performance` endpoint + ## 3.34.0 - 2026-07-25 ### Changed diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index ca4ead8b8..6c527ed2b 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -1034,6 +1034,7 @@ export class PortfolioService { if (accountBalanceItems.length === 0 && activities.length === 0) { return { chart: [], + dateOfFirstActivity: undefined, firstOrderDate: undefined, hasErrors: false, performance: { @@ -1091,6 +1092,7 @@ export class PortfolioService { chart, errors, hasErrors, + dateOfFirstActivity: parseDate(historicalData[0]?.date), firstOrderDate: parseDate(historicalData[0]?.date), performance: { netPerformance, diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index 5fa952a4f..990816193 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -110,7 +110,7 @@ export class GfAnalysisPageComponent implements OnInit { private readonly deviceType = computed( () => this.deviceDetectorService.deviceInfo().deviceType ); - private firstOrderDate: Date; + private dateOfFirstActivity: Date; private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly clipboard = inject(Clipboard); @@ -302,8 +302,8 @@ export class GfAnalysisPageComponent implements OnInit { range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE }) .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(({ chart, firstOrderDate, performance }) => { - this.firstOrderDate = firstOrderDate ?? new Date(); + .subscribe(({ chart, dateOfFirstActivity, performance }) => { + this.dateOfFirstActivity = dateOfFirstActivity ?? new Date(); this.investments = []; this.performance = performance; @@ -416,7 +416,7 @@ export class GfAnalysisPageComponent implements OnInit { symbol, filters: this.userService.getFilters(), range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE, - startDate: this.firstOrderDate + startDate: this.dateOfFirstActivity }) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(({ marketData }) => { diff --git a/libs/common/src/lib/interfaces/responses/portfolio-performance-response.interface.ts b/libs/common/src/lib/interfaces/responses/portfolio-performance-response.interface.ts index b0c453514..104302de3 100644 --- a/libs/common/src/lib/interfaces/responses/portfolio-performance-response.interface.ts +++ b/libs/common/src/lib/interfaces/responses/portfolio-performance-response.interface.ts @@ -4,6 +4,12 @@ import { ResponseError } from './errors.interface'; export interface PortfolioPerformanceResponse extends ResponseError { chart?: HistoricalDataItem[]; + dateOfFirstActivity: Date; + + /** + * @deprecated Use `dateOfFirstActivity` instead + */ firstOrderDate: Date; + performance: PortfolioPerformance; } diff --git a/libs/ui/src/lib/services/data.service.ts b/libs/ui/src/lib/services/data.service.ts index 5492794d7..23c654ae6 100644 --- a/libs/ui/src/lib/services/data.service.ts +++ b/libs/ui/src/lib/services/data.service.ts @@ -716,8 +716,10 @@ export class DataService { }) .pipe( map((response) => { - if (response.firstOrderDate) { - response.firstOrderDate = parseISO(response.firstOrderDate); + if (response.dateOfFirstActivity) { + response.dateOfFirstActivity = parseISO( + response.dateOfFirstActivity + ); } return response;