Browse Source
Bugfix/fix error handling for missing market prices (#1023)
* Add fallback for missing market price
* Update changelog
pull/1024/head
Thomas Kaul
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
2 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/portfolio.service.ts
|
|
@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
- Upgraded `Nx` from version `14.1.4` to `14.3.5` |
|
|
|
- Upgraded `storybook` from version `6.4.22` to `6.5.9` |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Improved the error handling of missing market prices |
|
|
|
|
|
|
|
## 1.160.0 - 15.06.2022 |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
@ -394,7 +394,7 @@ export class PortfolioService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
const value = item.quantity.mul(item.marketPrice); |
|
|
|
const value = item.quantity.mul(item.marketPrice ?? 0); |
|
|
|
const symbolProfile = symbolProfileMap[item.symbol]; |
|
|
|
const dataProviderResponse = dataProviderResponses[item.symbol]; |
|
|
|
|
|
|
@ -658,7 +658,7 @@ export class PortfolioService { |
|
|
|
netPerformancePercent: position.netPerformancePercentage?.toNumber(), |
|
|
|
quantity: quantity.toNumber(), |
|
|
|
value: this.exchangeRateDataService.toCurrency( |
|
|
|
quantity.mul(marketPrice).toNumber(), |
|
|
|
quantity.mul(marketPrice ?? 0).toNumber(), |
|
|
|
currency, |
|
|
|
userCurrency |
|
|
|
) |
|
|
|