Bugfix/fix division by zero in benchmarks calculation (#1177)
* Fix division by zero error * Update changelog
This commit is contained in:
parent
0e3702c2be
commit
df0e9ad03b
@ -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
|
- Integrated the commands `database:setup` and `database:migrate` into the container start
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed a division by zero error in the benchmarks calculation
|
||||||
|
|
||||||
### Todo
|
### Todo
|
||||||
|
|
||||||
- Apply manual data migration (`yarn database:migrate`) is not needed anymore
|
- Apply manual data migration (`yarn database:migrate`) is not needed anymore
|
||||||
|
@ -48,9 +48,13 @@ export class BenchmarkService {
|
|||||||
benchmarks = allTimeHighs.map((allTimeHigh, index) => {
|
benchmarks = allTimeHighs.map((allTimeHigh, index) => {
|
||||||
const { marketPrice } = quotes[benchmarkAssets[index].symbol];
|
const { marketPrice } = quotes[benchmarkAssets[index].symbol];
|
||||||
|
|
||||||
const performancePercentFromAllTimeHigh = new Big(marketPrice)
|
let performancePercentFromAllTimeHigh = new Big(0);
|
||||||
.div(allTimeHigh)
|
|
||||||
.minus(1);
|
if (allTimeHigh) {
|
||||||
|
performancePercentFromAllTimeHigh = new Big(marketPrice)
|
||||||
|
.div(allTimeHigh)
|
||||||
|
.minus(1);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
marketCondition: this.getMarketCondition(
|
marketCondition: this.getMarketCondition(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user