|
|
@ -991,11 +991,13 @@ export class PortfolioService { |
|
|
public async getPerformance({ |
|
|
public async getPerformance({ |
|
|
dateRange = 'max', |
|
|
dateRange = 'max', |
|
|
filters, |
|
|
filters, |
|
|
|
|
|
groupBy, |
|
|
impersonationId, |
|
|
impersonationId, |
|
|
userId |
|
|
userId |
|
|
}: { |
|
|
}: { |
|
|
dateRange?: DateRange; |
|
|
dateRange?: DateRange; |
|
|
filters?: Filter[]; |
|
|
filters?: Filter[]; |
|
|
|
|
|
groupBy?: Extract<GroupBy, 'year'>; |
|
|
impersonationId: string; |
|
|
impersonationId: string; |
|
|
userId: string; |
|
|
userId: string; |
|
|
withExcludedAccounts?: boolean; |
|
|
withExcludedAccounts?: boolean; |
|
|
@ -1049,11 +1051,24 @@ export class PortfolioService { |
|
|
|
|
|
|
|
|
const { endDate, startDate } = getIntervalFromDateRange(dateRange); |
|
|
const { endDate, startDate } = getIntervalFromDateRange(dateRange); |
|
|
|
|
|
|
|
|
const { chart } = await portfolioCalculator.getPerformance({ |
|
|
const { chart: intervalChart } = await portfolioCalculator.getPerformance({ |
|
|
end: endDate, |
|
|
end: endDate, |
|
|
start: startDate |
|
|
start: startDate |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
let chart = intervalChart; |
|
|
|
|
|
|
|
|
|
|
|
if (groupBy) { |
|
|
|
|
|
const { chart: groupedChart } = |
|
|
|
|
|
await portfolioCalculator.getPerformanceByGroup({ |
|
|
|
|
|
startDate, |
|
|
|
|
|
endDate, |
|
|
|
|
|
groupBy |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
chart = groupedChart; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const { |
|
|
const { |
|
|
netPerformance, |
|
|
netPerformance, |
|
|
netPerformanceInPercentage, |
|
|
netPerformanceInPercentage, |
|
|
@ -1063,7 +1078,7 @@ export class PortfolioService { |
|
|
totalInvestment, |
|
|
totalInvestment, |
|
|
totalInvestmentValueWithCurrencyEffect, |
|
|
totalInvestmentValueWithCurrencyEffect, |
|
|
valueWithCurrencyEffect |
|
|
valueWithCurrencyEffect |
|
|
} = chart?.at(-1) ?? { |
|
|
} = intervalChart?.at(-1) ?? { |
|
|
netPerformance: 0, |
|
|
netPerformance: 0, |
|
|
netPerformanceInPercentage: 0, |
|
|
netPerformanceInPercentage: 0, |
|
|
netPerformanceInPercentageWithCurrencyEffect: 0, |
|
|
netPerformanceInPercentageWithCurrencyEffect: 0, |
|
|
|