diff --git a/apps/api/src/app/core/portfolio-calculator.ts b/apps/api/src/app/core/portfolio-calculator.ts index a730885a1..586101f59 100644 --- a/apps/api/src/app/core/portfolio-calculator.ts +++ b/apps/api/src/app/core/portfolio-calculator.ts @@ -167,11 +167,15 @@ export class PortfolioCalculator { timelinePeriodPromises.push(this.getTimePeriodForDate(j, currentDate)); } - const timelinePeriod: TimelinePeriod[] = await Promise.all( + console.time('calculate-timeline-periods'); + + const timelinePeriods: TimelinePeriod[] = await Promise.all( timelinePeriodPromises ); - return timelinePeriod; + console.timeEnd('calculate-timeline-periods'); + + return timelinePeriods; } private async getTimePeriodForDate(j: number, currentDate: Date) { diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 454f0c438..27976e709 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -90,6 +90,8 @@ export class PortfolioController { @Query('range') range, @Res() res: Response ): Promise { + console.time('get-chart-request'); + let chartData = await this.portfolioService.getChart( impersonationId, range @@ -130,6 +132,8 @@ export class PortfolioController { }); } + console.timeEnd('get-chart-request'); + return res.json(chartData); }