|
@ -90,29 +90,27 @@ export class CurrentRateService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
promises.push( |
|
|
promises.push( |
|
|
this.marketDataService.getRange({ |
|
|
this.marketDataService |
|
|
dateQuery, |
|
|
.getRange({ |
|
|
symbols |
|
|
dateQuery, |
|
|
}) |
|
|
symbols |
|
|
|
|
|
}) |
|
|
|
|
|
.then((data) => { |
|
|
|
|
|
return data.map((marketDataItem) => { |
|
|
|
|
|
return { |
|
|
|
|
|
date: marketDataItem.date, |
|
|
|
|
|
symbol: marketDataItem.symbol, |
|
|
|
|
|
marketPrice: this.exchangeRateDataService.toCurrency( |
|
|
|
|
|
marketDataItem.marketPrice, |
|
|
|
|
|
currencies[marketDataItem.symbol], |
|
|
|
|
|
userCurrency |
|
|
|
|
|
) |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
}) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const marketData = flatten(await Promise.all(promises)); |
|
|
return flatten(await Promise.all(promises)); |
|
|
|
|
|
|
|
|
if (marketData) { |
|
|
|
|
|
return marketData.map((marketDataItem) => { |
|
|
|
|
|
return { |
|
|
|
|
|
date: marketDataItem.date, |
|
|
|
|
|
symbol: marketDataItem.symbol, |
|
|
|
|
|
marketPrice: this.exchangeRateDataService.toCurrency( |
|
|
|
|
|
marketDataItem.marketPrice, |
|
|
|
|
|
currencies[marketDataItem.symbol], |
|
|
|
|
|
userCurrency |
|
|
|
|
|
) |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
throw new Error(`Values not found for symbols ${symbols.join(', ')}`); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private containsToday(dates: Date[]): boolean { |
|
|
private containsToday(dates: Date[]): boolean { |
|
|