Bugfix/improve error handling in position api endpoint (#607)

* Add guards

* Update changelog
pull/609/head
Thomas Kaul 2 years ago committed by GitHub
parent 635f10e2d0
commit 029b7bed9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Hid the data provider warning while loading
- Fixed an exception with the market state caused by a failed data provider request
- Fixed an exception in the portfolio position endpoint
- Fixed the reload of the position detail dialog (with query parameters)
## 1.98.0 - 29.12.2021

@ -447,17 +447,17 @@ export class PortfolioService {
// Convert investment, gross and net performance to currency of user
const userCurrency = this.request.user.Settings.currency;
const investment = this.exchangeRateDataService.toCurrency(
position.investment.toNumber(),
position.investment?.toNumber(),
currency,
userCurrency
);
const grossPerformance = this.exchangeRateDataService.toCurrency(
position.grossPerformance.toNumber(),
position.grossPerformance?.toNumber(),
currency,
userCurrency
);
const netPerformance = this.exchangeRateDataService.toCurrency(
position.netPerformance.toNumber(),
position.netPerformance?.toNumber(),
currency,
userCurrency
);

Loading…
Cancel
Save