Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/convert errors to warnings in portfolio calculator (#562)

Thomas Kaul1602f976f043
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6cb2294966..cec1875f60 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/apps/api/src/app/portfolio/portfolio-calculator.ts b/apps/api/src/app/portfolio/portfolio-calculator.ts
index d16ef4b539..f69349fa64 100644
--- a/apps/api/src/app/portfolio/portfolio-calculator.ts
+++ b/apps/api/src/app/portfolio/portfolio-calculator.ts
@@ -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;