Browse Source

fix rate conversion for todays symbols

pull/239/head
Valentin Zickner 4 years ago
committed by Thomas
parent
commit
409afac2a9
  1. 16
      apps/api/src/app/core/current-rate.service.ts

16
apps/api/src/app/core/current-rate.service.ts

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

Loading…
Cancel
Save