|
|
@ -70,7 +70,7 @@ export class AlphaVantageService |
|
|
symbol, |
|
|
symbol, |
|
|
to |
|
|
to |
|
|
}: GetHistoricalParams): Promise<{ |
|
|
}: GetHistoricalParams): Promise<{ |
|
|
[symbol: string]: { [date: string]: DataProviderHistoricalResponse }; |
|
|
[date: string]: DataProviderHistoricalResponse; |
|
|
}> { |
|
|
}> { |
|
|
try { |
|
|
try { |
|
|
const historicalData: { |
|
|
const historicalData: { |
|
|
@ -83,11 +83,9 @@ export class AlphaVantageService |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const response: { |
|
|
const response: { |
|
|
[symbol: string]: { [date: string]: DataProviderHistoricalResponse }; |
|
|
[date: string]: DataProviderHistoricalResponse; |
|
|
} = {}; |
|
|
} = {}; |
|
|
|
|
|
|
|
|
response[symbol] = {}; |
|
|
|
|
|
|
|
|
|
|
|
for (const [key, timeSeries] of Object.entries( |
|
|
for (const [key, timeSeries] of Object.entries( |
|
|
historicalData['Time Series (Digital Currency Daily)'] |
|
|
historicalData['Time Series (Digital Currency Daily)'] |
|
|
).sort()) { |
|
|
).sort()) { |
|
|
@ -95,7 +93,7 @@ export class AlphaVantageService |
|
|
isAfter(from, parse(key, DATE_FORMAT, new Date())) && |
|
|
isAfter(from, parse(key, DATE_FORMAT, new Date())) && |
|
|
isBefore(to, parse(key, DATE_FORMAT, new Date())) |
|
|
isBefore(to, parse(key, DATE_FORMAT, new Date())) |
|
|
) { |
|
|
) { |
|
|
response[symbol][key] = { |
|
|
response[key] = { |
|
|
marketPrice: parseFloat(timeSeries['4a. close (USD)']) |
|
|
marketPrice: parseFloat(timeSeries['4a. close (USD)']) |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|