Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"&symbol=" + symbol +
"&apikey=" + this.apiKey +
"&datatype=csv" +
"&outputsize=" + this.outputDataSize
;
if (this.verbose) {
console.log('<< ' + url);
}
var response = await request(url);
if (response.indexOf("Error Message") >= 0) {
throw new Error(JSON.parse(response)["Error Message"]);
}
return dataForge
.fromCSV(response, { skipEmptyLines: true })
.parseDates("timestamp", "YYYY-MM-DD")
.parseFloats(["open", "high", "low", "close", "adjusted_close", "volume", "dividend_amount" , "split_coefficient"])
.renameSeries({
timestamp: "Timestamp",
open: "Open",
high: "High",
low: "Low",
close: "Close",
adjusted_close: "AdjClose",
volume: "Volume",
dividend_amount: "DividendAmount",
split_coefficient: "SplitCoefficient",
})
.bake();
}
"&apikey=" + this.apiKey +
"&datatype=csv" +
"&outputsize=" + this.outputDataSize +
"&interval=" + interval
;
if (this.verbose) {
console.log('<< ' + url);
}
var response = await request(url);
if (response.indexOf("Error Message") >= 0) {
throw new Error(JSON.parse(response)["Error Message"]);
}
return dataForge
.fromCSV(response, { skipEmptyLines: true })
.parseDates("timestamp", "YYYY-MM-DD HH:mm:ss")
.parseFloats(["open", "high", "low", "close", "volume"])
.renameSeries({
timestamp: "Timestamp",
open: "Open",
high: "High",
low: "Low",
close: "Close",
volume: "Volume",
})
.bake();
}
"?function=TIME_SERIES_INTRADAY" +
"&symbol=" + symbol +
"&apikey=" + this.apiKey +
"&datatype=csv" +
"&outputsize=" + this.outputDataSize +
"&interval=" + interval;
if (this.verbose) {
console.log('<< ' + url);
}
return [4 /*yield*/, request(url)];
case 1:
response = _a.sent();
if (response.indexOf("Error Message") >= 0) {
throw new Error(JSON.parse(response)["Error Message"]);
}
return [2 /*return*/, dataForge
.fromCSV(response, { skipEmptyLines: true })
.parseDates("timestamp", "YYYY-MM-DD HH:mm:ss")
.parseFloats(["open", "high", "low", "close", "volume"])
.renameSeries({
timestamp: "Timestamp",
open: "Open",
high: "High",
low: "Low",
close: "Close",
volume: "Volume",
})
.bake()];
}
});
});