|
@ -293,7 +293,6 @@ export class PortfolioService { |
|
|
aDateRange: DateRange = 'max' |
|
|
aDateRange: DateRange = 'max' |
|
|
): Promise<PortfolioDetails & { hasErrors: boolean }> { |
|
|
): Promise<PortfolioDetails & { hasErrors: boolean }> { |
|
|
const userId = await this.getUserId(aImpersonationId, aUserId); |
|
|
const userId = await this.getUserId(aImpersonationId, aUserId); |
|
|
|
|
|
|
|
|
const user = await this.userService.user({ id: userId }); |
|
|
const user = await this.userService.user({ id: userId }); |
|
|
|
|
|
|
|
|
const emergencyFund = new Big( |
|
|
const emergencyFund = new Big( |
|
@ -874,6 +873,7 @@ export class PortfolioService { |
|
|
public async getSummary(aImpersonationId: string): Promise<PortfolioSummary> { |
|
|
public async getSummary(aImpersonationId: string): Promise<PortfolioSummary> { |
|
|
const userCurrency = this.request.user.Settings.currency; |
|
|
const userCurrency = this.request.user.Settings.currency; |
|
|
const userId = await this.getUserId(aImpersonationId, this.request.user.id); |
|
|
const userId = await this.getUserId(aImpersonationId, this.request.user.id); |
|
|
|
|
|
const user = await this.userService.user({ id: userId }); |
|
|
|
|
|
|
|
|
const performanceInformation = await this.getPerformance(aImpersonationId); |
|
|
const performanceInformation = await this.getPerformance(aImpersonationId); |
|
|
|
|
|
|
|
@ -886,9 +886,9 @@ export class PortfolioService { |
|
|
userId |
|
|
userId |
|
|
}); |
|
|
}); |
|
|
const dividend = this.getDividend(orders).toNumber(); |
|
|
const dividend = this.getDividend(orders).toNumber(); |
|
|
const emergencyFund = |
|
|
const emergencyFund = new Big( |
|
|
(this.request.user?.Settings?.settings as UserSettings)?.emergencyFund ?? |
|
|
(user.Settings?.settings as UserSettings)?.emergencyFund ?? 0 |
|
|
0; |
|
|
); |
|
|
const fees = this.getFees(orders).toNumber(); |
|
|
const fees = this.getFees(orders).toNumber(); |
|
|
const firstOrderDate = orders[0]?.date; |
|
|
const firstOrderDate = orders[0]?.date; |
|
|
const items = this.getItems(orders).toNumber(); |
|
|
const items = this.getItems(orders).toNumber(); |
|
@ -908,7 +908,6 @@ export class PortfolioService { |
|
|
...performanceInformation.performance, |
|
|
...performanceInformation.performance, |
|
|
cash, |
|
|
cash, |
|
|
dividend, |
|
|
dividend, |
|
|
emergencyFund, |
|
|
|
|
|
fees, |
|
|
fees, |
|
|
firstOrderDate, |
|
|
firstOrderDate, |
|
|
items, |
|
|
items, |
|
@ -918,6 +917,7 @@ export class PortfolioService { |
|
|
annualizedPerformancePercent: |
|
|
annualizedPerformancePercent: |
|
|
performanceInformation.performance.annualizedPerformancePercent, |
|
|
performanceInformation.performance.annualizedPerformancePercent, |
|
|
committedFunds: committedFunds.toNumber(), |
|
|
committedFunds: committedFunds.toNumber(), |
|
|
|
|
|
emergencyFund: emergencyFund.toNumber(), |
|
|
ordersCount: orders.filter((order) => { |
|
|
ordersCount: orders.filter((order) => { |
|
|
return order.type === 'BUY' || order.type === 'SELL'; |
|
|
return order.type === 'BUY' || order.type === 'SELL'; |
|
|
}).length |
|
|
}).length |
|
|