|
@ -29,6 +29,7 @@ import { |
|
|
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper'; |
|
|
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
import { |
|
|
Accounts, |
|
|
Accounts, |
|
|
|
|
|
Filter, |
|
|
PortfolioDetails, |
|
|
PortfolioDetails, |
|
|
PortfolioPerformanceResponse, |
|
|
PortfolioPerformanceResponse, |
|
|
PortfolioReport, |
|
|
PortfolioReport, |
|
@ -309,7 +310,7 @@ export class PortfolioService { |
|
|
aImpersonationId: string, |
|
|
aImpersonationId: string, |
|
|
aUserId: string, |
|
|
aUserId: string, |
|
|
aDateRange: DateRange = 'max', |
|
|
aDateRange: DateRange = 'max', |
|
|
tags?: string[] |
|
|
aFilters?: Filter[] |
|
|
): 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 }); |
|
@ -324,8 +325,8 @@ export class PortfolioService { |
|
|
|
|
|
|
|
|
const { orders, portfolioOrders, transactionPoints } = |
|
|
const { orders, portfolioOrders, transactionPoints } = |
|
|
await this.getTransactionPoints({ |
|
|
await this.getTransactionPoints({ |
|
|
tags, |
|
|
userId, |
|
|
userId |
|
|
filters: aFilters |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const portfolioCalculator = new PortfolioCalculator({ |
|
|
const portfolioCalculator = new PortfolioCalculator({ |
|
@ -448,7 +449,7 @@ export class PortfolioService { |
|
|
value: totalValue |
|
|
value: totalValue |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if (tags === undefined) { |
|
|
if (aFilters === undefined) { |
|
|
for (const symbol of Object.keys(cashPositions)) { |
|
|
for (const symbol of Object.keys(cashPositions)) { |
|
|
holdings[symbol] = cashPositions[symbol]; |
|
|
holdings[symbol] = cashPositions[symbol]; |
|
|
} |
|
|
} |
|
@ -1195,12 +1196,12 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async getTransactionPoints({ |
|
|
private async getTransactionPoints({ |
|
|
|
|
|
filters, |
|
|
includeDrafts = false, |
|
|
includeDrafts = false, |
|
|
tags, |
|
|
|
|
|
userId |
|
|
userId |
|
|
}: { |
|
|
}: { |
|
|
|
|
|
filters?: Filter[]; |
|
|
includeDrafts?: boolean; |
|
|
includeDrafts?: boolean; |
|
|
tags?: string[]; |
|
|
|
|
|
userId: string; |
|
|
userId: string; |
|
|
}): Promise<{ |
|
|
}): Promise<{ |
|
|
transactionPoints: TransactionPoint[]; |
|
|
transactionPoints: TransactionPoint[]; |
|
@ -1210,8 +1211,8 @@ export class PortfolioService { |
|
|
const userCurrency = this.request.user?.Settings?.currency ?? baseCurrency; |
|
|
const userCurrency = this.request.user?.Settings?.currency ?? baseCurrency; |
|
|
|
|
|
|
|
|
const orders = await this.orderService.getOrders({ |
|
|
const orders = await this.orderService.getOrders({ |
|
|
|
|
|
filters, |
|
|
includeDrafts, |
|
|
includeDrafts, |
|
|
tags, |
|
|
|
|
|
userCurrency, |
|
|
userCurrency, |
|
|
userId, |
|
|
userId, |
|
|
types: ['BUY', 'SELL'] |
|
|
types: ['BUY', 'SELL'] |
|
|