Fix #84, with one caveat

This commit is contained in:
7400
2024-03-02 10:50:50 -08:00
parent 6cecac77db
commit 4a076ddde7
2 changed files with 26 additions and 13 deletions

View File

@@ -185,19 +185,18 @@ export default {
const { from, to, firstDataRequest } = periodParams;
console.log('[getBars]: Method call', symbolInfo, resolution, from, to);
try {
var bars = await jBars(from, to, resolution); // This is the one that does all the work
try {
let bars, metadata;
[bars, metadata] = await jBars(from, to, resolution); // This is the one that does all the work
if (firstDataRequest) {
lastBarsCache.set(symbolInfo.full_name, {
...bars[bars.length - 1],
});
}
console.log(`[getBars]: returned ${bars.length} bar(s)`);
console.log(`[getBars]: returned ${bars.length} bar(s), and metadata ${metadata}`);
console.log(bars);
onHistoryCallback(bars, {
noData: false,
});
onHistoryCallback(bars, metadata);
} catch (error) {
console.log('[getBars]: Get error', error);
onErrorCallback(error);