Browse Source
Feature/convert errors to warnings in portfolio calculator (#562)
* Convert errors to warnings
* Update changelog
pull/566/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
9 additions and
5 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/portfolio-calculator.ts
|
|
@ -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 |
|
|
|
|
|
|
|
- Converted errors to warnings in portfolio calculator |
|
|
|
|
|
|
|
## 1.92.0 - 19.12.2021 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
@ -238,9 +238,7 @@ export class PortfolioCalculator { |
|
|
|
if (!marketSymbolMap[nextDate]?.[item.symbol]) { |
|
|
|
invalidSymbols.push(item.symbol); |
|
|
|
hasErrors = true; |
|
|
|
Logger.error( |
|
|
|
`Missing value for symbol ${item.symbol} at ${nextDate}` |
|
|
|
); |
|
|
|
Logger.warn(`Missing value for symbol ${item.symbol} at ${nextDate}`); |
|
|
|
continue; |
|
|
|
} |
|
|
|
let lastInvestment: Big = new Big(0); |
|
|
@ -271,7 +269,7 @@ export class PortfolioCalculator { |
|
|
|
if (!initialValue) { |
|
|
|
invalidSymbols.push(item.symbol); |
|
|
|
hasErrors = true; |
|
|
|
Logger.error( |
|
|
|
Logger.warn( |
|
|
|
`Missing value for symbol ${item.symbol} at ${currentDate}` |
|
|
|
); |
|
|
|
continue; |
|
|
@ -515,7 +513,7 @@ export class PortfolioCalculator { |
|
|
|
currentPosition.netPerformancePercentage.mul(currentInitialValue) |
|
|
|
); |
|
|
|
} else if (!currentPosition.quantity.eq(0)) { |
|
|
|
Logger.error( |
|
|
|
Logger.warn( |
|
|
|
`Missing initial value for symbol ${currentPosition.symbol} at ${currentPosition.firstBuyDate}` |
|
|
|
); |
|
|
|
hasErrors = true; |
|
|
|