|
@ -64,7 +64,7 @@ export class BenchmarkService { |
|
|
|
|
|
|
|
|
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles(); |
|
|
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles(); |
|
|
|
|
|
|
|
|
const promises: Promise<number>[] = []; |
|
|
const promises: Promise<{ marketPrice: number; date: Date }>[] = []; |
|
|
|
|
|
|
|
|
const quotes = await this.dataProviderService.getQuotes({ |
|
|
const quotes = await this.dataProviderService.getQuotes({ |
|
|
items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => { |
|
|
items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => { |
|
@ -85,15 +85,14 @@ export class BenchmarkService { |
|
|
|
|
|
|
|
|
let performancePercentFromAllTimeHigh = 0; |
|
|
let performancePercentFromAllTimeHigh = 0; |
|
|
|
|
|
|
|
|
if (allTimeHigh && marketPrice) { |
|
|
if (allTimeHigh && allTimeHigh.marketPrice && marketPrice) { |
|
|
performancePercentFromAllTimeHigh = this.calculateChangeInPercentage( |
|
|
performancePercentFromAllTimeHigh = this.calculateChangeInPercentage( |
|
|
allTimeHigh, |
|
|
allTimeHigh.marketPrice, |
|
|
marketPrice |
|
|
marketPrice |
|
|
); |
|
|
); |
|
|
} else { |
|
|
} else { |
|
|
storeInCache = false; |
|
|
storeInCache = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
marketCondition: this.getMarketCondition( |
|
|
marketCondition: this.getMarketCondition( |
|
|
performancePercentFromAllTimeHigh |
|
|
performancePercentFromAllTimeHigh |
|
@ -101,7 +100,8 @@ export class BenchmarkService { |
|
|
name: benchmarkAssetProfiles[index].name, |
|
|
name: benchmarkAssetProfiles[index].name, |
|
|
performances: { |
|
|
performances: { |
|
|
allTimeHigh: { |
|
|
allTimeHigh: { |
|
|
performancePercent: performancePercentFromAllTimeHigh |
|
|
performancePercent: performancePercentFromAllTimeHigh, |
|
|
|
|
|
date: allTimeHigh.date |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|