mirror of
https://github.com/Tomato6966/investment-portfolio-simulator.git
synced 2025-04-11 08:00:34 +02:00
add additional currency parsing
This commit is contained in:
parent
8c4dba0734
commit
ee5f002271
1 changed files with 1 additions and 2 deletions
|
@ -100,11 +100,10 @@ export const getHistoricalData = async (symbol: string, startDate: Date, endDate
|
||||||
const quotes = indicators.quote[0];
|
const quotes = indicators.quote[0];
|
||||||
|
|
||||||
const lessThenADay = ["60m", "1h", "90m", "45m", "30m", "15m", "5m", "2m", "1m"].includes(interval);
|
const lessThenADay = ["60m", "1h", "90m", "45m", "30m", "15m", "5m", "2m", "1m"].includes(interval);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
historicalData: new Map(timestamp.map((time: number, index: number) => [formatDateToISO(new Date(time * 1000), lessThenADay), quotes.close[index]])),
|
historicalData: new Map(timestamp.map((time: number, index: number) => [formatDateToISO(new Date(time * 1000), lessThenADay), quotes.close[index]])),
|
||||||
longName: meta.longName,
|
longName: meta.longName,
|
||||||
currency: meta.currency,
|
currency: meta.currency || symbol.toUpperCase().includes("USD") ? "USD" : symbol.toUpperCase().includes("GBP") ? "GBP" : symbol.toUpperCase().includes("EUR") ? "EUR" : null,
|
||||||
lastPrice: meta.chartPreviousClose
|
lastPrice: meta.chartPreviousClose
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue