Browse Source
Bugfix/fix division by zero in benchmarks calculation (#1177)
* Fix division by zero error
* Update changelog
pull/1179/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
11 additions and
3 deletions
-
CHANGELOG.md
-
apps/api/src/app/benchmark/benchmark.service.ts
|
|
@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
- Integrated the commands `database:setup` and `database:migrate` into the container start |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed a division by zero error in the benchmarks calculation |
|
|
|
|
|
|
|
### Todo |
|
|
|
|
|
|
|
- Apply manual data migration (`yarn database:migrate`) is not needed anymore |
|
|
|
|
|
@ -48,9 +48,13 @@ export class BenchmarkService { |
|
|
|
benchmarks = allTimeHighs.map((allTimeHigh, index) => { |
|
|
|
const { marketPrice } = quotes[benchmarkAssets[index].symbol]; |
|
|
|
|
|
|
|
const performancePercentFromAllTimeHigh = new Big(marketPrice) |
|
|
|
let performancePercentFromAllTimeHigh = new Big(0); |
|
|
|
|
|
|
|
if (allTimeHigh) { |
|
|
|
performancePercentFromAllTimeHigh = new Big(marketPrice) |
|
|
|
.div(allTimeHigh) |
|
|
|
.minus(1); |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
marketCondition: this.getMarketCondition( |
|
|
|