@aurox/ohlcv-helpers
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -32,2 +32,3 @@ import { OHLCVTimeUnit, OHLCVDataItem } from './types'; | ||
private applyItem; | ||
resetHistory: () => void; | ||
setHistory: (history: OHLCVDataItem[]) => void; | ||
@@ -34,0 +35,0 @@ applyUpdate: (update: OHLCVDataItem) => { |
@@ -15,2 +15,8 @@ "use strict"; | ||
this.data = new avl_1.default(undefined, true); | ||
this.resetHistory = () => { | ||
if (!this.enableHistory) { | ||
throw new Error('History is disabled'); | ||
} | ||
this.historyLoaded = false; | ||
}; | ||
this.setHistory = (history) => { | ||
@@ -21,5 +27,6 @@ if (!this.enableHistory) { | ||
if (this.historyLoaded) { | ||
throw new Error('History cannot be loaded more than once'); | ||
throw new Error('History cannot be loaded more than once, to reset the history first call resetHistory then setHistory'); | ||
} | ||
this.historyLoaded = true; | ||
this.data.clear(); | ||
for (const historyItem of history) { | ||
@@ -26,0 +33,0 @@ this.applyItem(historyItem); |
{ | ||
"name": "@aurox/ohlcv-helpers", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
38225
815