|
|
@ -332,13 +332,15 @@ export class PortfolioService { |
|
|
|
filters, |
|
|
|
impersonationId, |
|
|
|
userId, |
|
|
|
withExcludedAccounts = false |
|
|
|
withExcludedAccounts = false, |
|
|
|
withSummary = false |
|
|
|
}: { |
|
|
|
dateRange?: DateRange; |
|
|
|
filters?: Filter[]; |
|
|
|
impersonationId: string; |
|
|
|
userId: string; |
|
|
|
withExcludedAccounts?: boolean; |
|
|
|
withSummary?: boolean; |
|
|
|
}): Promise<PortfolioDetails & { hasErrors: boolean }> { |
|
|
|
userId = await this.getUserId(impersonationId, userId); |
|
|
|
const user = await this.userService.user({ id: userId }); |
|
|
@ -625,7 +627,10 @@ export class PortfolioService { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
const summary = await this.getSummary({ |
|
|
|
let summary: PortfolioSummary; |
|
|
|
|
|
|
|
if (withSummary) { |
|
|
|
summary = await this.getSummary({ |
|
|
|
holdings, |
|
|
|
impersonationId, |
|
|
|
userCurrency, |
|
|
@ -636,6 +641,7 @@ export class PortfolioService { |
|
|
|
holdings |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
accounts, |
|
|
@ -643,11 +649,11 @@ export class PortfolioService { |
|
|
|
platforms, |
|
|
|
summary, |
|
|
|
filteredValueInBaseCurrency: filteredValueInBaseCurrency.toNumber(), |
|
|
|
filteredValueInPercentage: summary.netWorth |
|
|
|
filteredValueInPercentage: summary?.netWorth |
|
|
|
? filteredValueInBaseCurrency.div(summary.netWorth).toNumber() |
|
|
|
: 0, |
|
|
|
: undefined, |
|
|
|
hasErrors: currentPositions.hasErrors, |
|
|
|
totalValueInBaseCurrency: summary.netWorth |
|
|
|
totalValueInBaseCurrency: summary?.netWorth |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|