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

Loading…
Cancel
Save