fix investment values for portfolio.service.ts (#243)

* fix investment values for portfolio.service.ts

* Update changelog

Co-authored-by: Valentin Zickner <github@zickner.ch>
Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>
pull/244/head
Valentin Zickner 3 years ago committed by GitHub
parent 56a5664c87
commit 5b4a1785ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed an issue with the currency conversion in the portfolio calculations
## 1.31.0 - 01.08.2021
### Added
@ -13,7 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Refactored the core engine for the calculations
- Refactored the core engine for the portfolio calculations
- Improved the performance of the portfolio calculations
## 1.30.0 - 31.07.2021

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

Loading…
Cancel
Save