Browse Source

Fix currency conversion of market price

pull/258/head
Thomas 4 years ago
parent
commit
2b3951a55f
  1. 11
      apps/api/src/app/portfolio/portfolio.service.ts

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

@ -311,13 +311,13 @@ export class PortfolioService {
averagePrice,
currency,
firstBuyDate,
marketPrice,
quantity,
transactionCount
} = position;
// Convert investment and gross performance to currency of user
const userCurrency = this.request.user.Settings.currency;
// Convert investment and gross performance to currency of user
const investment = this.exchangeRateDataService.toCurrency(
position.investment.toNumber(),
currency,
@ -329,6 +329,13 @@ export class PortfolioService {
userCurrency
);
// Convert market price to currency of position
const marketPrice = this.exchangeRateDataService.toCurrency(
position.marketPrice,
userCurrency,
currency
);
const historicalData = await this.dataProviderService.getHistorical(
[aSymbol],
'day',

Loading…
Cancel
Save