Browse Source

fix investment values for portfolio.service.ts

pull/243/head
Valentin Zickner 4 years ago
parent
commit
fead7279a6
  1. 11
      apps/api/src/app/portfolio/portfolio.service.ts

11
apps/api/src/app/portfolio/portfolio.service.ts

@ -641,6 +641,7 @@ export class PortfolioService {
return { transactionPoints: [], orders: [] }; return { transactionPoints: [], orders: [] };
} }
const userCurrency = this.request.user.Settings.currency;
const portfolioOrders: PortfolioOrder[] = orders.map((order) => ({ const portfolioOrders: PortfolioOrder[] = orders.map((order) => ({
currency: order.currency, currency: order.currency,
date: format(order.date, DATE_FORMAT), date: format(order.date, DATE_FORMAT),
@ -648,12 +649,18 @@ export class PortfolioService {
quantity: new Big(order.quantity), quantity: new Big(order.quantity),
symbol: order.symbol, symbol: order.symbol,
type: <OrderType>order.type, type: <OrderType>order.type,
unitPrice: new Big(order.unitPrice) unitPrice: new Big(
this.exchangeRateDataService.toCurrency(
order.unitPrice,
order.currency,
userCurrency
)
)
})); }));
const portfolioCalculator = new PortfolioCalculator( const portfolioCalculator = new PortfolioCalculator(
this.currentRateService, this.currentRateService,
this.request.user.Settings.currency userCurrency
); );
portfolioCalculator.computeTransactionPoints(portfolioOrders); portfolioCalculator.computeTransactionPoints(portfolioOrders);
return { return {

Loading…
Cancel
Save