|
@ -24,7 +24,12 @@ import { |
|
|
MAX_CHART_ITEMS, |
|
|
MAX_CHART_ITEMS, |
|
|
UNKNOWN_KEY |
|
|
UNKNOWN_KEY |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
import { DATE_FORMAT, getSum, parseDate } from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
|
|
|
DATE_FORMAT, |
|
|
|
|
|
getAllActivityTypes, |
|
|
|
|
|
getSum, |
|
|
|
|
|
parseDate |
|
|
|
|
|
} from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
import { |
|
|
Accounts, |
|
|
Accounts, |
|
|
EnhancedSymbolProfile, |
|
|
EnhancedSymbolProfile, |
|
@ -141,7 +146,8 @@ export class PortfolioService { |
|
|
filters, |
|
|
filters, |
|
|
withExcludedAccounts, |
|
|
withExcludedAccounts, |
|
|
impersonationId: userId, |
|
|
impersonationId: userId, |
|
|
userId: this.request.user.id |
|
|
userId: this.request.user.id, |
|
|
|
|
|
withLiabilities: true |
|
|
}) |
|
|
}) |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
@ -333,6 +339,7 @@ export class PortfolioService { |
|
|
impersonationId, |
|
|
impersonationId, |
|
|
userId, |
|
|
userId, |
|
|
withExcludedAccounts = false, |
|
|
withExcludedAccounts = false, |
|
|
|
|
|
withLiabilities = false, |
|
|
withSummary = false |
|
|
withSummary = false |
|
|
}: { |
|
|
}: { |
|
|
dateRange?: DateRange; |
|
|
dateRange?: DateRange; |
|
@ -340,6 +347,7 @@ export class PortfolioService { |
|
|
impersonationId: string; |
|
|
impersonationId: string; |
|
|
userId: string; |
|
|
userId: string; |
|
|
withExcludedAccounts?: boolean; |
|
|
withExcludedAccounts?: boolean; |
|
|
|
|
|
withLiabilities?: boolean; |
|
|
withSummary?: boolean; |
|
|
withSummary?: boolean; |
|
|
}): Promise<PortfolioDetails & { hasErrors: boolean }> { |
|
|
}): Promise<PortfolioDetails & { hasErrors: boolean }> { |
|
|
userId = await this.getUserId(impersonationId, userId); |
|
|
userId = await this.getUserId(impersonationId, userId); |
|
@ -354,7 +362,12 @@ export class PortfolioService { |
|
|
await this.getTransactionPoints({ |
|
|
await this.getTransactionPoints({ |
|
|
filters, |
|
|
filters, |
|
|
userId, |
|
|
userId, |
|
|
withExcludedAccounts |
|
|
withExcludedAccounts, |
|
|
|
|
|
types: withLiabilities |
|
|
|
|
|
? undefined |
|
|
|
|
|
: getAllActivityTypes().filter((activityType) => { |
|
|
|
|
|
return activityType !== 'LIABILITY'; |
|
|
|
|
|
}) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const portfolioCalculator = new PortfolioCalculator({ |
|
|
const portfolioCalculator = new PortfolioCalculator({ |
|
@ -1949,7 +1962,7 @@ export class PortfolioService { |
|
|
private async getTransactionPoints({ |
|
|
private async getTransactionPoints({ |
|
|
filters, |
|
|
filters, |
|
|
includeDrafts = false, |
|
|
includeDrafts = false, |
|
|
types = ['BUY', 'DIVIDEND', 'ITEM', 'LIABILITY', 'SELL'], |
|
|
types = getAllActivityTypes(), |
|
|
userId, |
|
|
userId, |
|
|
withExcludedAccounts = false |
|
|
withExcludedAccounts = false |
|
|
}: { |
|
|
}: { |
|
|