## Functions
Registers a callback to be executed upon application exit (including uncaught exceptions, SIGINT, SIGUSR1, SIGUSR2)
stringGenerates a locale-formatted string describing a date range
numberRounds the timestamp to the nearest 1m/5m/1h/etc (0 sec & 0 ms)
numberReturns the width of a candle time frame in ms
Array.<Object>Returns a set of aligned chunks covering the specified range; the chunks will almost always start before & end beyond the range.
Array.<Array>Fills in gaps in candle data as returned by bfx; candles with no trades are not returned by the API.
Generated dummy candles have OHLC set to previous col, vol 0
NOTE: Result size may exceed the fetch limit
function | | |
| priority | number | 0 | callbacks are executed in descending priority order |
## genRangeString(from, to) ⇒ string
Generates a locale-formatted string describing a date range
**Kind**: global function
**Returns**: string - range
| Param | Type |
| --- | --- |
| from | number \| string \| Date |
| to | number \| string \| Date |
## alignRangeMTS(tf, mts) ⇒ number
Rounds the timestamp to the nearest 1m/5m/1h/etc (0 sec & 0 ms)
**Kind**: global function
**Returns**: number - aligned - rounded to nearest candle width
| Param | Type | Description |
| --- | --- | --- |
| tf | string | candle time frame to use for alignment |
| mts | number | |
## candleWidth(tf) ⇒ number
Returns the width of a candle time frame in ms
**Kind**: global function
**Returns**: number - width - null if time frame is invalid
| Param | Type | Description |
| --- | --- | --- |
| tf | string | candle time frame, i.e. '1m' |
## chunksForRange(tf, start, end, candlesPerChunk) ⇒ Array.<Object>
Returns a set of aligned chunks covering the specified range; the chunks will
almost always start before & end beyond the range.
**Kind**: global function
**Returns**: Array.<Object> - chunks
| Param | Type |
| --- | --- |
| tf | string |
| start | number |
| end | number |
| candlesPerChunk | number |
## preprocessRemoteCandles(tf, candles, transformed) ⇒ Array.<Array>
Fills in gaps in candle data as returned by bfx; candles with no
trades are not returned by the API.
Generated dummy candles have OHLC set to previous col, vol 0
NOTE: Result size may exceed the fetch limit
**Kind**: global function
**Returns**: Array.<Array> - consistentCandles
| Param | Type | Description |
| --- | --- | --- |
| tf | string | candle timeframe |
| candles | Array.<Array> \| Array.<Candle> | array of ws2/rest2 format candle data |
| transformed | boolean | indicates if the dataset is transformed |