Pass portfolio calculator to getChart() (#3153)

pull/3157/head
Thomas Kaul 10 months ago committed by GitHub
parent 841bd5c33f
commit bffe6060bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -294,10 +294,9 @@ export class PortfolioService {
const { items } = await this.getChart({ const { items } = await this.getChart({
dateRange, dateRange,
impersonationId, impersonationId,
portfolioOrders, portfolioCalculator,
transactionPoints, transactionPoints,
userId, userId,
userCurrency: this.request.user.Settings.settings.baseCurrency,
withDataDecimation: false withDataDecimation: false
}); });
@ -1218,9 +1217,8 @@ export class PortfolioService {
const { items } = await this.getChart({ const { items } = await this.getChart({
dateRange, dateRange,
impersonationId, impersonationId,
portfolioOrders, portfolioCalculator,
transactionPoints, transactionPoints,
userCurrency,
userId userId
}); });
@ -1445,17 +1443,15 @@ export class PortfolioService {
private async getChart({ private async getChart({
dateRange = 'max', dateRange = 'max',
impersonationId, impersonationId,
portfolioOrders, portfolioCalculator,
transactionPoints, transactionPoints,
userCurrency,
userId, userId,
withDataDecimation = true withDataDecimation = true
}: { }: {
dateRange?: DateRange; dateRange?: DateRange;
impersonationId: string; impersonationId: string;
portfolioOrders: PortfolioOrder[]; portfolioCalculator: PortfolioCalculator;
transactionPoints: TransactionPoint[]; transactionPoints: TransactionPoint[];
userCurrency: string;
userId: string; userId: string;
withDataDecimation?: boolean; withDataDecimation?: boolean;
}): Promise<HistoricalDataContainer> { }): Promise<HistoricalDataContainer> {
@ -1469,15 +1465,6 @@ export class PortfolioService {
userId = await this.getUserId(impersonationId, userId); userId = await this.getUserId(impersonationId, userId);
const portfolioCalculator = new PortfolioCalculator({
currency: userCurrency,
currentRateService: this.currentRateService,
exchangeRateDataService: this.exchangeRateDataService,
orders: portfolioOrders
});
portfolioCalculator.setTransactionPoints(transactionPoints);
const endDate = new Date(); const endDate = new Date();
const portfolioStart = parseDate(transactionPoints[0].date); const portfolioStart = parseDate(transactionPoints[0].date);

Loading…
Cancel
Save