Browse Source
Bugfix/improve error handling in benchmark calculation (#1246)
* Improve error handling
* Update changelog
pull/1247/head
Thomas Kaul
2 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
1 deletions
-
CHANGELOG.md
-
apps/api/src/app/benchmark/benchmark.service.ts
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
|
- Upgraded `yahoo-finance2` from version `2.3.3` to `2.3.6` |
|
|
- Upgraded `yahoo-finance2` from version `2.3.3` to `2.3.6` |
|
|
|
|
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
|
|
|
|
- Improved the error handling in the benchmark calculation |
|
|
|
|
|
|
|
|
## 1.191.0 - 10.09.2022 |
|
|
## 1.191.0 - 10.09.2022 |
|
|
|
|
|
|
|
|
### Changed |
|
|
### Changed |
|
|
|
@ -31,7 +31,11 @@ export class BenchmarkService { |
|
|
) {} |
|
|
) {} |
|
|
|
|
|
|
|
|
public calculateChangeInPercentage(baseValue: number, currentValue: number) { |
|
|
public calculateChangeInPercentage(baseValue: number, currentValue: number) { |
|
|
return new Big(currentValue).div(baseValue).minus(1).toNumber(); |
|
|
if (baseValue && currentValue) { |
|
|
|
|
|
return new Big(currentValue).div(baseValue).minus(1).toNumber(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getBenchmarks({ useCache = true } = {}): Promise< |
|
|
public async getBenchmarks({ useCache = true } = {}): Promise< |
|
|