ohlcv-indicators 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4225 +1 @@
1
- var OHLCV_INDICATORS;
2
-
3
- /******/ (() => {
4
- // webpackBootstrap
5
- /******/ "use strict";
6
- /******/ // The require scope
7
- /******/ var t = {
8
- /******/ // define getter functions for harmony exports
9
- /******/ d: (e, r) => {
10
- /******/ for (var n in r)
11
- /******/ t.o(r, n) && !t.o(e, n) &&
12
- /******/ Object.defineProperty(e, n, {
13
- enumerable: !0,
14
- get: r[n]
15
- })
16
- /******/;
17
- /******/ },
18
- /******/ o: (t, e) => Object.prototype.hasOwnProperty.call(t, e)
19
- /******/ ,
20
- /******/ // define __esModule on exports
21
- /******/ r: t => {
22
- /******/ "undefined" != typeof Symbol && Symbol.toStringTag &&
23
- /******/ Object.defineProperty(t, Symbol.toStringTag, {
24
- value: "Module"
25
- })
26
- /******/ , Object.defineProperty(t, "__esModule", {
27
- value: !0
28
- });
29
- }
30
- /******/ }, e = {};
31
- /******/
32
- /************************************************************************/
33
- /******/ /* webpack/runtime/define property getters */
34
- /******/
35
- // This entry need to be wrapped in an IIFE because it declares 'OHLCV_INDICATORS' on top-level, which conflicts with the current library output.
36
- (() => {
37
- // ./src/utilities/validators.js
38
- function r(t, e) {
39
- return function(t) {
40
- if (Array.isArray(t)) return t;
41
- }(t) || function(t, e) {
42
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
43
- if (null != r) {
44
- var n, o, i, a, u = [], l = !0, c = !1;
45
- try {
46
- if (i = (r = r.call(t)).next, 0 === e) {
47
- if (Object(r) !== r) return;
48
- l = !1;
49
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
50
- } catch (t) {
51
- c = !0, o = t;
52
- } finally {
53
- try {
54
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
55
- } finally {
56
- if (c) throw o;
57
- }
58
- }
59
- return u;
60
- }
61
- }(t, e) || i(t, e) || function() {
62
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
63
- }();
64
- }
65
- function n(t) {
66
- return n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
67
- return typeof t;
68
- } : function(t) {
69
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
70
- }, n(t);
71
- }
72
- function o(t, e) {
73
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
74
- if (!r) {
75
- if (Array.isArray(t) || (r = i(t)) || e && t && "number" == typeof t.length) {
76
- r && (t = r);
77
- var n = 0, o = function() {};
78
- return {
79
- s: o,
80
- n: function() {
81
- return n >= t.length ? {
82
- done: !0
83
- } : {
84
- done: !1,
85
- value: t[n++]
86
- };
87
- },
88
- e: function(t) {
89
- throw t;
90
- },
91
- f: o
92
- };
93
- }
94
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
95
- }
96
- var a, u = !0, l = !1;
97
- return {
98
- s: function() {
99
- r = r.call(t);
100
- },
101
- n: function() {
102
- var t = r.next();
103
- return u = t.done, t;
104
- },
105
- e: function(t) {
106
- l = !0, a = t;
107
- },
108
- f: function() {
109
- try {
110
- u || null == r.return || r.return();
111
- } finally {
112
- if (l) throw a;
113
- }
114
- }
115
- };
116
- }
117
- function i(t, e) {
118
- if (t) {
119
- if ("string" == typeof t) return a(t, e);
120
- var r = {}.toString.call(t).slice(8, -1);
121
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? a(t, e) : void 0;
122
- }
123
- }
124
- function a(t, e) {
125
- (null == e || e > t.length) && (e = t.length);
126
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
127
- return n;
128
- }
129
- // ESM COMPAT FLAG
130
- t.r(e),
131
- // EXPORTS
132
- t.d(e, {
133
- default: () => /* binding */ rn
134
- });
135
- var u = function(t, e) {
136
- if (!Array.isArray(t)) throw new Error('Property "inputParams" must be an "Array" or "Set".');
137
- var r, n = o(t);
138
- try {
139
- for (n.s(); !(r = n.n()).done; ) {
140
- var i, a = o(r.value.params);
141
- try {
142
- for (a.s(); !(i = a.n()).done; ) {
143
- var u = i.value;
144
- if ("number" == typeof u && u > e) throw console.log(u, e), new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.");
145
- }
146
- } catch (t) {
147
- a.e(t);
148
- } finally {
149
- a.f();
150
- }
151
- }
152
- } catch (t) {
153
- n.e(t);
154
- } finally {
155
- n.f();
156
- }
157
- }, l = function(t) {
158
- if (!0 === t.isComputed) throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.');
159
- }, c = function(t, e, r) {
160
- if (!Array.isArray(t)) throw new Error('Param "'.concat(e, '" must be an array in "').concat(r, '".'));
161
- return !0;
162
- }, s = function(t, e, r) {
163
- if (!Boolean(t) || "object" == !n(t)) throw new Error('Param "'.concat(e, '" must be an object in "').concat(r, '".'));
164
- return !0;
165
- }, f = function(t, e, r, n) {
166
- if (c(t, "arrayOptions", "".concat(n, ".").concat(r, ".validateArrayOptions")),
167
- !t.includes(e.toString())) throw new Error('Param "'.concat(r, '" must be any of the following values [').concat(t.join(", "), '] in "').concat(n, '".'));
168
- return !0;
169
- }, y = function(t, e, r) {
170
- if ("boolean" != typeof t) throw new Error('Param "'.concat(e, '" must be an boolean in "').concat(r, '".'));
171
- return !0;
172
- }, p = function(t, e, r, n) {
173
- s(e, "options", "".concat(n, ".").concat(r, ".validateNumber"));
174
- var o = e.allowDecimals, i = void 0 !== o && o, a = e.min, u = e.max, l = i ? "number" : "integer";
175
- if ("number" != typeof t || !1 === i && !Number.isInteger(t)) throw new Error('Param "'.concat(r, '" must be an integer in "').concat(n, '".'));
176
- if ("number" != typeof a || "number" != typeof u || a >= u) throw new Error('Param "min" must be a valid '.concat(l, ' lower than "max" "').concat(n, ".").concat(r, '.validateNumber".'));
177
- if (t < a) throw new Error('Param "'.concat(r, '" must be an ').concat(l, " greater than or equal to ").concat(a, ' in "').concat(n, '".'));
178
- if (t > u) throw new Error('Param "'.concat(r, '" must be an ').concat(l, " lower than or equal to ").concat(u, ' in "').concat(n, '".'));
179
- return !0;
180
- }, // 0, 1, 2 or 3
181
- // The maximum value of DP and Big.DP.
182
- h = 1e6, // 0 to 1000000
183
- // The maximum magnitude of the exponent argument to the pow method.
184
- v = 1e6, // true or false
185
- /**************************************************************************************************/
186
- // Error messages.
187
- m = "[big.js] ", d = m + "Invalid ", b = d + "decimal places", g = d + "rounding mode", w = m + "Division by zero",
188
- // The shared prototype object.
189
- O = {}, S = void 0, j = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
190
- /*
191
- * Round Big x to a maximum of sd significant digits using rounding mode rm.
192
- *
193
- * x {Big} The Big to round.
194
- * sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
195
- * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
196
- * [more] {boolean} Whether the result of division was truncated.
197
- */
198
- function P(t, e, r, n) {
199
- var o = t.c;
200
- if (r === S && (r = t.constructor.RM), 0 !== r && 1 !== r && 2 !== r && 3 !== r) throw Error(g);
201
- if (e < 1) n = 3 === r && (n || !!o[0]) || 0 === e && (1 === r && o[0] >= 5 || 2 === r && (o[0] > 5 || 5 === o[0] && (n || o[1] !== S))),
202
- o.length = 1, n ? (
203
- // 1, 0.1, 0.01, 0.001, 0.0001 etc.
204
- t.e = t.e - e + 1, o[0] = 1) :
205
- // Zero.
206
- o[0] = t.e = 0; else if (e < o.length) {
207
- // Round up?
208
- if (
209
- // xc[sd] is the digit after the digit that may be rounded up.
210
- n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !== S || 1 & o[e - 1])) || 3 === r && (n || !!o[0]),
211
- // Remove any digits after the required precision.
212
- o.length = e, n)
213
- // Rounding up may mean the previous digit has to be rounded up.
214
- for (;++o[--e] > 9; ) if (o[e] = 0, 0 === e) {
215
- ++t.e, o.unshift(1);
216
- break;
217
- }
218
- // Remove trailing zeros.
219
- for (e = o.length; !o[--e]; ) o.pop();
220
- }
221
- return t;
222
- }
223
- /*
224
- * Return a string representing the value of Big x in normal or exponential notation.
225
- * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
226
- */ function _(t, e, r) {
227
- var n = t.e, o = t.c.join(""), i = o.length;
228
- // Exponential notation?
229
- if (e) o = o.charAt(0) + (i > 1 ? "." + o.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
230
- // Normal notation.
231
- else if (n < 0) {
232
- for (;++n; ) o = "0" + o;
233
- o = "0." + o;
234
- } else if (n > 0) if (++n > i) for (n -= i; n--; ) o += "0"; else n < i && (o = o.slice(0, n) + "." + o.slice(n)); else i > 1 && (o = o.charAt(0) + "." + o.slice(1));
235
- return t.s < 0 && r ? "-" + o : o;
236
- }
237
- // Prototype/instance methods
238
- /*
239
- * Return a new Big whose value is the absolute value of this Big.
240
- */ O.abs = function() {
241
- var t = new this.constructor(this);
242
- return t.s = 1, t;
243
- },
244
- /*
245
- * Return 1 if the value of this Big is greater than the value of Big y,
246
- * -1 if the value of this Big is less than the value of Big y, or
247
- * 0 if they have the same value.
248
- */
249
- O.cmp = function(t) {
250
- var e, r = this, n = r.c, o = (t = new r.constructor(t)).c, i = r.s, a = t.s, u = r.e, l = t.e;
251
- // Either zero?
252
- if (!n[0] || !o[0]) return n[0] ? i : o[0] ? -a : 0;
253
- // Signs differ?
254
- if (i != a) return i;
255
- // Compare exponents.
256
- if (e = i < 0, u != l) return u > l ^ e ? 1 : -1;
257
- // Compare digit by digit.
258
- for (a = (u = n.length) < (l = o.length) ? u : l, i = -1; ++i < a; ) if (n[i] != o[i]) return n[i] > o[i] ^ e ? 1 : -1;
259
- // Compare lengths.
260
- return u == l ? 0 : u > l ^ e ? 1 : -1;
261
- },
262
- /*
263
- * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
264
- * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
265
- */
266
- O.div = function(t) {
267
- var e = this, r = e.constructor, n = e.c, // dividend
268
- o = (t = new r(t)).c, // divisor
269
- i = e.s == t.s ? 1 : -1, a = r.DP;
270
- if (a !== ~~a || a < 0 || a > h) throw Error(b);
271
- // Divisor is zero?
272
- if (!o[0]) throw Error(w);
273
- // Dividend is 0? Return +-0.
274
- if (!n[0]) return t.s = i, t.c = [ t.e = 0 ], t;
275
- var u, l, c, s, f, y = o.slice(), p = u = o.length, v = n.length, m = n.slice(0, u), // remainder
276
- d = m.length, g = t, // quotient
277
- O = g.c = [], j = 0, _ = a + (g.e = e.e - t.e) + 1;
278
- // precision of the result
279
- // Add zeros to make remainder as long as divisor.
280
- for (g.s = i, i = _ < 0 ? 0 : _,
281
- // Create version of divisor with leading zero.
282
- y.unshift(0); d++ < u; ) m.push(0);
283
- do {
284
- // n is how many times the divisor goes into current remainder.
285
- for (c = 0; c < 10; c++) {
286
- // Compare divisor and remainder.
287
- if (u != (d = m.length)) s = u > d ? 1 : -1; else for (f = -1, s = 0; ++f < u; ) if (o[f] != m[f]) {
288
- s = o[f] > m[f] ? 1 : -1;
289
- break;
290
- }
291
- // If divisor < remainder, subtract divisor from remainder.
292
- if (!(s < 0)) break;
293
- // Remainder can't be more than 1 digit longer than divisor.
294
- // Equalise lengths using divisor with extra leading zero?
295
- for (l = d == u ? o : y; d; ) {
296
- if (m[--d] < l[d]) {
297
- for (f = d; f && !m[--f]; ) m[f] = 9;
298
- --m[f], m[d] += 10;
299
- }
300
- m[d] -= l[d];
301
- }
302
- for (;!m[0]; ) m.shift();
303
- }
304
- // Add the digit n to the result array.
305
- O[j++] = s ? c : ++c,
306
- // Update the remainder.
307
- m[0] && s ? m[d] = n[p] || 0 : m = [ n[p] ];
308
- } while ((p++ < v || m[0] !== S) && i--);
309
- // Leading zero? Do not remove if result is simply zero (qi == 1).
310
- return O[0] || 1 == j || (
311
- // There can't be more than one zero.
312
- O.shift(), g.e--, _--),
313
- // Round?
314
- j > _ && P(g, _, r.RM, m[0] !== S), g;
315
- },
316
- /*
317
- * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
318
- */
319
- O.eq = function(t) {
320
- return 0 === this.cmp(t);
321
- },
322
- /*
323
- * Return true if the value of this Big is greater than the value of Big y, otherwise return
324
- * false.
325
- */
326
- O.gt = function(t) {
327
- return this.cmp(t) > 0;
328
- },
329
- /*
330
- * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
331
- * return false.
332
- */
333
- O.gte = function(t) {
334
- return this.cmp(t) > -1;
335
- },
336
- /*
337
- * Return true if the value of this Big is less than the value of Big y, otherwise return false.
338
- */
339
- O.lt = function(t) {
340
- return this.cmp(t) < 0;
341
- },
342
- /*
343
- * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
344
- * return false.
345
- */
346
- O.lte = function(t) {
347
- return this.cmp(t) < 1;
348
- },
349
- /*
350
- * Return a new Big whose value is the value of this Big minus the value of Big y.
351
- */
352
- O.minus = O.sub = function(t) {
353
- var e, r, n, o, i = this, a = i.constructor, u = i.s, l = (t = new a(t)).s;
354
- // Signs differ?
355
- if (u != l) return t.s = -l, i.plus(t);
356
- var c = i.c.slice(), s = i.e, f = t.c, y = t.e;
357
- // Either zero?
358
- if (!c[0] || !f[0]) return f[0] ? t.s = -l : c[0] ? t = new a(i) : t.s = 1,
359
- t;
360
- // Determine which is the bigger number. Prepend zeros to equalise exponents.
361
- if (u = s - y) {
362
- for ((o = u < 0) ? (u = -u, n = c) : (y = s, n = f), n.reverse(), l = u; l--; ) n.push(0);
363
- n.reverse();
364
- } else for (
365
- // Exponents equal. Check digit by digit.
366
- r = ((o = c.length < f.length) ? c : f).length, u = l = 0; l < r; l++) if (c[l] != f[l]) {
367
- o = c[l] < f[l];
368
- break;
369
- }
370
- // x < y? Point xc to the array of the bigger number.
371
- /*
372
- * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
373
- * needs to start at yc.length.
374
- */
375
- if (o && (n = c, c = f, f = n, t.s = -t.s), (l = (r = f.length) - (e = c.length)) > 0) for (;l--; ) c[e++] = 0;
376
- // Subtract yc from xc.
377
- for (l = e; r > u; ) {
378
- if (c[--r] < f[r]) {
379
- for (e = r; e && !c[--e]; ) c[e] = 9;
380
- --c[e], c[r] += 10;
381
- }
382
- c[r] -= f[r];
383
- }
384
- // Remove trailing zeros.
385
- for (;0 === c[--l]; ) c.pop();
386
- // Remove leading zeros and adjust exponent accordingly.
387
- for (;0 === c[0]; ) c.shift(), --y;
388
- return c[0] || (
389
- // n - n = +0
390
- t.s = 1,
391
- // Result must be zero.
392
- c = [ y = 0 ]), t.c = c, t.e = y, t;
393
- },
394
- /*
395
- * Return a new Big whose value is the value of this Big modulo the value of Big y.
396
- */
397
- O.mod = function(t) {
398
- var e, r = this, n = r.constructor, o = r.s, i = (t = new n(t)).s;
399
- if (!t.c[0]) throw Error(w);
400
- return r.s = t.s = 1, e = 1 == t.cmp(r), r.s = o, t.s = i, e ? new n(r) : (o = n.DP,
401
- i = n.RM, n.DP = n.RM = 0, r = r.div(t), n.DP = o, n.RM = i, this.minus(r.times(t)));
402
- },
403
- /*
404
- * Return a new Big whose value is the value of this Big negated.
405
- */
406
- O.neg = function() {
407
- var t = new this.constructor(this);
408
- return t.s = -t.s, t;
409
- },
410
- /*
411
- * Return a new Big whose value is the value of this Big plus the value of Big y.
412
- */
413
- O.plus = O.add = function(t) {
414
- var e, r, n, o = this, i = o.constructor;
415
- // Signs differ?
416
- if (t = new i(t), o.s != t.s) return t.s = -t.s, o.minus(t);
417
- var a = o.e, u = o.c, l = t.e, c = t.c;
418
- // Either zero?
419
- if (!u[0] || !c[0]) return c[0] || (u[0] ? t = new i(o) : t.s = o.s),
420
- t;
421
- // Prepend zeros to equalise exponents.
422
- // Note: reverse faster than unshifts.
423
- if (u = u.slice(), e = a - l) {
424
- for (e > 0 ? (l = a, n = c) : (e = -e, n = u), n.reverse(); e--; ) n.push(0);
425
- n.reverse();
426
- }
427
- // Point xc to the longer array.
428
- // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
429
- for (u.length - c.length < 0 && (n = c, c = u, u = n), e = c.length, r = 0; e; u[e] %= 10) r = (u[--e] = u[e] + c[e] + r) / 10 | 0;
430
- // No need to check for zero, as +x + +y != 0 && -x + -y != 0
431
- // Remove trailing zeros.
432
- for (r && (u.unshift(r), ++l), e = u.length; 0 === u[--e]; ) u.pop();
433
- return t.c = u, t.e = l, t;
434
- },
435
- /*
436
- * Return a Big whose value is the value of this Big raised to the power n.
437
- * If n is negative, round to a maximum of Big.DP decimal places using rounding
438
- * mode Big.RM.
439
- *
440
- * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
441
- */
442
- O.pow = function(t) {
443
- var e = this, r = new e.constructor("1"), n = r, o = t < 0;
444
- if (t !== ~~t || t < -1e6 || t > v) throw Error(d + "exponent");
445
- for (o && (t = -t); 1 & t && (n = n.times(e)), t >>= 1; ) e = e.times(e);
446
- return o ? r.div(n) : n;
447
- },
448
- /*
449
- * Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
450
- * significant digits using rounding mode rm, or Big.RM if rm is not specified.
451
- *
452
- * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
453
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
454
- */
455
- O.prec = function(t, e) {
456
- if (t !== ~~t || t < 1 || t > h) throw Error(d + "precision");
457
- return P(new this.constructor(this), t, e);
458
- },
459
- /*
460
- * Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
461
- * using rounding mode rm, or Big.RM if rm is not specified.
462
- * If dp is negative, round to an integer which is a multiple of 10**-dp.
463
- * If dp is not specified, round to 0 decimal places.
464
- *
465
- * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
466
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
467
- */
468
- O.round = function(t, e) {
469
- if (t === S) t = 0; else if (t !== ~~t || t < -h || t > h) throw Error(b);
470
- return P(new this.constructor(this), t + this.e + 1, e);
471
- },
472
- /*
473
- * Return a new Big whose value is the square root of the value of this Big, rounded, if
474
- * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
475
- */
476
- O.sqrt = function() {
477
- var t, e, r, n = this, o = n.constructor, i = n.s, a = n.e, u = new o("0.5");
478
- // Zero?
479
- if (!n.c[0]) return new o(n);
480
- // Negative?
481
- if (i < 0) throw Error(m + "No square root");
482
- // Estimate.
483
- // Math.sqrt underflow/overflow?
484
- // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
485
- 0 === (i = Math.sqrt(n + "")) || i === 1 / 0 ? ((e = n.c.join("")).length + a & 1 || (e += "0"),
486
- a = ((a + 1) / 2 | 0) - (a < 0 || 1 & a), t = new o(((i = Math.sqrt(e)) == 1 / 0 ? "5e" : (i = i.toExponential()).slice(0, i.indexOf("e") + 1)) + a)) : t = new o(i + ""),
487
- a = t.e + (o.DP += 4);
488
- // Newton-Raphson iteration.
489
- do {
490
- r = t, t = u.times(r.plus(n.div(r)));
491
- } while (r.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
492
- return P(t, (o.DP -= 4) + t.e + 1, o.RM);
493
- },
494
- /*
495
- * Return a new Big whose value is the value of this Big times the value of Big y.
496
- */
497
- O.times = O.mul = function(t) {
498
- var e, r = this, n = r.constructor, o = r.c, i = (t = new n(t)).c, a = o.length, u = i.length, l = r.e, c = t.e;
499
- // Determine sign of result.
500
- // Return signed 0 if either 0.
501
- if (t.s = r.s == t.s ? 1 : -1, !o[0] || !i[0]) return t.c = [ t.e = 0 ], t;
502
- // Initialise exponent of result as x.e + y.e.
503
- // Initialise coefficient array of result with zeros.
504
- for (t.e = l + c,
505
- // If array xc has fewer digits than yc, swap xc and yc, and lengths.
506
- a < u && (e = o, o = i, i = e, c = a, a = u, u = c), e = new Array(c = a + u); c--; ) e[c] = 0;
507
- // Multiply.
508
- // i is initially xc.length.
509
- for (l = u; l--; ) {
510
- // a is yc.length.
511
- for (u = 0, c = a + l; c > l; )
512
- // Current sum of products at this digit position, plus carry.
513
- u = e[c] + i[l] * o[c - l - 1] + u, e[c--] = u % 10,
514
- // carry
515
- u = u / 10 | 0;
516
- e[c] = u;
517
- }
518
- // Increment result exponent if there is a final carry, otherwise remove leading zero.
519
- // Remove trailing zeros.
520
- for (u ? ++t.e : e.shift(), l = e.length; !e[--l]; ) e.pop();
521
- return t.c = e, t;
522
- },
523
- /*
524
- * Return a string representing the value of this Big in exponential notation rounded to dp fixed
525
- * decimal places using rounding mode rm, or Big.RM if rm is not specified.
526
- *
527
- * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
528
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
529
- */
530
- O.toExponential = function(t, e) {
531
- var r = this, n = r.c[0];
532
- if (t !== S) {
533
- if (t !== ~~t || t < 0 || t > h) throw Error(b);
534
- for (r = P(new r.constructor(r), ++t, e); r.c.length < t; ) r.c.push(0);
535
- }
536
- return _(r, !0, !!n);
537
- },
538
- /*
539
- * Return a string representing the value of this Big in normal notation rounded to dp fixed
540
- * decimal places using rounding mode rm, or Big.RM if rm is not specified.
541
- *
542
- * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
543
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
544
- *
545
- * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
546
- * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
547
- */
548
- O.toFixed = function(t, e) {
549
- var r = this, n = r.c[0];
550
- if (t !== S) {
551
- if (t !== ~~t || t < 0 || t > h) throw Error(b);
552
- // x.e may have changed if the value is rounded up.
553
- for (t = t + (r = P(new r.constructor(r), t + r.e + 1, e)).e + 1; r.c.length < t; ) r.c.push(0);
554
- }
555
- return _(r, !1, !!n);
556
- },
557
- /*
558
- * Return a string representing the value of this Big.
559
- * Return exponential notation if this Big has a positive exponent equal to or greater than
560
- * Big.PE, or a negative exponent equal to or less than Big.NE.
561
- * Omit the sign for negative zero.
562
- */
563
- O[Symbol.for("nodejs.util.inspect.custom")] = O.toJSON = O.toString = function() {
564
- var t = this, e = t.constructor;
565
- return _(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
566
- },
567
- /*
568
- * Return the value of this Big as a primitve number.
569
- */
570
- O.toNumber = function() {
571
- var t = Number(_(this, !0, !0));
572
- if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(m + "Imprecise conversion");
573
- return t;
574
- },
575
- /*
576
- * Return a string representing the value of this Big rounded to sd significant digits using
577
- * rounding mode rm, or Big.RM if rm is not specified.
578
- * Use exponential notation if sd is less than the number of digits necessary to represent
579
- * the integer part of the value in normal notation.
580
- *
581
- * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
582
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
583
- */
584
- O.toPrecision = function(t, e) {
585
- var r = this, n = r.constructor, o = r.c[0];
586
- if (t !== S) {
587
- if (t !== ~~t || t < 1 || t > h) throw Error(d + "precision");
588
- for (r = P(new n(r), t, e); r.c.length < t; ) r.c.push(0);
589
- }
590
- return _(r, t <= r.e || r.e <= n.NE || r.e >= n.PE, !!o);
591
- },
592
- /*
593
- * Return a string representing the value of this Big.
594
- * Return exponential notation if this Big has a positive exponent equal to or greater than
595
- * Big.PE, or a negative exponent equal to or less than Big.NE.
596
- * Include the sign for negative zero.
597
- */
598
- O.valueOf = function() {
599
- var t = this, e = t.constructor;
600
- if (!0 === e.strict) throw Error(m + "valueOf disallowed");
601
- return _(t, t.e <= e.NE || t.e >= e.PE, !0);
602
- };
603
- // Export
604
- (
605
- /*
606
- * Create and return a Big constructor.
607
- */
608
- function t() {
609
- /*
610
- * The Big constructor and exported function.
611
- * Create and return a new instance of a Big number object.
612
- *
613
- * n {number|string|Big} A numeric value.
614
- */
615
- function e(r) {
616
- var n = this;
617
- // Enable constructor usage without new.
618
- if (!(n instanceof e)) return r === S ? t() : new e(r);
619
- // Duplicate.
620
- if (r instanceof e) n.s = r.s, n.e = r.e, n.c = r.c.slice(); else {
621
- if ("string" != typeof r) {
622
- if (!0 === e.strict && "bigint" != typeof r) throw TypeError(d + "value");
623
- // Minus zero?
624
- r = 0 === r && 1 / r < 0 ? "-0" : String(r);
625
- }
626
- !
627
- /*
628
- * Parse the number or string value passed to a Big constructor.
629
- *
630
- * x {Big} A Big number instance.
631
- * n {number|string} A numeric value.
632
- */
633
- function(t, e) {
634
- var r, n, o;
635
- if (!j.test(e)) throw Error(d + "number");
636
- // Determine sign.
637
- // Decimal point?
638
- t.s = "-" == e.charAt(0) ? (e = e.slice(1), -1) : 1, (r = e.indexOf(".")) > -1 && (e = e.replace(".", ""));
639
- // Exponential form?
640
- (n = e.search(/e/i)) > 0 ? (
641
- // Determine exponent.
642
- r < 0 && (r = n), r += +e.slice(n + 1), e = e.substring(0, n)) : r < 0 && (
643
- // Integer.
644
- r = e.length);
645
- // Determine leading zeros.
646
- for (o = e.length, n = 0; n < o && "0" == e.charAt(n); ) ++n;
647
- if (n == o)
648
- // Zero.
649
- t.c = [ t.e = 0 ]; else {
650
- // Determine trailing zeros.
651
- for (;o > 0 && "0" == e.charAt(--o); ) ;
652
- // Convert string to array of digits without leading/trailing zeros.
653
- for (t.e = r - n - 1, t.c = [], r = 0; n <= o; ) t.c[r++] = +e.charAt(n++);
654
- }
655
- }(n, r);
656
- }
657
- // Retain a reference to this Big constructor.
658
- // Shadow Big.prototype.constructor which points to Object.
659
- n.constructor = e;
660
- }
661
- return e.prototype = O, e.DP = 20, e.RM = 1, e.NE = -7, e.PE = 21, e.strict = false,
662
- e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e;
663
- })();
664
- /// <reference types="https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/big.js/index.d.ts" />
665
- /* harmony default export */ // ./node_modules/trading-signals/dist/error/NotEnoughDataError.js
666
- function N(t) {
667
- return N = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
668
- return typeof t;
669
- } : function(t) {
670
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
671
- }, N(t);
672
- }
673
- function T(t, e) {
674
- for (var r = 0; r < e.length; r++) {
675
- var n = e[r];
676
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
677
- Object.defineProperty(t, A(n.key), n);
678
- }
679
- }
680
- function A(t) {
681
- var e = function(t, e) {
682
- if ("object" != N(t) || !t) return t;
683
- var r = t[Symbol.toPrimitive];
684
- if (void 0 !== r) {
685
- var n = r.call(t, e || "default");
686
- if ("object" != N(n)) return n;
687
- throw new TypeError("@@toPrimitive must return a primitive value.");
688
- }
689
- return ("string" === e ? String : Number)(t);
690
- }(t, "string");
691
- return "symbol" == N(e) ? e : e + "";
692
- }
693
- function E(t, e, r) {
694
- return e = D(e), function(t, e) {
695
- if (e && ("object" == N(e) || "function" == typeof e)) return e;
696
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
697
- return function(t) {
698
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
699
- return t;
700
- }(t);
701
- }(t, x() ? Reflect.construct(e, r || [], D(t).constructor) : e.apply(t, r));
702
- }
703
- function k(t) {
704
- var e = "function" == typeof Map ? new Map : void 0;
705
- return k = function(t) {
706
- if (null === t || !function(t) {
707
- try {
708
- return -1 !== Function.toString.call(t).indexOf("[native code]");
709
- } catch (e) {
710
- return "function" == typeof t;
711
- }
712
- }(t)) return t;
713
- if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
714
- if (void 0 !== e) {
715
- if (e.has(t)) return e.get(t);
716
- e.set(t, r);
717
- }
718
- function r() {
719
- return function(t, e, r) {
720
- if (x()) return Reflect.construct.apply(null, arguments);
721
- var n = [ null ];
722
- n.push.apply(n, e);
723
- var o = new (t.bind.apply(t, n));
724
- return r && I(o, r.prototype), o;
725
- }(t, arguments, D(this).constructor);
726
- }
727
- return r.prototype = Object.create(t.prototype, {
728
- constructor: {
729
- value: r,
730
- enumerable: !1,
731
- writable: !0,
732
- configurable: !0
733
- }
734
- }), I(r, t);
735
- }, k(t);
736
- }
737
- function x() {
738
- try {
739
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
740
- } catch (t) {}
741
- return (x = function() {
742
- return !!t;
743
- })();
744
- }
745
- function I(t, e) {
746
- return I = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
747
- return t.__proto__ = e, t;
748
- }, I(t, e);
749
- }
750
- function D(t) {
751
- return D = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
752
- return t.__proto__ || Object.getPrototypeOf(t);
753
- }, D(t);
754
- }
755
- var M = function(t) {
756
- function e() {
757
- var t, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "Not enough data";
758
- return function(t, e) {
759
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
760
- }(this, e), t = E(this, e, [ r ]), Object.setPrototypeOf(t, (this instanceof e ? this.constructor : void 0).prototype),
761
- t.name = "NotEnoughDataError", t;
762
- }
763
- return function(t, e) {
764
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
765
- t.prototype = Object.create(e && e.prototype, {
766
- constructor: {
767
- value: t,
768
- writable: !0,
769
- configurable: !0
770
- }
771
- }), Object.defineProperty(t, "prototype", {
772
- writable: !1
773
- }), e && I(t, e);
774
- }(e, t), r = e, n && T(r.prototype, n), o && T(r, o), Object.defineProperty(r, "prototype", {
775
- writable: !1
776
- }), r;
777
- var r, n, o;
778
- }( k(Error));
779
- // ./node_modules/trading-signals/dist/Indicator.js
780
- function R(t) {
781
- return R = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
782
- return typeof t;
783
- } : function(t) {
784
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
785
- }, R(t);
786
- }
787
- function C(t, e) {
788
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
789
- }
790
- function F(t, e) {
791
- for (var r = 0; r < e.length; r++) {
792
- var n = e[r];
793
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
794
- Object.defineProperty(t, H(n.key), n);
795
- }
796
- }
797
- function L(t, e, r) {
798
- return e && F(t.prototype, e), r && F(t, r), Object.defineProperty(t, "prototype", {
799
- writable: !1
800
- }), t;
801
- }
802
- function B(t, e, r) {
803
- return (e = H(e)) in t ? Object.defineProperty(t, e, {
804
- value: r,
805
- enumerable: !0,
806
- configurable: !0,
807
- writable: !0
808
- }) : t[e] = r, t;
809
- }
810
- function H(t) {
811
- var e = function(t, e) {
812
- if ("object" != R(t) || !t) return t;
813
- var r = t[Symbol.toPrimitive];
814
- if (void 0 !== r) {
815
- var n = r.call(t, e || "default");
816
- if ("object" != R(n)) return n;
817
- throw new TypeError("@@toPrimitive must return a primitive value.");
818
- }
819
- return ("string" === e ? String : Number)(t);
820
- }(t, "string");
821
- return "symbol" == R(e) ? e : e + "";
822
- }
823
- var V = function() {
824
- return L((function t() {
825
- C(this, t), B(this, "previousHighest", void 0), B(this, "highest", void 0), B(this, "previousLowest", void 0),
826
- B(this, "lowest", void 0), B(this, "previousResult", void 0), B(this, "result", void 0);
827
- }), [ {
828
- key: "isStable",
829
- get: function() {
830
- return void 0 !== this.result;
831
- }
832
- }, {
833
- key: "getResult",
834
- value: function() {
835
- if (void 0 === this.result) throw new M;
836
- return this.result;
837
- }
838
- }, {
839
- key: "setResult",
840
- value: function(t, e) {
841
- return e && (this.highest = this.previousHighest, this.lowest = this.previousLowest,
842
- this.result = this.previousResult), void 0 === this.highest ? this.highest = t : t > this.highest ? (this.previousHighest = this.highest,
843
- this.highest = t) : this.previousHighest = this.highest, void 0 === this.lowest ? this.lowest = t : t < this.lowest ? (this.previousLowest = this.lowest,
844
- this.lowest = t) : this.previousLowest = this.lowest, this.previousResult = this.result,
845
- this.result = t;
846
- }
847
- }, {
848
- key: "replace",
849
- value: function(t) {
850
- return this.update(t, !0);
851
- }
852
- } ]);
853
- }();
854
- // ./node_modules/trading-signals/dist/MA/MovingAverage.js
855
- function U(t) {
856
- return U = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
857
- return typeof t;
858
- } : function(t) {
859
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
860
- }, U(t);
861
- }
862
- function $(t, e) {
863
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
864
- }
865
- function q(t, e) {
866
- for (var r = 0; r < e.length; r++) {
867
- var n = e[r];
868
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
869
- Object.defineProperty(t, W(n.key), n);
870
- }
871
- }
872
- function z(t, e, r) {
873
- return e && q(t.prototype, e), r && q(t, r), Object.defineProperty(t, "prototype", {
874
- writable: !1
875
- }), t;
876
- }
877
- function G(t, e, r) {
878
- return e = Y(e), function(t, e) {
879
- if (e && ("object" == U(e) || "function" == typeof e)) return e;
880
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
881
- return function(t) {
882
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
883
- return t;
884
- }(t);
885
- }(t, K() ? Reflect.construct(e, r || [], Y(t).constructor) : e.apply(t, r));
886
- }
887
- function K() {
888
- try {
889
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
890
- } catch (t) {}
891
- return (K = function() {
892
- return !!t;
893
- })();
894
- }
895
- function Y(t) {
896
- return Y = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
897
- return t.__proto__ || Object.getPrototypeOf(t);
898
- }, Y(t);
899
- }
900
- function J(t, e) {
901
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
902
- t.prototype = Object.create(e && e.prototype, {
903
- constructor: {
904
- value: t,
905
- writable: !0,
906
- configurable: !0
907
- }
908
- }), Object.defineProperty(t, "prototype", {
909
- writable: !1
910
- }), e && Z(t, e);
911
- }
912
- function Z(t, e) {
913
- return Z = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
914
- return t.__proto__ = e, t;
915
- }, Z(t, e);
916
- }
917
- function Q(t, e, r) {
918
- return (e = W(e)) in t ? Object.defineProperty(t, e, {
919
- value: r,
920
- enumerable: !0,
921
- configurable: !0,
922
- writable: !0
923
- }) : t[e] = r, t;
924
- }
925
- function W(t) {
926
- var e = function(t, e) {
927
- if ("object" != U(t) || !t) return t;
928
- var r = t[Symbol.toPrimitive];
929
- if (void 0 !== r) {
930
- var n = r.call(t, e || "default");
931
- if ("object" != U(n)) return n;
932
- throw new TypeError("@@toPrimitive must return a primitive value.");
933
- }
934
- return ("string" === e ? String : Number)(t);
935
- }(t, "string");
936
- return "symbol" == U(e) ? e : e + "";
937
- }
938
- var X = function(t) {
939
- function e(t) {
940
- var r;
941
- return $(this, e), Q(r = G(this, e), "interval", void 0), r.interval = t, r;
942
- }
943
- return J(e, t), z(e, [ {
944
- key: "updates",
945
- value: function(t) {
946
- var e = this;
947
- return t.forEach((function(t) {
948
- return e.update(t);
949
- })), this.result;
950
- }
951
- }, {
952
- key: "replace",
953
- value: function(t) {
954
- return this.update(t, !0);
955
- }
956
- } ]);
957
- }(V);
958
- // ./node_modules/trading-signals/dist/SMA/SMA.js
959
- function tt(t) {
960
- return tt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
961
- return typeof t;
962
- } : function(t) {
963
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
964
- }, tt(t);
965
- }
966
- function et(t, e) {
967
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
968
- }
969
- function rt(t, e) {
970
- for (var r = 0; r < e.length; r++) {
971
- var n = e[r];
972
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
973
- Object.defineProperty(t, st(n.key), n);
974
- }
975
- }
976
- function nt(t, e, r) {
977
- return e && rt(t.prototype, e), r && rt(t, r), Object.defineProperty(t, "prototype", {
978
- writable: !1
979
- }), t;
980
- }
981
- function ot(t, e, r) {
982
- return e = at(e), function(t, e) {
983
- if (e && ("object" == tt(e) || "function" == typeof e)) return e;
984
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
985
- return function(t) {
986
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
987
- return t;
988
- }(t);
989
- }(t, it() ? Reflect.construct(e, r || [], at(t).constructor) : e.apply(t, r));
990
- }
991
- function it() {
992
- try {
993
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
994
- } catch (t) {}
995
- return (it = function() {
996
- return !!t;
997
- })();
998
- }
999
- function at(t) {
1000
- return at = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1001
- return t.__proto__ || Object.getPrototypeOf(t);
1002
- }, at(t);
1003
- }
1004
- function ut(t, e) {
1005
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1006
- t.prototype = Object.create(e && e.prototype, {
1007
- constructor: {
1008
- value: t,
1009
- writable: !0,
1010
- configurable: !0
1011
- }
1012
- }), Object.defineProperty(t, "prototype", {
1013
- writable: !1
1014
- }), e && lt(t, e);
1015
- }
1016
- function lt(t, e) {
1017
- return lt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1018
- return t.__proto__ = e, t;
1019
- }, lt(t, e);
1020
- }
1021
- function ct(t, e, r) {
1022
- return (e = st(e)) in t ? Object.defineProperty(t, e, {
1023
- value: r,
1024
- enumerable: !0,
1025
- configurable: !0,
1026
- writable: !0
1027
- }) : t[e] = r, t;
1028
- }
1029
- function st(t) {
1030
- var e = function(t, e) {
1031
- if ("object" != tt(t) || !t) return t;
1032
- var r = t[Symbol.toPrimitive];
1033
- if (void 0 !== r) {
1034
- var n = r.call(t, e || "default");
1035
- if ("object" != tt(n)) return n;
1036
- throw new TypeError("@@toPrimitive must return a primitive value.");
1037
- }
1038
- return ("string" === e ? String : Number)(t);
1039
- }(t, "string");
1040
- return "symbol" == tt(e) ? e : e + "";
1041
- }
1042
- var ft = function(t) {
1043
- function e() {
1044
- var t;
1045
- et(this, e);
1046
- for (var r = arguments.length, n = new Array(r), o = 0; o < r; o++) n[o] = arguments[o];
1047
- return ct(t = ot(this, e, [].concat(n)), "prices", []), t;
1048
- }
1049
- return ut(e, t), nt(e, [ {
1050
- key: "update",
1051
- value: function(t) {
1052
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1053
- if (this.prices.length && e ? this.prices[this.prices.length - 1] = t : this.prices.push(t),
1054
- this.prices.length > this.interval && this.prices.shift(), this.prices.length === this.interval) {
1055
- var r = this.prices.reduce((function(t, e) {
1056
- return t + e;
1057
- }), 0);
1058
- return this.setResult(r / this.prices.length, e);
1059
- }
1060
- }
1061
- } ]);
1062
- }(X);
1063
- // ./node_modules/trading-signals/dist/WSMA/WSMA.js
1064
- function yt(t) {
1065
- return yt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1066
- return typeof t;
1067
- } : function(t) {
1068
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1069
- }, yt(t);
1070
- }
1071
- function pt(t, e) {
1072
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1073
- }
1074
- function ht(t, e) {
1075
- for (var r = 0; r < e.length; r++) {
1076
- var n = e[r];
1077
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1078
- Object.defineProperty(t, St(n.key), n);
1079
- }
1080
- }
1081
- function vt(t, e, r) {
1082
- return e && ht(t.prototype, e), r && ht(t, r), Object.defineProperty(t, "prototype", {
1083
- writable: !1
1084
- }), t;
1085
- }
1086
- function mt(t, e, r) {
1087
- return e = bt(e), function(t, e) {
1088
- if (e && ("object" == yt(e) || "function" == typeof e)) return e;
1089
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1090
- return function(t) {
1091
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1092
- return t;
1093
- }(t);
1094
- }(t, dt() ? Reflect.construct(e, r || [], bt(t).constructor) : e.apply(t, r));
1095
- }
1096
- function dt() {
1097
- try {
1098
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1099
- } catch (t) {}
1100
- return (dt = function() {
1101
- return !!t;
1102
- })();
1103
- }
1104
- function bt(t) {
1105
- return bt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1106
- return t.__proto__ || Object.getPrototypeOf(t);
1107
- }, bt(t);
1108
- }
1109
- function gt(t, e) {
1110
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1111
- t.prototype = Object.create(e && e.prototype, {
1112
- constructor: {
1113
- value: t,
1114
- writable: !0,
1115
- configurable: !0
1116
- }
1117
- }), Object.defineProperty(t, "prototype", {
1118
- writable: !1
1119
- }), e && wt(t, e);
1120
- }
1121
- function wt(t, e) {
1122
- return wt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1123
- return t.__proto__ = e, t;
1124
- }, wt(t, e);
1125
- }
1126
- function Ot(t, e, r) {
1127
- return (e = St(e)) in t ? Object.defineProperty(t, e, {
1128
- value: r,
1129
- enumerable: !0,
1130
- configurable: !0,
1131
- writable: !0
1132
- }) : t[e] = r, t;
1133
- }
1134
- function St(t) {
1135
- var e = function(t, e) {
1136
- if ("object" != yt(t) || !t) return t;
1137
- var r = t[Symbol.toPrimitive];
1138
- if (void 0 !== r) {
1139
- var n = r.call(t, e || "default");
1140
- if ("object" != yt(n)) return n;
1141
- throw new TypeError("@@toPrimitive must return a primitive value.");
1142
- }
1143
- return ("string" === e ? String : Number)(t);
1144
- }(t, "string");
1145
- return "symbol" == yt(e) ? e : e + "";
1146
- }
1147
- var jt = function(t) {
1148
- function e(t) {
1149
- var r;
1150
- return pt(this, e), Ot(r = mt(this, e), "interval", void 0), Ot(r, "indicator", void 0),
1151
- Ot(r, "smoothingFactor", void 0), r.interval = t, r.indicator = new ft(t), r.smoothingFactor = 1 / r.interval,
1152
- r;
1153
- }
1154
- return gt(e, t), vt(e, [ {
1155
- key: "updates",
1156
- value: function(t) {
1157
- var e = this;
1158
- return t.forEach((function(t) {
1159
- return e.update(t);
1160
- })), this.result;
1161
- }
1162
- }, {
1163
- key: "update",
1164
- value: function(t) {
1165
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.indicator.update(t);
1166
- if (e && void 0 !== this.previousResult) {
1167
- var n = (t - this.previousResult) * this.smoothingFactor;
1168
- return this.setResult(n + this.previousResult, e);
1169
- }
1170
- if (!e && void 0 !== this.result) {
1171
- var o = (t - this.result) * this.smoothingFactor;
1172
- return this.setResult(o + this.result, e);
1173
- }
1174
- if (void 0 === this.result && void 0 !== r) return this.setResult(r, e);
1175
- }
1176
- } ]);
1177
- }(V);
1178
- function Pt(t) {
1179
- return t.length ? t.reduce((function(t, e) {
1180
- return t + e;
1181
- }), 0) / t.length : 0;
1182
- }
1183
- // ./node_modules/trading-signals/dist/TR/TR.js
1184
- function _t(t) {
1185
- return _t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1186
- return typeof t;
1187
- } : function(t) {
1188
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1189
- }, _t(t);
1190
- }
1191
- function Nt(t, e) {
1192
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1193
- }
1194
- function Tt(t, e) {
1195
- for (var r = 0; r < e.length; r++) {
1196
- var n = e[r];
1197
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1198
- Object.defineProperty(t, Rt(n.key), n);
1199
- }
1200
- }
1201
- function At(t, e, r) {
1202
- return e && Tt(t.prototype, e), r && Tt(t, r), Object.defineProperty(t, "prototype", {
1203
- writable: !1
1204
- }), t;
1205
- }
1206
- function Et(t, e, r) {
1207
- return e = xt(e), function(t, e) {
1208
- if (e && ("object" == _t(e) || "function" == typeof e)) return e;
1209
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1210
- return function(t) {
1211
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1212
- return t;
1213
- }(t);
1214
- }(t, kt() ? Reflect.construct(e, r || [], xt(t).constructor) : e.apply(t, r));
1215
- }
1216
- function kt() {
1217
- try {
1218
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1219
- } catch (t) {}
1220
- return (kt = function() {
1221
- return !!t;
1222
- })();
1223
- }
1224
- function xt(t) {
1225
- return xt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1226
- return t.__proto__ || Object.getPrototypeOf(t);
1227
- }, xt(t);
1228
- }
1229
- function It(t, e) {
1230
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1231
- t.prototype = Object.create(e && e.prototype, {
1232
- constructor: {
1233
- value: t,
1234
- writable: !0,
1235
- configurable: !0
1236
- }
1237
- }), Object.defineProperty(t, "prototype", {
1238
- writable: !1
1239
- }), e && Dt(t, e);
1240
- }
1241
- function Dt(t, e) {
1242
- return Dt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1243
- return t.__proto__ = e, t;
1244
- }, Dt(t, e);
1245
- }
1246
- function Mt(t, e, r) {
1247
- return (e = Rt(e)) in t ? Object.defineProperty(t, e, {
1248
- value: r,
1249
- enumerable: !0,
1250
- configurable: !0,
1251
- writable: !0
1252
- }) : t[e] = r, t;
1253
- }
1254
- function Rt(t) {
1255
- var e = function(t, e) {
1256
- if ("object" != _t(t) || !t) return t;
1257
- var r = t[Symbol.toPrimitive];
1258
- if (void 0 !== r) {
1259
- var n = r.call(t, e || "default");
1260
- if ("object" != _t(n)) return n;
1261
- throw new TypeError("@@toPrimitive must return a primitive value.");
1262
- }
1263
- return ("string" === e ? String : Number)(t);
1264
- }(t, "string");
1265
- return "symbol" == _t(e) ? e : e + "";
1266
- }
1267
- var Ct = function(t) {
1268
- function e() {
1269
- var t;
1270
- Nt(this, e);
1271
- for (var r = arguments.length, n = new Array(r), o = 0; o < r; o++) n[o] = arguments[o];
1272
- return Mt(t = Et(this, e, [].concat(n)), "previousCandle", void 0), Mt(t, "twoPreviousCandle", void 0),
1273
- t;
1274
- }
1275
- return It(e, t), At(e, [ {
1276
- key: "update",
1277
- value: function(t) {
1278
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = t.high, n = t.low, o = r - n;
1279
- if (this.previousCandle && e && (this.previousCandle = this.twoPreviousCandle),
1280
- this.previousCandle) {
1281
- var i = Math.abs(r - this.previousCandle.close), a = Math.abs(n - this.previousCandle.close);
1282
- return this.twoPreviousCandle = this.previousCandle, this.previousCandle = t, this.setResult(Math.max(o, i, a), e);
1283
- }
1284
- return this.twoPreviousCandle = this.previousCandle, this.previousCandle = t, this.setResult(o, e);
1285
- }
1286
- } ]);
1287
- }(V);
1288
- // ./node_modules/trading-signals/dist/ATR/ATR.js
1289
- function Ft(t) {
1290
- return Ft = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1291
- return typeof t;
1292
- } : function(t) {
1293
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1294
- }, Ft(t);
1295
- }
1296
- function Lt(t, e) {
1297
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1298
- }
1299
- function Bt(t, e) {
1300
- for (var r = 0; r < e.length; r++) {
1301
- var n = e[r];
1302
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1303
- Object.defineProperty(t, Kt(n.key), n);
1304
- }
1305
- }
1306
- function Ht(t, e, r) {
1307
- return e && Bt(t.prototype, e), r && Bt(t, r), Object.defineProperty(t, "prototype", {
1308
- writable: !1
1309
- }), t;
1310
- }
1311
- function Vt(t, e, r) {
1312
- return e = $t(e), function(t, e) {
1313
- if (e && ("object" == Ft(e) || "function" == typeof e)) return e;
1314
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1315
- return function(t) {
1316
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1317
- return t;
1318
- }(t);
1319
- }(t, Ut() ? Reflect.construct(e, r || [], $t(t).constructor) : e.apply(t, r));
1320
- }
1321
- function Ut() {
1322
- try {
1323
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1324
- } catch (t) {}
1325
- return (Ut = function() {
1326
- return !!t;
1327
- })();
1328
- }
1329
- function $t(t) {
1330
- return $t = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1331
- return t.__proto__ || Object.getPrototypeOf(t);
1332
- }, $t(t);
1333
- }
1334
- function qt(t, e) {
1335
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1336
- t.prototype = Object.create(e && e.prototype, {
1337
- constructor: {
1338
- value: t,
1339
- writable: !0,
1340
- configurable: !0
1341
- }
1342
- }), Object.defineProperty(t, "prototype", {
1343
- writable: !1
1344
- }), e && zt(t, e);
1345
- }
1346
- function zt(t, e) {
1347
- return zt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1348
- return t.__proto__ = e, t;
1349
- }, zt(t, e);
1350
- }
1351
- function Gt(t, e, r) {
1352
- return (e = Kt(e)) in t ? Object.defineProperty(t, e, {
1353
- value: r,
1354
- enumerable: !0,
1355
- configurable: !0,
1356
- writable: !0
1357
- }) : t[e] = r, t;
1358
- }
1359
- function Kt(t) {
1360
- var e = function(t, e) {
1361
- if ("object" != Ft(t) || !t) return t;
1362
- var r = t[Symbol.toPrimitive];
1363
- if (void 0 !== r) {
1364
- var n = r.call(t, e || "default");
1365
- if ("object" != Ft(n)) return n;
1366
- throw new TypeError("@@toPrimitive must return a primitive value.");
1367
- }
1368
- return ("string" === e ? String : Number)(t);
1369
- }(t, "string");
1370
- return "symbol" == Ft(e) ? e : e + "";
1371
- }
1372
- var Yt = function(t) {
1373
- function e(t) {
1374
- var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : jt;
1375
- return Lt(this, e), Gt(r = Vt(this, e), "interval", void 0), Gt(r, "tr", void 0),
1376
- Gt(r, "smoothing", void 0), r.interval = t, r.tr = new Ct, r.smoothing = new n(t),
1377
- r;
1378
- }
1379
- return qt(e, t), Ht(e, [ {
1380
- key: "update",
1381
- value: function(t) {
1382
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.tr.update(t, e);
1383
- if (this.smoothing.update(r, e), this.smoothing.isStable) return this.setResult(this.smoothing.getResult(), e);
1384
- }
1385
- } ]);
1386
- }(V);
1387
- // ./node_modules/trading-signals/dist/BBANDS/BollingerBands.js
1388
- function Jt(t) {
1389
- return Jt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1390
- return typeof t;
1391
- } : function(t) {
1392
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1393
- }, Jt(t);
1394
- }
1395
- function Zt(t, e) {
1396
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1397
- }
1398
- function Qt(t, e) {
1399
- for (var r = 0; r < e.length; r++) {
1400
- var n = e[r];
1401
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1402
- Object.defineProperty(t, te(n.key), n);
1403
- }
1404
- }
1405
- function Wt(t, e, r) {
1406
- return e && Qt(t.prototype, e), r && Qt(t, r), Object.defineProperty(t, "prototype", {
1407
- writable: !1
1408
- }), t;
1409
- }
1410
- function Xt(t, e, r) {
1411
- return (e = te(e)) in t ? Object.defineProperty(t, e, {
1412
- value: r,
1413
- enumerable: !0,
1414
- configurable: !0,
1415
- writable: !0
1416
- }) : t[e] = r, t;
1417
- }
1418
- function te(t) {
1419
- var e = function(t, e) {
1420
- if ("object" != Jt(t) || !t) return t;
1421
- var r = t[Symbol.toPrimitive];
1422
- if (void 0 !== r) {
1423
- var n = r.call(t, e || "default");
1424
- if ("object" != Jt(n)) return n;
1425
- throw new TypeError("@@toPrimitive must return a primitive value.");
1426
- }
1427
- return ("string" === e ? String : Number)(t);
1428
- }(t, "string");
1429
- return "symbol" == Jt(e) ? e : e + "";
1430
- }
1431
- var ee = function() {
1432
- return Wt((function t(e) {
1433
- var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2;
1434
- Zt(this, t), Xt(this, "interval", void 0), Xt(this, "deviationMultiplier", void 0),
1435
- Xt(this, "prices", []), Xt(this, "result", void 0), this.interval = e, this.deviationMultiplier = r;
1436
- }), [ {
1437
- key: "update",
1438
- value: function(t) {
1439
- if (this.prices.push(t), this.prices.length > this.interval) {
1440
- this.prices.shift();
1441
- var e = Pt(this.prices), r = function(t, e) {
1442
- var r = e || Pt(t), n = Pt(t.map((function(t) {
1443
- return t - r;
1444
- })).map((function(t) {
1445
- return t * t;
1446
- })));
1447
- return Math.sqrt(n);
1448
- }(this.prices, e);
1449
- return this.result = {
1450
- lower: e - r * this.deviationMultiplier,
1451
- middle: e,
1452
- upper: e + r * this.deviationMultiplier
1453
- };
1454
- }
1455
- }
1456
- }, {
1457
- key: "getResult",
1458
- value: function() {
1459
- if (void 0 === this.result) throw new M;
1460
- return this.result;
1461
- }
1462
- }, {
1463
- key: "isStable",
1464
- get: function() {
1465
- return void 0 !== this.result;
1466
- }
1467
- } ]);
1468
- }();
1469
- // ./node_modules/trading-signals/dist/EMA/EMA.js
1470
- function re(t) {
1471
- return re = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1472
- return typeof t;
1473
- } : function(t) {
1474
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1475
- }, re(t);
1476
- }
1477
- function ne(t, e) {
1478
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1479
- }
1480
- function oe(t, e) {
1481
- for (var r = 0; r < e.length; r++) {
1482
- var n = e[r];
1483
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1484
- Object.defineProperty(t, ye(n.key), n);
1485
- }
1486
- }
1487
- function ie(t, e, r) {
1488
- return e && oe(t.prototype, e), r && oe(t, r), Object.defineProperty(t, "prototype", {
1489
- writable: !1
1490
- }), t;
1491
- }
1492
- function ae(t, e, r) {
1493
- return e = le(e), function(t, e) {
1494
- if (e && ("object" == re(e) || "function" == typeof e)) return e;
1495
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1496
- return function(t) {
1497
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1498
- return t;
1499
- }(t);
1500
- }(t, ue() ? Reflect.construct(e, r || [], le(t).constructor) : e.apply(t, r));
1501
- }
1502
- function ue() {
1503
- try {
1504
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1505
- } catch (t) {}
1506
- return (ue = function() {
1507
- return !!t;
1508
- })();
1509
- }
1510
- function le(t) {
1511
- return le = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1512
- return t.__proto__ || Object.getPrototypeOf(t);
1513
- }, le(t);
1514
- }
1515
- function ce(t, e) {
1516
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1517
- t.prototype = Object.create(e && e.prototype, {
1518
- constructor: {
1519
- value: t,
1520
- writable: !0,
1521
- configurable: !0
1522
- }
1523
- }), Object.defineProperty(t, "prototype", {
1524
- writable: !1
1525
- }), e && se(t, e);
1526
- }
1527
- function se(t, e) {
1528
- return se = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1529
- return t.__proto__ = e, t;
1530
- }, se(t, e);
1531
- }
1532
- function fe(t, e, r) {
1533
- return (e = ye(e)) in t ? Object.defineProperty(t, e, {
1534
- value: r,
1535
- enumerable: !0,
1536
- configurable: !0,
1537
- writable: !0
1538
- }) : t[e] = r, t;
1539
- }
1540
- function ye(t) {
1541
- var e = function(t, e) {
1542
- if ("object" != re(t) || !t) return t;
1543
- var r = t[Symbol.toPrimitive];
1544
- if (void 0 !== r) {
1545
- var n = r.call(t, e || "default");
1546
- if ("object" != re(n)) return n;
1547
- throw new TypeError("@@toPrimitive must return a primitive value.");
1548
- }
1549
- return ("string" === e ? String : Number)(t);
1550
- }(t, "string");
1551
- return "symbol" == re(e) ? e : e + "";
1552
- }
1553
- var pe = function(t) {
1554
- function e(t) {
1555
- var r;
1556
- return ne(this, e), fe(r = ae(this, e, [ t ]), "interval", void 0), fe(r, "pricesCounter", 0),
1557
- fe(r, "weightFactor", void 0), r.interval = t, r.weightFactor = 2 / (r.interval + 1),
1558
- r;
1559
- }
1560
- return ce(e, t), ie(e, [ {
1561
- key: "update",
1562
- value: function(t) {
1563
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1564
- return e ? e && 0 === this.pricesCounter && this.pricesCounter++ : this.pricesCounter++,
1565
- e && void 0 !== this.previousResult ? this.setResult(t * this.weightFactor + this.previousResult * (1 - this.weightFactor), e) : this.setResult(t * this.weightFactor + (void 0 !== this.result ? this.result : t) * (1 - this.weightFactor), e);
1566
- }
1567
- }, {
1568
- key: "getResult",
1569
- value: function() {
1570
- if (this.pricesCounter < this.interval) throw new M;
1571
- return this.result;
1572
- }
1573
- }, {
1574
- key: "isStable",
1575
- get: function() {
1576
- try {
1577
- return this.getResult(), !0;
1578
- } catch (t) {
1579
- return !1;
1580
- }
1581
- }
1582
- } ]);
1583
- }(X);
1584
- // ./node_modules/trading-signals/dist/MACD/MACD.js
1585
- function he(t) {
1586
- return he = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1587
- return typeof t;
1588
- } : function(t) {
1589
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1590
- }, he(t);
1591
- }
1592
- function ve(t, e) {
1593
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1594
- }
1595
- function me(t, e) {
1596
- for (var r = 0; r < e.length; r++) {
1597
- var n = e[r];
1598
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1599
- Object.defineProperty(t, ge(n.key), n);
1600
- }
1601
- }
1602
- function de(t, e, r) {
1603
- return e && me(t.prototype, e), r && me(t, r), Object.defineProperty(t, "prototype", {
1604
- writable: !1
1605
- }), t;
1606
- }
1607
- function be(t, e, r) {
1608
- return (e = ge(e)) in t ? Object.defineProperty(t, e, {
1609
- value: r,
1610
- enumerable: !0,
1611
- configurable: !0,
1612
- writable: !0
1613
- }) : t[e] = r, t;
1614
- }
1615
- function ge(t) {
1616
- var e = function(t, e) {
1617
- if ("object" != he(t) || !t) return t;
1618
- var r = t[Symbol.toPrimitive];
1619
- if (void 0 !== r) {
1620
- var n = r.call(t, e || "default");
1621
- if ("object" != he(n)) return n;
1622
- throw new TypeError("@@toPrimitive must return a primitive value.");
1623
- }
1624
- return ("string" === e ? String : Number)(t);
1625
- }(t, "string");
1626
- return "symbol" == he(e) ? e : e + "";
1627
- }
1628
- var we = function() {
1629
- return de((function t(e, r, n) {
1630
- ve(this, t), be(this, "short", void 0), be(this, "long", void 0), be(this, "signal", void 0),
1631
- be(this, "prices", []), be(this, "result", void 0), this.short = e, this.long = r,
1632
- this.signal = n;
1633
- }), [ {
1634
- key: "getResult",
1635
- value: function() {
1636
- if (void 0 === this.result) throw new M;
1637
- return this.result;
1638
- }
1639
- }, {
1640
- key: "isStable",
1641
- get: function() {
1642
- return void 0 !== this.result;
1643
- }
1644
- }, {
1645
- key: "update",
1646
- value: function(t) {
1647
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1648
- this.prices.length && e ? this.prices[this.prices.length - 1] = t : this.prices.push(t);
1649
- var r = this.short.update(t, e), n = this.long.update(t, e);
1650
- if (this.prices.length > this.long.interval && this.prices.shift(), this.prices.length === this.long.interval) {
1651
- var o = r - n, i = this.signal.update(o, e);
1652
- return this.result = {
1653
- histogram: o - i,
1654
- macd: o,
1655
- signal: i
1656
- };
1657
- }
1658
- }
1659
- } ]);
1660
- }();
1661
- // ./node_modules/trading-signals/dist/RSI/RSI.js
1662
- function Oe(t) {
1663
- return Oe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1664
- return typeof t;
1665
- } : function(t) {
1666
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1667
- }, Oe(t);
1668
- }
1669
- function Se(t, e) {
1670
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1671
- }
1672
- function je(t, e) {
1673
- for (var r = 0; r < e.length; r++) {
1674
- var n = e[r];
1675
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
1676
- Object.defineProperty(t, xe(n.key), n);
1677
- }
1678
- }
1679
- function Pe(t, e, r) {
1680
- return e && je(t.prototype, e), r && je(t, r), Object.defineProperty(t, "prototype", {
1681
- writable: !1
1682
- }), t;
1683
- }
1684
- function _e(t, e, r) {
1685
- return e = Te(e), function(t, e) {
1686
- if (e && ("object" == Oe(e) || "function" == typeof e)) return e;
1687
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
1688
- return function(t) {
1689
- if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1690
- return t;
1691
- }(t);
1692
- }(t, Ne() ? Reflect.construct(e, r || [], Te(t).constructor) : e.apply(t, r));
1693
- }
1694
- function Ne() {
1695
- try {
1696
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1697
- } catch (t) {}
1698
- return (Ne = function() {
1699
- return !!t;
1700
- })();
1701
- }
1702
- function Te(t) {
1703
- return Te = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
1704
- return t.__proto__ || Object.getPrototypeOf(t);
1705
- }, Te(t);
1706
- }
1707
- function Ae(t, e) {
1708
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1709
- t.prototype = Object.create(e && e.prototype, {
1710
- constructor: {
1711
- value: t,
1712
- writable: !0,
1713
- configurable: !0
1714
- }
1715
- }), Object.defineProperty(t, "prototype", {
1716
- writable: !1
1717
- }), e && Ee(t, e);
1718
- }
1719
- function Ee(t, e) {
1720
- return Ee = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1721
- return t.__proto__ = e, t;
1722
- }, Ee(t, e);
1723
- }
1724
- function ke(t, e, r) {
1725
- return (e = xe(e)) in t ? Object.defineProperty(t, e, {
1726
- value: r,
1727
- enumerable: !0,
1728
- configurable: !0,
1729
- writable: !0
1730
- }) : t[e] = r, t;
1731
- }
1732
- function xe(t) {
1733
- var e = function(t, e) {
1734
- if ("object" != Oe(t) || !t) return t;
1735
- var r = t[Symbol.toPrimitive];
1736
- if (void 0 !== r) {
1737
- var n = r.call(t, e || "default");
1738
- if ("object" != Oe(n)) return n;
1739
- throw new TypeError("@@toPrimitive must return a primitive value.");
1740
- }
1741
- return ("string" === e ? String : Number)(t);
1742
- }(t, "string");
1743
- return "symbol" == Oe(e) ? e : e + "";
1744
- }
1745
- var Ie = function(t) {
1746
- function e(t) {
1747
- var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : jt;
1748
- return Se(this, e), ke(r = _e(this, e), "interval", void 0), ke(r, "previousPrices", []),
1749
- ke(r, "avgGain", void 0), ke(r, "avgLoss", void 0), ke(r, "maxValue", 100), r.interval = t,
1750
- r.avgGain = new n(r.interval), r.avgLoss = new n(r.interval), r;
1751
- }
1752
- return Ae(e, t), Pe(e, [ {
1753
- key: "update",
1754
- value: function(t) {
1755
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1756
- if (this.previousPrices.length && e ? this.previousPrices[this.previousPrices.length - 1] = t : this.previousPrices.push(t),
1757
- !(this.previousPrices.length < 2)) {
1758
- var r = t, n = this.previousPrices[this.previousPrices.length - 2];
1759
- if (r > n ? (this.avgLoss.update(0, e), this.avgGain.update(t - n, e)) : (this.avgLoss.update(n - r, e),
1760
- this.avgGain.update(0, e)), this.avgGain.isStable) {
1761
- var o = this.avgLoss.getResult();
1762
- if (0 === o) return this.setResult(100, e);
1763
- var i = this.avgGain.getResult() / o;
1764
- return this.setResult(this.maxValue - this.maxValue / (i + 1), e);
1765
- }
1766
- }
1767
- }
1768
- } ]);
1769
- }(V);
1770
- // ./src/oscillators/rsi.js
1771
- function De(t) {
1772
- return De = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1773
- return typeof t;
1774
- } : function(t) {
1775
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1776
- }, De(t);
1777
- }
1778
- function Me(t, e, r) {
1779
- return (e = function(t) {
1780
- var e = function(t, e) {
1781
- if ("object" != De(t) || !t) return t;
1782
- var r = t[Symbol.toPrimitive];
1783
- if (void 0 !== r) {
1784
- var n = r.call(t, e || "default");
1785
- if ("object" != De(n)) return n;
1786
- throw new TypeError("@@toPrimitive must return a primitive value.");
1787
- }
1788
- return ("string" === e ? String : Number)(t);
1789
- }(t, "string");
1790
- return "symbol" == De(e) ? e : e + "";
1791
- }(e)) in t ? Object.defineProperty(t, e, {
1792
- value: r,
1793
- enumerable: !0,
1794
- configurable: !0,
1795
- writable: !0
1796
- }) : t[e] = r, t;
1797
- }
1798
- var Re = {
1799
- ema: pe,
1800
- sma: ft
1801
- }, Ce = function(t, e, r, n, o) {
1802
- var i = o.target, a = (o.lag, o.precomputed), u = t.verticalOhlcv, l = t.instances, c = a.keyName;
1803
- if (0 === e && !u.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for ").concat(r, "."));
1804
- // Retrieve the current price value.
1805
- var s = u[i][e], f = l[c];
1806
- // Update the moving average instance.
1807
- f.update(s);
1808
- var y = NaN;
1809
- try {
1810
- y = f.getResult();
1811
- } catch (t) {}
1812
- // Always push the MA value (even if NaN).
1813
- return t.pushToMain({
1814
- index: e,
1815
- key: c,
1816
- value: y
1817
- }), !0;
1818
- }, Fe = function(t) {
1819
- var e = t.main, r = t.size, n = t.target, o = t.lag, i = t.methodName, a = e.instances, u = e.verticalOhlcv, l = e.priceBased, c = e.arrayTypes, s = e.len, f = "close" !== n ? "_".concat(n) : "", y = "".concat(i, "_").concat(r).concat(f);
1820
- // Create the main moving average instance.
1821
- return a[y] = new Re[i](r), u[y] = new Float64Array(s).fill(NaN), l.add(y), o > 0 && e.lag([ y ], o),
1822
- c[y] = "Float64Array", {
1823
- keyName: y
1824
- };
1825
- };
1826
- // ./src/moving-averages/macd.js
1827
- function Le(t) {
1828
- return Le = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1829
- return typeof t;
1830
- } : function(t) {
1831
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1832
- }, Le(t);
1833
- }
1834
- function Be(t, e, r) {
1835
- return (e = function(t) {
1836
- var e = function(t, e) {
1837
- if ("object" != Le(t) || !t) return t;
1838
- var r = t[Symbol.toPrimitive];
1839
- if (void 0 !== r) {
1840
- var n = r.call(t, e || "default");
1841
- if ("object" != Le(n)) return n;
1842
- throw new TypeError("@@toPrimitive must return a primitive value.");
1843
- }
1844
- return ("string" === e ? String : Number)(t);
1845
- }(t, "string");
1846
- return "symbol" == Le(e) ? e : e + "";
1847
- }(e)) in t ? Object.defineProperty(t, e, {
1848
- value: r,
1849
- enumerable: !0,
1850
- configurable: !0,
1851
- writable: !0
1852
- }) : t[e] = r, t;
1853
- }
1854
- function He(t, e) {
1855
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
1856
- if (!r) {
1857
- if (Array.isArray(t) || (r = function(t, e) {
1858
- if (t) {
1859
- if ("string" == typeof t) return Ve(t, e);
1860
- var r = {}.toString.call(t).slice(8, -1);
1861
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Ve(t, e) : void 0;
1862
- }
1863
- }(t)) || e && t && "number" == typeof t.length) {
1864
- r && (t = r);
1865
- var n = 0, o = function() {};
1866
- return {
1867
- s: o,
1868
- n: function() {
1869
- return n >= t.length ? {
1870
- done: !0
1871
- } : {
1872
- done: !1,
1873
- value: t[n++]
1874
- };
1875
- },
1876
- e: function(t) {
1877
- throw t;
1878
- },
1879
- f: o
1880
- };
1881
- }
1882
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1883
- }
1884
- var i, a = !0, u = !1;
1885
- return {
1886
- s: function() {
1887
- r = r.call(t);
1888
- },
1889
- n: function() {
1890
- var t = r.next();
1891
- return a = t.done, t;
1892
- },
1893
- e: function(t) {
1894
- u = !0, i = t;
1895
- },
1896
- f: function() {
1897
- try {
1898
- a || null == r.return || r.return();
1899
- } finally {
1900
- if (u) throw i;
1901
- }
1902
- }
1903
- };
1904
- }
1905
- function Ve(t, e) {
1906
- (null == e || e > t.length) && (e = t.length);
1907
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1908
- return n;
1909
- }
1910
- var Ue = "close";
1911
- // ./src/utilities/numberUtilities.js
1912
- function $e(t) {
1913
- return $e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1914
- return typeof t;
1915
- } : function(t) {
1916
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1917
- }, $e(t);
1918
- }
1919
- // Helper to clean non-numeric characters (except "-" at the start and decimal point)
1920
- var qe = {
1921
- number: function(t) {
1922
- return t;
1923
- },
1924
- numberCleanString: function(t) {
1925
- return Number(t);
1926
- },
1927
- numberDirtyString: function(t) {
1928
- return Number(t.replace(/(?!^-)[^0-9.]/g, ""));
1929
- }
1930
- }, ze = function(t) {
1931
- var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
1932
- // 1) true numbers
1933
- if ("number" == typeof t && !Number.isNaN(t)) return "number";
1934
- // 2) strings
1935
- if ("string" == typeof t) {
1936
- var r = t.trim(), n = /^-?\d+(\.\d+)?$/;
1937
- // a) clean numeric string: only digits and an optional single period
1938
- if (n.test(r)) return "numberCleanString";
1939
- // b) dirty numeric string: contains non-digits (dollar, commas, letters, etc.)
1940
- // but once you strip those out, you're left with a valid number
1941
- var o = r.replace(/[^0-9.]/g, "");
1942
- if (o && n.test(o)) return "numberDirtyString";
1943
- }
1944
- if (e) throw new TypeError("Invalid input: expected a number or numeric string");
1945
- return $e(t);
1946
- }, Ge = function(t, e) {
1947
- var r = Math.pow(10, e);
1948
- // add a tiny epsilon to mitigate floating-point quirks around .5
1949
- return Math.round((t + Number.EPSILON) * r) / r;
1950
- };
1951
- // ./src/moving-averages/donchianChannel.js
1952
- function Ke(t) {
1953
- return function(t) {
1954
- if (Array.isArray(t)) return Je(t);
1955
- }(t) || function(t) {
1956
- if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1957
- }(t) || Ye(t) || function() {
1958
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1959
- }();
1960
- }
1961
- function Ye(t, e) {
1962
- if (t) {
1963
- if ("string" == typeof t) return Je(t, e);
1964
- var r = {}.toString.call(t).slice(8, -1);
1965
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Je(t, e) : void 0;
1966
- }
1967
- }
1968
- function Je(t, e) {
1969
- (null == e || e > t.length) && (e = t.length);
1970
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1971
- return n;
1972
- }
1973
- // ./src/moving-averages/bollingerBands.js
1974
- function Ze(t) {
1975
- return Ze = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1976
- return typeof t;
1977
- } : function(t) {
1978
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1979
- }, Ze(t);
1980
- }
1981
- function Qe(t, e) {
1982
- var r = Object.keys(t);
1983
- if (Object.getOwnPropertySymbols) {
1984
- var n = Object.getOwnPropertySymbols(t);
1985
- e && (n = n.filter((function(e) {
1986
- return Object.getOwnPropertyDescriptor(t, e).enumerable;
1987
- }))), r.push.apply(r, n);
1988
- }
1989
- return r;
1990
- }
1991
- function We(t, e, r) {
1992
- return (e = function(t) {
1993
- var e = function(t, e) {
1994
- if ("object" != Ze(t) || !t) return t;
1995
- var r = t[Symbol.toPrimitive];
1996
- if (void 0 !== r) {
1997
- var n = r.call(t, e || "default");
1998
- if ("object" != Ze(n)) return n;
1999
- throw new TypeError("@@toPrimitive must return a primitive value.");
2000
- }
2001
- return ("string" === e ? String : Number)(t);
2002
- }(t, "string");
2003
- return "symbol" == Ze(e) ? e : e + "";
2004
- }(e)) in t ? Object.defineProperty(t, e, {
2005
- value: r,
2006
- enumerable: !0,
2007
- configurable: !0,
2008
- writable: !0
2009
- }) : t[e] = r, t;
2010
- }
2011
- function Xe(t, e) {
2012
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2013
- if (!r) {
2014
- if (Array.isArray(t) || (r = function(t, e) {
2015
- if (t) {
2016
- if ("string" == typeof t) return tr(t, e);
2017
- var r = {}.toString.call(t).slice(8, -1);
2018
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? tr(t, e) : void 0;
2019
- }
2020
- }(t)) || e && t && "number" == typeof t.length) {
2021
- r && (t = r);
2022
- var n = 0, o = function() {};
2023
- return {
2024
- s: o,
2025
- n: function() {
2026
- return n >= t.length ? {
2027
- done: !0
2028
- } : {
2029
- done: !1,
2030
- value: t[n++]
2031
- };
2032
- },
2033
- e: function(t) {
2034
- throw t;
2035
- },
2036
- f: o
2037
- };
2038
- }
2039
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2040
- }
2041
- var i, a = !0, u = !1;
2042
- return {
2043
- s: function() {
2044
- r = r.call(t);
2045
- },
2046
- n: function() {
2047
- var t = r.next();
2048
- return a = t.done, t;
2049
- },
2050
- e: function(t) {
2051
- u = !0, i = t;
2052
- },
2053
- f: function() {
2054
- try {
2055
- a || null == r.return || r.return();
2056
- } finally {
2057
- if (u) throw i;
2058
- }
2059
- }
2060
- };
2061
- }
2062
- function tr(t, e) {
2063
- (null == e || e > t.length) && (e = t.length);
2064
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2065
- return n;
2066
- }
2067
- // ./src/oscillators/volumeOscillator.js
2068
- function er(t) {
2069
- return er = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
2070
- return typeof t;
2071
- } : function(t) {
2072
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2073
- }, er(t);
2074
- }
2075
- function rr(t, e, r) {
2076
- return (e = function(t) {
2077
- var e = function(t, e) {
2078
- if ("object" != er(t) || !t) return t;
2079
- var r = t[Symbol.toPrimitive];
2080
- if (void 0 !== r) {
2081
- var n = r.call(t, e || "default");
2082
- if ("object" != er(n)) return n;
2083
- throw new TypeError("@@toPrimitive must return a primitive value.");
2084
- }
2085
- return ("string" === e ? String : Number)(t);
2086
- }(t, "string");
2087
- return "symbol" == er(e) ? e : e + "";
2088
- }(e)) in t ? Object.defineProperty(t, e, {
2089
- value: r,
2090
- enumerable: !0,
2091
- configurable: !0,
2092
- writable: !0
2093
- }) : t[e] = r, t;
2094
- }
2095
- // ./src/utilities/dateUtilities.js
2096
- function nr(t) {
2097
- return nr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
2098
- return typeof t;
2099
- } : function(t) {
2100
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2101
- }, nr(t);
2102
- }
2103
- var or = {
2104
- string: function(t) {
2105
- return t.toISOString();
2106
- },
2107
- milliseconds: function(t) {
2108
- return t.getTime();
2109
- },
2110
- seconds: function(t) {
2111
- return t.getTime() / 1e3;
2112
- },
2113
- object: function(t) {
2114
- return t;
2115
- }
2116
- }, ir = {
2117
- dateObject: function(t) {
2118
- return t;
2119
- },
2120
- dateMilliseconds: function(t) {
2121
- return new Date(t);
2122
- },
2123
- dateSeconds: function(t) {
2124
- return new Date(1e3 * t);
2125
- },
2126
- dateIncompleteDayString: function(t) {
2127
- return new Date("".concat(t, " 00:00:00"));
2128
- },
2129
- dateCompleteDateString: function(t) {
2130
- return new Date(t);
2131
- }
2132
- }, ar = function(t) {
2133
- // Regex for a UTC Time Format where the string ends with "Z".
2134
- var e = [ "Date -> object", "Milliseconds Timestamp -> integer", "Seconds Timestamp -> integer", "UTC Time Format (ISO 8601) -> string", "Including a Timezone Offset (ISO 8601) -> string", "Local Time Format (ISO 8601) -> string", "YYYY/MM/DD or YYYY-MM-DD -> string" ], r = function() {
2135
- throw new Error('Invalid "'.concat(nr(t), '" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")));
2136
- };
2137
- // Regex for a Timezone Offset Format,
2138
- // which includes a plus or minus sign followed by HH:MM at the end.
2139
- if ("object" === nr(t)) {
2140
- if (t instanceof Date && !isNaN(t.valueOf())) return "dateObject";
2141
- r();
2142
- } else {
2143
- if ("number" == typeof t)
2144
- // Use a numeric threshold based on the absolute value: typically,
2145
- // if the absolute value is below 1e11, then it's a seconds timestamp.
2146
- // Otherwise, it's a milliseconds timestamp.
2147
- return Math.abs(t) < 1e11 ? "dateSeconds" : "dateMillseconds";
2148
- if ("string" == typeof t) {
2149
- if (/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t) || /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t) || /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t) && t.length > 10 || /^\d{4}\/\d{2}\/\d{2}$/.test(t)) return "dateCompleteDateString";
2150
- if (/^\d{4}-\d{2}-\d{2}$/.test(t)) return "dateIncompleteDayString";
2151
- r();
2152
- } else r();
2153
- }
2154
- };
2155
- // ./src/utilities/assignTypes.js
2156
- function ur(t, e) {
2157
- return function(t) {
2158
- if (Array.isArray(t)) return t;
2159
- }(t) || function(t, e) {
2160
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2161
- if (null != r) {
2162
- var n, o, i, a, u = [], l = !0, c = !1;
2163
- try {
2164
- if (i = (r = r.call(t)).next, 0 === e) {
2165
- if (Object(r) !== r) return;
2166
- l = !1;
2167
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2168
- } catch (t) {
2169
- c = !0, o = t;
2170
- } finally {
2171
- try {
2172
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2173
- } finally {
2174
- if (c) throw o;
2175
- }
2176
- }
2177
- return u;
2178
- }
2179
- }(t, e) || function(t, e) {
2180
- if (t) {
2181
- if ("string" == typeof t) return lr(t, e);
2182
- var r = {}.toString.call(t).slice(8, -1);
2183
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? lr(t, e) : void 0;
2184
- }
2185
- }(t, e) || function() {
2186
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2187
- }();
2188
- }
2189
- function lr(t, e) {
2190
- (null == e || e > t.length) && (e = t.length);
2191
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2192
- return n;
2193
- }
2194
- var cr = new Set([ "open", "high", "low", "close" ]), sr = function(t, e) {
2195
- return "Array" === t ? new Array(e).fill(null) : "Float64Array" === t ? new Float64Array(e).fill(NaN) : "Int32Array" === t ? new Int32Array(e).fill(NaN) : void 0;
2196
- };
2197
- // ./src/studies/lag.js
2198
- function fr(t, e) {
2199
- return function(t) {
2200
- if (Array.isArray(t)) return t;
2201
- }(t) || function(t, e) {
2202
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2203
- if (null != r) {
2204
- var n, o, i, a, u = [], l = !0, c = !1;
2205
- try {
2206
- if (i = (r = r.call(t)).next, 0 === e) {
2207
- if (Object(r) !== r) return;
2208
- l = !1;
2209
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2210
- } catch (t) {
2211
- c = !0, o = t;
2212
- } finally {
2213
- try {
2214
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2215
- } finally {
2216
- if (c) throw o;
2217
- }
2218
- }
2219
- return u;
2220
- }
2221
- }(t, e) || pr(t, e) || function() {
2222
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2223
- }();
2224
- }
2225
- function yr(t, e) {
2226
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2227
- if (!r) {
2228
- if (Array.isArray(t) || (r = pr(t)) || e && t && "number" == typeof t.length) {
2229
- r && (t = r);
2230
- var n = 0, o = function() {};
2231
- return {
2232
- s: o,
2233
- n: function() {
2234
- return n >= t.length ? {
2235
- done: !0
2236
- } : {
2237
- done: !1,
2238
- value: t[n++]
2239
- };
2240
- },
2241
- e: function(t) {
2242
- throw t;
2243
- },
2244
- f: o
2245
- };
2246
- }
2247
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2248
- }
2249
- var i, a = !0, u = !1;
2250
- return {
2251
- s: function() {
2252
- r = r.call(t);
2253
- },
2254
- n: function() {
2255
- var t = r.next();
2256
- return a = t.done, t;
2257
- },
2258
- e: function(t) {
2259
- u = !0, i = t;
2260
- },
2261
- f: function() {
2262
- try {
2263
- a || null == r.return || r.return();
2264
- } finally {
2265
- if (u) throw i;
2266
- }
2267
- }
2268
- };
2269
- }
2270
- function pr(t, e) {
2271
- if (t) {
2272
- if ("string" == typeof t) return hr(t, e);
2273
- var r = {}.toString.call(t).slice(8, -1);
2274
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? hr(t, e) : void 0;
2275
- }
2276
- }
2277
- function hr(t, e) {
2278
- (null == e || e > t.length) && (e = t.length);
2279
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2280
- return n;
2281
- }
2282
- var vr = function(t, e) {
2283
- var r = t.instances, n = t.verticalOhlcv, o = t.len, i = t.arrayTypes, a = t.priceBased;
2284
- if (0 === e) {
2285
- var u, l = [], c = yr(t.inputParams);
2286
- try {
2287
- for (c.s(); !(u = c.n()).done; ) {
2288
- var s = u.value;
2289
- "lag" === s.key && l.push(s.params);
2290
- }
2291
- } catch (t) {
2292
- c.e(t);
2293
- } finally {
2294
- c.f();
2295
- }
2296
- for (var f = 0, y = l; f < y.length; f++) {
2297
- var p, h = fr(y[f], 2), v = h[0], m = h[1], d = yr(v);
2298
- try {
2299
- for (d.s(); !(p = d.n()).done; ) {
2300
- var b = p.value;
2301
- if (a.has(b)) for (var g = 1; g <= m; g++) a.add("".concat(b, "_lag_").concat(g));
2302
- }
2303
- } catch (t) {
2304
- d.e(t);
2305
- } finally {
2306
- d.f();
2307
- }
2308
- }
2309
- r.lag = {
2310
- lagParams: l
2311
- };
2312
- }
2313
- var w, O = yr(r.lag.lagParams);
2314
- try {
2315
- for (O.s(); !(w = O.n()).done; ) {
2316
- var S, j = fr(w.value, 2), P = j[0], _ = j[1], N = yr(P);
2317
- try {
2318
- for (N.s(); !(S = N.n()).done; ) {
2319
- var T = S.value, A = n[T];
2320
- // Initialize lagged arrays only on the first index
2321
- if (0 === e) for (var E = 1; E <= _; E++) {
2322
- var k = "".concat(T, "_lag_").concat(E);
2323
- if (!i.hasOwnProperty(T)) throw new Error('Lag processing invoked by "'.concat(T, '" expected arrayTypes to have a "').concat(T, '" property, but it wasn’t found.'));
2324
- n[k] = sr(i[T], o), i[k] = i[T];
2325
- }
2326
- // Populate lagged values
2327
- for (var x = 1; x <= _; x++) {
2328
- var I = "".concat(T, "_lag_").concat(x), D = e - x, M = D <= 0 || void 0 === A[D] ? null : A[D];
2329
- t.pushToMain({
2330
- index: e,
2331
- key: I,
2332
- value: M
2333
- });
2334
- }
2335
- }
2336
- } catch (t) {
2337
- N.e(t);
2338
- } finally {
2339
- N.f();
2340
- }
2341
- }
2342
- } catch (t) {
2343
- O.e(t);
2344
- } finally {
2345
- O.f();
2346
- }
2347
- return !0;
2348
- };
2349
- // ./src/studies/findCrosses.js
2350
- function mr(t, e) {
2351
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2352
- if (!r) {
2353
- if (Array.isArray(t) || (r = function(t, e) {
2354
- if (t) {
2355
- if ("string" == typeof t) return dr(t, e);
2356
- var r = {}.toString.call(t).slice(8, -1);
2357
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? dr(t, e) : void 0;
2358
- }
2359
- }(t)) || e && t && "number" == typeof t.length) {
2360
- r && (t = r);
2361
- var n = 0, o = function() {};
2362
- return {
2363
- s: o,
2364
- n: function() {
2365
- return n >= t.length ? {
2366
- done: !0
2367
- } : {
2368
- done: !1,
2369
- value: t[n++]
2370
- };
2371
- },
2372
- e: function(t) {
2373
- throw t;
2374
- },
2375
- f: o
2376
- };
2377
- }
2378
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2379
- }
2380
- var i, a = !0, u = !1;
2381
- return {
2382
- s: function() {
2383
- r = r.call(t);
2384
- },
2385
- n: function() {
2386
- var t = r.next();
2387
- return a = t.done, t;
2388
- },
2389
- e: function(t) {
2390
- u = !0, i = t;
2391
- },
2392
- f: function() {
2393
- try {
2394
- a || null == r.return || r.return();
2395
- } finally {
2396
- if (u) throw i;
2397
- }
2398
- }
2399
- };
2400
- }
2401
- function dr(t, e) {
2402
- (null == e || e > t.length) && (e = t.length);
2403
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2404
- return n;
2405
- }
2406
- function br(t) {
2407
- return br = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
2408
- return typeof t;
2409
- } : function(t) {
2410
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2411
- }, br(t);
2412
- }
2413
- function gr(t, e) {
2414
- for (var r = 0; r < e.length; r++) {
2415
- var n = e[r];
2416
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
2417
- Object.defineProperty(t, wr(n.key), n);
2418
- }
2419
- }
2420
- function wr(t) {
2421
- var e = function(t, e) {
2422
- if ("object" != br(t) || !t) return t;
2423
- var r = t[Symbol.toPrimitive];
2424
- if (void 0 !== r) {
2425
- var n = r.call(t, e || "default");
2426
- if ("object" != br(n)) return n;
2427
- throw new TypeError("@@toPrimitive must return a primitive value.");
2428
- }
2429
- return ("string" === e ? String : Number)(t);
2430
- }(t, "string");
2431
- return "symbol" == br(e) ? e : e + "";
2432
- }
2433
- var Or = function(t, e) {
2434
- return t > e;
2435
- }, Sr = function(t, e) {
2436
- return t < e;
2437
- }, jr = function() {
2438
- return t = function t() {
2439
- !function(t, e) {
2440
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
2441
- }(this, t), Object.assign(this, {
2442
- interval: 0,
2443
- prevState: .5,
2444
- prevFast: NaN,
2445
- prevSlow: NaN,
2446
- prevHigh: NaN,
2447
- prevLow: NaN,
2448
- areHighAndLowUndefined: !1,
2449
- crossIndexes: {
2450
- up: [],
2451
- down: []
2452
- }
2453
- });
2454
- }, (e = [ {
2455
- key: "update",
2456
- value: function(t, e) {
2457
- var r = e.fast, n = e.high, o = e.slow, i = e.low, a = this.prevState;
2458
- this.areHighAndLowUndefined || void 0 !== n && void 0 !== i || (this.areHighAndLowUndefined = !0),
2459
- Number.isNaN(r) || Number.isNaN(o) || function(t, e) {
2460
- return t === e;
2461
- }(r, o) ? a = .5 : Or(r, o) ? a = this.areHighAndLowUndefined ? 1 : [ i, o, this.prevLow, this.prevSlow ].every((function(t) {
2462
- return !Number.isNaN(t);
2463
- })) && Sr(i, o) && Or(this.prevLow, this.prevSlow) ? 0 : 1 : Sr(r, o) && (a = this.areHighAndLowUndefined ? 0 : [ n, o, this.prevHigh, this.prevSlow ].every((function(t) {
2464
- return !Number.isNaN(t);
2465
- })) && Or(n, o) && Sr(this.prevHigh, this.prevSlow) ? 1 : 0), .5 === a ? this.interval = 0 : 1 === a ? this.prevState <= .5 ? this.interval = 1 : this.interval++ : 0 === a && (this.prevState >= .5 ? this.interval = -1 : this.interval--),
2466
- 1 === this.interval && this.crossIndexes.up.push(t), -1 === this.interval && this.crossIndexes.down.push(t),
2467
- //save prev state
2468
- Object.assign(this, {
2469
- prevState: a,
2470
- prevFast: r,
2471
- prevSlow: o,
2472
- prevHigh: n,
2473
- prevLow: i
2474
- });
2475
- }
2476
- }, {
2477
- key: "getResult",
2478
- value: function() {
2479
- return this.interval;
2480
- }
2481
- } ]) && gr(t.prototype, e), r && gr(t, r), Object.defineProperty(t, "prototype", {
2482
- writable: !1
2483
- }), t;
2484
- var t, e, r;
2485
- }(), Pr = function(t, e) {
2486
- var r = t.verticalOhlcv, n = t.instances, o = t.len, i = t.arrayTypes, a = t.verticalOhlcvTempCols;
2487
- if (0 === e) {
2488
- var u = t.inputParams;
2489
- n.crossPairsList = u.reduce((function(t, e) {
2490
- var r = e.key, n = e.params;
2491
- if ("crossPairs" === r) {
2492
- var o, i = mr(n);
2493
- try {
2494
- for (i.s(); !(o = i.n()).done; ) {
2495
- var a, u = mr(o.value);
2496
- try {
2497
- for (u.s(); !(a = u.n()).done; ) {
2498
- var l = a.value;
2499
- t.push(l);
2500
- }
2501
- } catch (t) {
2502
- u.e(t);
2503
- } finally {
2504
- u.f();
2505
- }
2506
- }
2507
- } catch (t) {
2508
- i.e(t);
2509
- } finally {
2510
- i.f();
2511
- }
2512
- }
2513
- return t;
2514
- }), []);
2515
- }
2516
- var l, c = mr(n.crossPairsList);
2517
- try {
2518
- for (c.s(); !(l = c.n()).done; ) {
2519
- var s = l.value, f = s.fast, y = s.slow;
2520
- if (null != f && null != y) {
2521
- var p = "".concat(f, "_x_").concat(y);
2522
- if (0 === e) {
2523
- if ("number" == typeof y && (a.add(y.toString()), r[y.toString()] = new Int32Array(o).fill(y)),
2524
- "price" !== f && !r.hasOwnProperty(f)) throw Error('fast "'.concat(f, ' not found in crossPairs"'));
2525
- if (!r.hasOwnProperty(y)) throw Error('slow "'.concat(y, ' not found in crossPairs"'));
2526
- n[p] = new jr, r[p] = new Int32Array(o).fill(NaN), i[p] = "Int32Array";
2527
- }
2528
- var h = void 0, v = void 0, m = void 0, d = void 0, b = void 0;
2529
- "price" === f ? (v = r.close[e], m = r.high[e], d = r.low[e], b = r[y][e], n[p].update(e, {
2530
- fast: v,
2531
- slow: b,
2532
- high: m,
2533
- low: d
2534
- })) : (h = r[f][e], b = r[y][e], n[p].update(e, {
2535
- fast: h,
2536
- slow: b
2537
- })), t.pushToMain({
2538
- index: e,
2539
- key: p,
2540
- value: n[p].getResult()
2541
- });
2542
- }
2543
- }
2544
- } catch (t) {
2545
- c.e(t);
2546
- } finally {
2547
- c.f();
2548
- }
2549
- };
2550
- // ./src/studies/dateTime.js
2551
- function _r(t) {
2552
- return _r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
2553
- return typeof t;
2554
- } : function(t) {
2555
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2556
- }, _r(t);
2557
- }
2558
- function Nr(t, e) {
2559
- var r = Object.keys(t);
2560
- if (Object.getOwnPropertySymbols) {
2561
- var n = Object.getOwnPropertySymbols(t);
2562
- e && (n = n.filter((function(e) {
2563
- return Object.getOwnPropertyDescriptor(t, e).enumerable;
2564
- }))), r.push.apply(r, n);
2565
- }
2566
- return r;
2567
- }
2568
- function Tr(t, e, r) {
2569
- return (e = function(t) {
2570
- var e = function(t, e) {
2571
- if ("object" != _r(t) || !t) return t;
2572
- var r = t[Symbol.toPrimitive];
2573
- if (void 0 !== r) {
2574
- var n = r.call(t, e || "default");
2575
- if ("object" != _r(n)) return n;
2576
- throw new TypeError("@@toPrimitive must return a primitive value.");
2577
- }
2578
- return ("string" === e ? String : Number)(t);
2579
- }(t, "string");
2580
- return "symbol" == _r(e) ? e : e + "";
2581
- }(e)) in t ? Object.defineProperty(t, e, {
2582
- value: r,
2583
- enumerable: !0,
2584
- configurable: !0,
2585
- writable: !0
2586
- }) : t[e] = r, t;
2587
- }
2588
- var Ar = function(t) {
2589
- var e = t.getMonth(), r = t.getFullYear(), n = t.getHours(), o = t.getMinutes(), i = t.getDay(), a = t.getDate(), u = new Date(t.getFullYear(), t.getMonth(), 1).getDay();
2590
- return {
2591
- month: e,
2592
- year: r,
2593
- hour: n,
2594
- minute: o,
2595
- day_of_the_week: i,
2596
- day_of_the_month: a,
2597
- week_of_the_month: Math.ceil((a + u) / 7)
2598
- };
2599
- };
2600
- // ./src/studies/scaler.js
2601
- function Er(t) {
2602
- return function(t) {
2603
- if (Array.isArray(t)) return Dr(t);
2604
- }(t) || function(t) {
2605
- if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2606
- }(t) || Ir(t) || function() {
2607
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2608
- }();
2609
- }
2610
- function kr(t, e) {
2611
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2612
- if (!r) {
2613
- if (Array.isArray(t) || (r = Ir(t)) || e && t && "number" == typeof t.length) {
2614
- r && (t = r);
2615
- var n = 0, o = function() {};
2616
- return {
2617
- s: o,
2618
- n: function() {
2619
- return n >= t.length ? {
2620
- done: !0
2621
- } : {
2622
- done: !1,
2623
- value: t[n++]
2624
- };
2625
- },
2626
- e: function(t) {
2627
- throw t;
2628
- },
2629
- f: o
2630
- };
2631
- }
2632
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2633
- }
2634
- var i, a = !0, u = !1;
2635
- return {
2636
- s: function() {
2637
- r = r.call(t);
2638
- },
2639
- n: function() {
2640
- var t = r.next();
2641
- return a = t.done, t;
2642
- },
2643
- e: function(t) {
2644
- u = !0, i = t;
2645
- },
2646
- f: function() {
2647
- try {
2648
- a || null == r.return || r.return();
2649
- } finally {
2650
- if (u) throw i;
2651
- }
2652
- }
2653
- };
2654
- }
2655
- function xr(t, e) {
2656
- return function(t) {
2657
- if (Array.isArray(t)) return t;
2658
- }
2659
- /* General scaler: supports "minmax" and "zscore" types */ (t) || function(t, e) {
2660
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2661
- if (null != r) {
2662
- var n, o, i, a, u = [], l = !0, c = !1;
2663
- try {
2664
- if (i = (r = r.call(t)).next, 0 === e) {
2665
- if (Object(r) !== r) return;
2666
- l = !1;
2667
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2668
- } catch (t) {
2669
- c = !0, o = t;
2670
- } finally {
2671
- try {
2672
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2673
- } finally {
2674
- if (c) throw o;
2675
- }
2676
- }
2677
- return u;
2678
- }
2679
- }(t, e) || Ir(t, e) || function() {
2680
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2681
- }();
2682
- }
2683
- function Ir(t, e) {
2684
- if (t) {
2685
- if ("string" == typeof t) return Dr(t, e);
2686
- var r = {}.toString.call(t).slice(8, -1);
2687
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Dr(t, e) : void 0;
2688
- }
2689
- }
2690
- function Dr(t, e) {
2691
- (null == e || e > t.length) && (e = t.length);
2692
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2693
- return n;
2694
- }
2695
- // ./src/core-functions/mainLoop.js
2696
- function Mr(t) {
2697
- return function(t) {
2698
- if (Array.isArray(t)) return Lr(t);
2699
- }(t) || function(t) {
2700
- if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
2701
- }(t) || Fr(t) || function() {
2702
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2703
- }();
2704
- }
2705
- function Rr(t, e) {
2706
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2707
- if (!r) {
2708
- if (Array.isArray(t) || (r = Fr(t)) || e && t && "number" == typeof t.length) {
2709
- r && (t = r);
2710
- var n = 0, o = function() {};
2711
- return {
2712
- s: o,
2713
- n: function() {
2714
- return n >= t.length ? {
2715
- done: !0
2716
- } : {
2717
- done: !1,
2718
- value: t[n++]
2719
- };
2720
- },
2721
- e: function(t) {
2722
- throw t;
2723
- },
2724
- f: o
2725
- };
2726
- }
2727
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2728
- }
2729
- var i, a = !0, u = !1;
2730
- return {
2731
- s: function() {
2732
- r = r.call(t);
2733
- },
2734
- n: function() {
2735
- var t = r.next();
2736
- return a = t.done, t;
2737
- },
2738
- e: function(t) {
2739
- u = !0, i = t;
2740
- },
2741
- f: function() {
2742
- try {
2743
- a || null == r.return || r.return();
2744
- } finally {
2745
- if (u) throw i;
2746
- }
2747
- }
2748
- };
2749
- }
2750
- function Cr(t, e) {
2751
- return function(t) {
2752
- if (Array.isArray(t)) return t;
2753
- }
2754
- // Map indicator keys to their respective functions
2755
- (t) || function(t, e) {
2756
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
2757
- if (null != r) {
2758
- var n, o, i, a, u = [], l = !0, c = !1;
2759
- try {
2760
- if (i = (r = r.call(t)).next, 0 === e) {
2761
- if (Object(r) !== r) return;
2762
- l = !1;
2763
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
2764
- } catch (t) {
2765
- c = !0, o = t;
2766
- } finally {
2767
- try {
2768
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
2769
- } finally {
2770
- if (c) throw o;
2771
- }
2772
- }
2773
- return u;
2774
- }
2775
- }(t, e) || Fr(t, e) || function() {
2776
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2777
- }();
2778
- }
2779
- function Fr(t, e) {
2780
- if (t) {
2781
- if ("string" == typeof t) return Lr(t, e);
2782
- var r = {}.toString.call(t).slice(8, -1);
2783
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Lr(t, e) : void 0;
2784
- }
2785
- }
2786
- function Lr(t, e) {
2787
- (null == e || e > t.length) && (e = t.length);
2788
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
2789
- return n;
2790
- }
2791
- var Br = {
2792
- dateTime: function(t, e, r) {
2793
- var n = r.lag, o = t.instances, i = t.verticalOhlcv;
2794
- if (0 === e) {
2795
- var a = t.len, u = t.dateType, l = t.arrayTypes;
2796
- if (!u) throw Error('dateTime method found and invalid "date" in input ohlcv');
2797
- Object.assign(o, {
2798
- dateTime: {
2799
- prevDateStr: i.date[0],
2800
- sessionDailyIndexCount: 0,
2801
- sessionIntradayIndexCount: 0,
2802
- cachedDayInfo: i.date[0]
2803
- }
2804
- });
2805
- for (var c = [ "day_of_the_week", "day_of_the_month", "week_of_the_month", "minute", "hour", "month", "year", "session_daily_index", "session_intraday_index" ], s = 0, f = c; s < f.length; s++) {
2806
- l[f[s]] = "Int32Array";
2807
- }
2808
- Object.assign(i, function(t) {
2809
- for (var e = 1; e < arguments.length; e++) {
2810
- var r = null != arguments[e] ? arguments[e] : {};
2811
- e % 2 ? Nr(Object(r), !0).forEach((function(e) {
2812
- Tr(t, e, r[e]);
2813
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Nr(Object(r)).forEach((function(e) {
2814
- Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
2815
- }));
2816
- }
2817
- return t;
2818
- }({}, Object.fromEntries(c.map((function(t) {
2819
- return [ t, new Int32Array(a).fill(NaN) ];
2820
- }))))), n > 0 && t.lag(c, n);
2821
- }
2822
- var y = i.date[e], p = Ar(y), h = p.day_of_the_week, v = p.day_of_the_month, m = p.week_of_the_month, d = p.month, b = p.year, g = p.hour, w = p.minute, O = y;
2823
- O !== o.dateTime.prevDateStr && (o.dateTime.prevDateStr = O, o.dateTime.sessionDailyIndexCount++,
2824
- o.dateTime.sessionIntradayIndexCount = 0), t.pushToMain({
2825
- index: e,
2826
- key: "session_daily_index",
2827
- value: o.dateTime.sessionDailyIndexCount
2828
- }), t.pushToMain({
2829
- index: e,
2830
- key: "session_intraday_index",
2831
- value: o.dateTime.sessionIntradayIndexCount
2832
- }), t.pushToMain({
2833
- index: e,
2834
- key: "day_of_the_week",
2835
- value: h
2836
- }), t.pushToMain({
2837
- index: e,
2838
- key: "day_of_the_month",
2839
- value: v
2840
- }), t.pushToMain({
2841
- index: e,
2842
- key: "week_of_the_month",
2843
- value: m
2844
- }), t.pushToMain({
2845
- index: e,
2846
- key: "month",
2847
- value: d
2848
- }), t.pushToMain({
2849
- index: e,
2850
- key: "year",
2851
- value: b
2852
- }), t.pushToMain({
2853
- index: e,
2854
- key: "hour",
2855
- value: g
2856
- }), t.pushToMain({
2857
- index: e,
2858
- key: "minute",
2859
- value: w
2860
- }), o.dateTime.sessionIntradayIndexCount++;
2861
- },
2862
- rsi: function(t, e, r, n) {
2863
- var o = n.target, i = n.lag, a = t.verticalOhlcv, u = t.instances, l = "close" === o ? "" : "_".concat(o), c = "rsi_".concat(r).concat(l), s = "rsi_sma_".concat(r).concat(l);
2864
- // Initialization on the first index.
2865
- if (0 === e) {
2866
- var f = t.crossPairsList, y = t.len, p = t.arrayTypes;
2867
- if (!a.hasOwnProperty(o)) throw new Error("Target property ".concat(o, " not found in verticalOhlcv for rsi."));
2868
- f.push({
2869
- fast: c,
2870
- slow: s,
2871
- isDefault: !0
2872
- }), Object.assign(u, Me(Me({}, c, new Ie(r)), s, new ft(r))), Object.assign(a, Me(Me({}, c, new Float64Array(y).fill(NaN)), s, new Float64Array(y).fill(NaN)));
2873
- var h = [ c, s ];
2874
- i > 0 && t.lag(h, i);
2875
- for (var v = 0, m = h; v < m.length; v++) {
2876
- p[m[v]] = "Float64Array";
2877
- }
2878
- }
2879
- var d = a[o][e], b = NaN, g = NaN;
2880
- // Update the RSI indicator.
2881
- u[c].update(d);
2882
- try {
2883
- b = u[c].getResult();
2884
- } catch (t) {
2885
- b = NaN;
2886
- }
2887
- // Always push the RSI value, using NaN as a fallback.
2888
- t.pushToMain({
2889
- index: e,
2890
- key: c,
2891
- value: b
2892
- }),
2893
- // Update the SMA indicator only if a valid RSI value is available.
2894
- Number.isNaN(b) || u[s].update(b);
2895
- try {
2896
- g = u[s].getResult();
2897
- } catch (t) {
2898
- g = NaN;
2899
- }
2900
- // Always push the smoothed RSI value.
2901
- t.pushToMain({
2902
- index: e,
2903
- key: s,
2904
- value: g
2905
- });
2906
- },
2907
- atr: function(t, e, r, n) {
2908
- var o = n.lag, i = n.type, a = t.verticalOhlcv, u = t.instances, l = "percentage" === i ? "atr_".concat(r, "_percentage") : "atr_".concat(r);
2909
- if (0 === e) {
2910
- var c = t.instances, s = t.verticalOhlcv, f = t.arrayTypes, y = t.len, p = t.priceBased;
2911
- c[l] = new Yt(r, jt), "price" === i && p.add(l), s[l] = new Float64Array(y).fill(NaN),
2912
- f[l] = "Float64Array", o > 0 && t.lag([ l ], o);
2913
- }
2914
- // Retrieve the current price value.
2915
- var h = {
2916
- high: a.high[e],
2917
- low: a.low[e],
2918
- close: a.close[e]
2919
- }, v = u[l];
2920
- // Update the moving average instance.
2921
- v.update(h);
2922
- var m = NaN;
2923
- try {
2924
- m = v.getResult();
2925
- } catch (t) {}
2926
- return "percentage" === i && (m = Number.isNaN(m) ? NaN : m / h.close),
2927
- // Always push the MA value (even if NaN).
2928
- t.pushToMain({
2929
- index: e,
2930
- key: l,
2931
- value: m
2932
- }), !0;
2933
- },
2934
- ema: Ce,
2935
- sma: Ce,
2936
- macd: function(t, e, r, n, o, i) {
2937
- var a = i.target, u = i.lag, l = i.precomputed, c = t.verticalOhlcv, s = t.instances, f = l.instanceKey;
2938
- // Initialization on the first index.
2939
- if (0 === e) {
2940
- var y = t.inputParams, p = t.crossPairsList, h = t.priceBased, v = t.len, m = t.arrayTypes;
2941
- if (!c.hasOwnProperty(a)) throw new Error("Target property ".concat(a, " not found in verticalOhlcv for macd."));
2942
- var d, b = 0, g = He(y);
2943
- try {
2944
- for (g.s(); !(d = g.n()).done; ) {
2945
- "macd" === d.value.key && b++;
2946
- }
2947
- // Choose a display prefix based on the number of indicators.
2948
- } catch (t) {
2949
- g.e(t);
2950
- } finally {
2951
- g.f();
2952
- }
2953
- var w = b > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", O = a === Ue ? "".concat(w, "_diff") : "".concat(w, "_diff_").concat(a), S = a === Ue ? "".concat(w, "_dea") : "".concat(w, "_dea_").concat(a), j = a === Ue ? "".concat(w, "_histogram") : "".concat(w, "_histogram_").concat(a);
2954
- // Build the keys.
2955
- p.push({
2956
- fast: O,
2957
- slow: S,
2958
- isDefault: !0
2959
- }), s.hasOwnProperty("macd") || (s.macd = {
2960
- numberOfIndicators: b,
2961
- settings: {}
2962
- }), s.macd.settings[f] = new we(new pe(r), new pe(n), new pe(o)), Object.assign(c, Be(Be(Be({}, O, new Float64Array(v).fill(NaN)), S, new Float64Array(v).fill(NaN)), j, new Float64Array(v).fill(NaN)))[j].forEach((function(t) {
2963
- h.add(t);
2964
- }));
2965
- var P = [ O, S, j ];
2966
- u > 0 && t.lag(P, u);
2967
- for (var _ = 0, N = P; _ < N.length; _++) {
2968
- m[N[_]] = "Float64Array";
2969
- }
2970
- }
2971
- var T = s.macd, A = T.numberOfIndicators, E = T.settings, k = A > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", x = a === Ue ? "".concat(k, "_diff") : "".concat(k, "_diff_").concat(a), I = a === Ue ? "".concat(k, "_dea") : "".concat(k, "_dea_").concat(a), D = a === Ue ? "".concat(k, "_histogram") : "".concat(k, "_histogram_").concat(a), M = E[f], R = c[a][e];
2972
- M.update(R);
2973
- var C = {};
2974
- try {
2975
- C = M.getResult();
2976
- } catch (t) {
2977
- // If the result is unavailable, macdResult remains NaN.
2978
- }
2979
- // Always push values; use NaN as fallback when macdResult is missing.
2980
- return t.pushToMain({
2981
- index: e,
2982
- key: x,
2983
- value: C ? C.macd : NaN
2984
- }), t.pushToMain({
2985
- index: e,
2986
- key: I,
2987
- value: C ? C.signal : NaN
2988
- }), t.pushToMain({
2989
- index: e,
2990
- key: D,
2991
- value: C ? C.histogram : NaN
2992
- }), !0;
2993
- },
2994
- relativeVolume: function(t, e, r, n) {
2995
- var o = n.lag, i = "relative_volume_".concat(r), a = t.instances, u = t.verticalOhlcv;
2996
- if (0 === e) {
2997
- var l = t.len, c = t.arrayTypes;
2998
- a[i] = {
2999
- instance: new ft(r),
3000
- prevRelativeVolumeSma: NaN
3001
- }, u[i] = new Float64Array(l).fill(NaN), o > 0 && t.lag([ i ], o), c[i] = "Float64Array";
3002
- }
3003
- var s = u.volume[e], f = a[i].instance;
3004
- f.update(s);
3005
- var y = NaN;
3006
- try {
3007
- y = f.getResult();
3008
- } catch (t) {}
3009
- var p = a[i].prevRelativeVolumeSma, h = NaN;
3010
- // Only calculate relative volume if both current SMA and previous SMA are valid numbers and prevSma is not zero.
3011
- return Number.isNaN(y) || Number.isNaN(p) || (h = s / p), t.pushToMain({
3012
- index: e,
3013
- key: i,
3014
- value: h
3015
- }), a[i].prevRelativeVolumeSma = y, !0;
3016
- },
3017
- donchianChannels: function(t, e, r, n, o) {
3018
- var i = t.verticalOhlcv, a = t.instances, u = t.len, l = t.inputParams, c = t.priceBased, s = t.arrayTypes, f = t.lag, y = o.height, p = o.range, h = o.decimals, v = "".concat(r, "_").concat(n);
3019
- // ---- INIT (only at first bar) ----
3020
- if (0 === e) {
3021
- // how many donchianChannels calls in this session?
3022
- var m = l.filter((function(t) {
3023
- return "donchianChannels" === t.key;
3024
- })).length, d = "donchian_channel", b = m > 1 ? "".concat(d, "_").concat(v) : d, g = [ "upper", "basis", "lower" ].map((function(t) {
3025
- return "".concat(b, "_").concat(t);
3026
- }));
3027
- y && g.push("".concat(b, "_height"));
3028
- var w, O = function(t, e) {
3029
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3030
- if (!r) {
3031
- if (Array.isArray(t) || (r = Ye(t)) || e && t && "number" == typeof t.length) {
3032
- r && (t = r);
3033
- var n = 0, o = function() {};
3034
- return {
3035
- s: o,
3036
- n: function() {
3037
- return n >= t.length ? {
3038
- done: !0
3039
- } : {
3040
- done: !1,
3041
- value: t[n++]
3042
- };
3043
- },
3044
- e: function(t) {
3045
- throw t;
3046
- },
3047
- f: o
3048
- };
3049
- }
3050
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3051
- }
3052
- var i, a = !0, u = !1;
3053
- return {
3054
- s: function() {
3055
- r = r.call(t);
3056
- },
3057
- n: function() {
3058
- var t = r.next();
3059
- return a = t.done, t;
3060
- },
3061
- e: function(t) {
3062
- u = !0, i = t;
3063
- },
3064
- f: function() {
3065
- try {
3066
- a || null == r.return || r.return();
3067
- } finally {
3068
- if (u) throw i;
3069
- }
3070
- }
3071
- };
3072
- }(p);
3073
- try {
3074
- for (O.s(); !(w = O.n()).done; ) {
3075
- var S = w.value;
3076
- if (!(S in i) || !c.has(S)) throw new Error('Invalid range key "'.concat(S, '". Only price-based keys are allowed: ').concat(Ke(c)));
3077
- g.push("".concat(b, "_range_").concat(S));
3078
- }
3079
- // bootstrap instance
3080
- } catch (t) {
3081
- O.e(t);
3082
- } finally {
3083
- O.f();
3084
- }
3085
- a.donchian_channel || (a.donchian_channel = {
3086
- numberOfIndicators: m,
3087
- settings: {}
3088
- }), a.donchian_channel.numberOfIndicators = m, a.donchian_channel.settings[v] = {
3089
- maxDeque: [],
3090
- minDeque: []
3091
- },
3092
- // allocate & fill NaNs
3093
- Object.assign(i, Object.fromEntries(g.map((function(t) {
3094
- return [ t, new Float64Array(u).fill(NaN) ];
3095
- })))),
3096
- // apply lag if requested
3097
- f > 0 && t.lag(g, f),
3098
- // mark price-based outputs
3099
- [ "upper", "basis", "lower" ].forEach((function(t) {
3100
- return c.add("".concat(b, "_").concat(t));
3101
- })), g.forEach((function(t) {
3102
- return s[t] = "Float64Array";
3103
- }));
3104
- }
3105
- // ---- PER-BAR COMPUTATION ----
3106
- var j = a.donchian_channel, P = j.numberOfIndicators, _ = j.settings, N = P > 1 ? "donchian_channel_".concat(v) : "donchian_channel", T = _[v], A = T.maxDeque, E = T.minDeque, k = e - n, x = k - r + 1, I = [ "upper", "basis", "lower" ].map((function(t) {
3107
- return "".concat(N, "_").concat(t);
3108
- }));
3109
- y && I.push("".concat(N, "_height"));
3110
- var D = p.map((function(t) {
3111
- return "".concat(N, "_range_").concat(t);
3112
- }));
3113
- // not enough data → push NaNs
3114
- if (x < 0 || k + 1 > u) return [].concat(Ke(I), Ke(D)).forEach((function(r) {
3115
- return t.pushToMain({
3116
- index: e,
3117
- key: r,
3118
- value: NaN
3119
- });
3120
- })), !0;
3121
- var M = i.high, R = i.low, C = function(t, e, r) {
3122
- for (;t.length && t[0] < x; ) t.shift();
3123
- for (;t.length && r(e[t.at(-1)], e[k]); ) t.pop();
3124
- t.push(k);
3125
- };
3126
- // tiny helper to keep deques up-to-date
3127
- C(A, M, (function(t, e) {
3128
- return t <= e;
3129
- })), C(E, R, (function(t, e) {
3130
- return t >= e;
3131
- }));
3132
- // single “bounds exist?” flag instead of repeated isNaN
3133
- var F = A.length && E.length, L = F ? M[A[0]] : NaN, B = F ? R[E[0]] : NaN, H = F ? (L + B) / 2 : NaN;
3134
- if (t.pushToMain({
3135
- index: e,
3136
- key: "".concat(N, "_upper"),
3137
- value: L
3138
- }), t.pushToMain({
3139
- index: e,
3140
- key: "".concat(N, "_basis"),
3141
- value: H
3142
- }), t.pushToMain({
3143
- index: e,
3144
- key: "".concat(N, "_lower"),
3145
- value: B
3146
- }), y) {
3147
- // avoid divide-by-zero
3148
- var V = F && B ? (L - B) / B : NaN;
3149
- t.pushToMain({
3150
- index: e,
3151
- key: "".concat(N, "_height"),
3152
- value: null === h ? V : Ge(V, h)
3153
- });
3154
- }
3155
- // precompute spread once
3156
- // for each extra range key, use price===price to skip NaNs
3157
- for (var U = F ? L - B : NaN, $ = 0; $ < p.length; $++) {
3158
- var q = i[p[$]][e], z = F && q == q && U ? (q - B) / U : NaN;
3159
- t.pushToMain({
3160
- index: e,
3161
- key: D[$],
3162
- value: null === h ? z : Ge(z, h)
3163
- });
3164
- }
3165
- return !0;
3166
- },
3167
- bollingerBands: function(t, e, r, n, o) {
3168
- var i, a, u, l, c, s, f, y = o.height, p = o.range, h = void 0 === p ? [] : p, v = o.target, m = o.lag, d = o.decimals, b = t.verticalOhlcv, g = t.instances, w = "close" === v ? "" : "_".concat(v), O = "".concat(r, "_").concat(n).concat(w);
3169
- // Initialization on the first call.
3170
- if (0 === e) {
3171
- var S = t.priceBased, j = t.inputParams, P = t.verticalOhlcv, _ = t.len, N = t.arrayTypes;
3172
- if (!(v in P)) throw new Error('bollingerBands could not find target "'.concat(v, '"'));
3173
- var T, A = 0, E = Xe(j);
3174
- try {
3175
- for (E.s(); !(T = E.n()).done; ) {
3176
- "bollingerBands" === T.value.key && A++;
3177
- }
3178
- } catch (t) {
3179
- E.e(t);
3180
- } finally {
3181
- E.f();
3182
- }
3183
- f = A > 1 ? "bollinger_bands_".concat(O) : "bollinger_bands".concat(w),
3184
- // Only create the container if it doesn't already exist.
3185
- g.bollinger_bands || (g.bollinger_bands = {
3186
- numberOfIndicators: A,
3187
- settings: {}
3188
- }),
3189
- // Add (or override) the indicator instance keyed by indicatorKey.
3190
- g.bollinger_bands.settings[O] = new ee(r, n);
3191
- var k = [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ];
3192
- y && k.push("".concat(f, "_height"));
3193
- // Set up additional arrays for each range property.
3194
- var x, I = Xe(h);
3195
- try {
3196
- for (I.s(); !(x = I.n()).done; ) {
3197
- var D = x.value;
3198
- if (!(D in P) || !S.has(D)) throw new Error('Invalid range item value "'.concat(D, '" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(S)));
3199
- k.push("".concat(f, "_range_").concat(D));
3200
- }
3201
- } catch (t) {
3202
- I.e(t);
3203
- } finally {
3204
- I.f();
3205
- }
3206
- var M = Object.fromEntries(k.map((function(t) {
3207
- return [ t, new Float64Array(_).fill(NaN) ];
3208
- })));
3209
- Object.assign(P, function(t) {
3210
- for (var e = 1; e < arguments.length; e++) {
3211
- var r = null != arguments[e] ? arguments[e] : {};
3212
- e % 2 ? Qe(Object(r), !0).forEach((function(e) {
3213
- We(t, e, r[e]);
3214
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Qe(Object(r)).forEach((function(e) {
3215
- Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
3216
- }));
3217
- }
3218
- return t;
3219
- }({}, M)), m > 0 && t.lag(k, m), [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ].forEach((function(t) {
3220
- S.add(t);
3221
- }));
3222
- for (var R = 0, C = k; R < C.length; R++) {
3223
- N[C[R]] = "Float64Array";
3224
- }
3225
- }
3226
- // Derive prefix for subsequent calls if not set.
3227
- f || (f = g.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(O) : "bollinger_bands".concat(w));
3228
- var F = f, L = g.bollinger_bands.settings[O], B = b[v][e];
3229
- // Update the indicator with the current value.
3230
- L.update(B);
3231
- // Attempt to retrieve the result.
3232
- var H = {};
3233
- try {
3234
- H = L.getResult();
3235
- } catch (t) {
3236
- // If not available, result stays {}.
3237
- }
3238
- // Use NaN fallbacks for the primary values.
3239
- var V = null !== (i = null === (a = H) || void 0 === a ? void 0 : a.upper) && void 0 !== i ? i : NaN, U = null !== (u = null === (l = H) || void 0 === l ? void 0 : l.middle) && void 0 !== u ? u : NaN, $ = null !== (c = null === (s = H) || void 0 === s ? void 0 : s.lower) && void 0 !== c ? c : NaN;
3240
- // Process height if requested.
3241
- if (
3242
- // Always push the indicator outputs.
3243
- t.pushToMain({
3244
- index: e,
3245
- key: "".concat(F, "_upper"),
3246
- value: V
3247
- }), t.pushToMain({
3248
- index: e,
3249
- key: "".concat(F, "_middle"),
3250
- value: U
3251
- }), t.pushToMain({
3252
- index: e,
3253
- key: "".concat(F, "_lower"),
3254
- value: $
3255
- }), y) {
3256
- var q = NaN;
3257
- Number.isNaN($) || Number.isNaN(V) || (q = (V - $) / $), t.pushToMain({
3258
- index: e,
3259
- key: "".concat(F, "_height"),
3260
- value: null === d ? q : Ge(q, d)
3261
- });
3262
- }
3263
- // Process each range property.
3264
- var z, G = Xe(h);
3265
- try {
3266
- for (G.s(); !(z = G.n()).done; ) {
3267
- var K = z.value, Y = NaN, J = b[K][e];
3268
- Number.isNaN(J) || Number.isNaN($) || Number.isNaN(V) || (Y = (J - $) / (V - $)),
3269
- t.pushToMain({
3270
- index: e,
3271
- key: "".concat(F, "_range_").concat(K),
3272
- value: null === d ? Y : Ge(Y, d)
3273
- });
3274
- }
3275
- } catch (t) {
3276
- G.e(t);
3277
- } finally {
3278
- G.f();
3279
- }
3280
- return !0;
3281
- },
3282
- volumeOscillator: function(t, e, r, n, o) {
3283
- var i = o.lag, a = t.verticalOhlcv, u = t.instances, l = a.volume[e], c = "volume_oscillator_".concat(r, "_").concat(n);
3284
- if (0 === e) {
3285
- var s = t.crossPairsList, f = t.len, y = t.arrayTypes;
3286
- Object.assign(u, rr({}, c, {
3287
- fastEMA: new pe(r),
3288
- slowEMA: new pe(n)
3289
- })), a[c] = new Float64Array(f).fill(NaN), s.push({
3290
- fast: c,
3291
- slow: 0,
3292
- isDefault: !0
3293
- }), i > 0 && t.lag([ c ], i), y[c] = "Float64Array";
3294
- }
3295
- var p = u[c], h = p.fastEMA, v = p.slowEMA;
3296
- h.update(l), v.update(l);
3297
- var m = NaN, d = NaN;
3298
- try {
3299
- m = h.getResult();
3300
- } catch (t) {}
3301
- try {
3302
- d = v.getResult();
3303
- } catch (t) {}
3304
- var b = NaN;
3305
- return Number.isNaN(m) || Number.isNaN(d) || (b = 100 * (m - d) / d), t.pushToMain({
3306
- index: e,
3307
- key: c,
3308
- value: b
3309
- }), !0;
3310
- },
3311
- scaler: function(t, e, r, n, o) {
3312
- var i = o.type, a = o.group, u = o.range, l = o.lag, c = o.precomputed, s = o.decimals, f = c.groupKey, y = c.groupKeyLen, p = t.verticalOhlcv, h = t.instances, v = t.arrayTypes, m = "".concat(i, "_").concat(r);
3313
- if (0 === e) {
3314
- var d = t.len;
3315
- h.hasOwnProperty("scaler") || (h.scaler = {
3316
- windows: {}
3317
- });
3318
- var b, g = kr(n);
3319
- try {
3320
- var w = function() {
3321
- var e = b.value;
3322
- if (!p.hasOwnProperty(e)) throw new Error('Target property "'.concat(e, '" not found in verticalOhlcv'));
3323
- var r = "".concat(m, "_").concat(e);
3324
- p[r] = new Float64Array(d).fill(NaN), v[r] = "Float64Array";
3325
- var n = a ? f : e;
3326
- if (h.scaler.windows[n] = [], a && (t.scaledGroups[f] || (t.scaledGroups[f] = []),
3327
- t.scaledGroups[f].push(r)), l > 0) {
3328
- if (a) {
3329
- var o, i = Array.from({
3330
- length: l
3331
- }).map((function(t, e) {
3332
- return "".concat(r, "_lag_").concat(e + 1);
3333
- }));
3334
- (o = t.scaledGroups[f]).push.apply(o, Er(i));
3335
- }
3336
- t.lag([ r ], l);
3337
- }
3338
- };
3339
- for (g.s(); !(b = g.n()).done; ) w();
3340
- } catch (t) {
3341
- g.e(t);
3342
- } finally {
3343
- g.f();
3344
- }
3345
- }
3346
- var O, S = h.scaler.windows, j = kr(n);
3347
- // update windows with current values
3348
- try {
3349
- for (j.s(); !(O = j.n()).done; ) {
3350
- var P = O.value, _ = p[P][e], N = S[a ? f : P];
3351
- N.push(_), N.length > (a ? r * y : r) && N.shift();
3352
- }
3353
- } catch (t) {
3354
- j.e(t);
3355
- } finally {
3356
- j.f();
3357
- }
3358
- var T, A = e + 1 >= r, E = kr(n);
3359
- // scale values once enough data
3360
- try {
3361
- var k = function() {
3362
- var r, n, o, l, c, y, h = T.value, v = p[h][e], d = "".concat(m, "_").concat(h), b = null;
3363
- if (A) {
3364
- var g = S[a ? f : h];
3365
- if ("minmax" === i) {
3366
- var w = Math.min.apply(Math, Er(g)), O = Math.max.apply(Math, Er(g));
3367
- r = v, n = w, o = O, l = xr(u, 2), c = l[0], y = l[1], b = (Math.min(Math.max(r, n), o) - n) / (o - n) * (y - c) + c;
3368
- } else {
3369
- if ("zscore" !== i) throw new Error('Unknown scaler type "'.concat(i, '"'));
3370
- var j = g.reduce((function(t, e) {
3371
- return t + e;
3372
- }), 0) / g.length, P = g.reduce((function(t, e) {
3373
- return t + Math.pow(e - j, 2);
3374
- }), 0) / g.length, _ = Math.sqrt(P);
3375
- b = function(t, e, r) {
3376
- return 0 === r ? 0 : (t - e) / r;
3377
- }(v, j, _);
3378
- }
3379
- }
3380
- t.pushToMain({
3381
- index: e,
3382
- key: d,
3383
- value: null === s ? b : Ge(b, s)
3384
- });
3385
- };
3386
- for (E.s(); !(T = E.n()).done; ) k();
3387
- } catch (t) {
3388
- E.e(t);
3389
- } finally {
3390
- E.f();
3391
- }
3392
- }
3393
- }, Hr = function(t, e) {
3394
- for (var r = t.length, n = new ft(e), o = new Array(r), i = 0, a = 0, u = 0, l = 0; l < r; l++) if (n.update(t[l]),
3395
- n.isStable) {
3396
- var c = n.getResult();
3397
- o[l] = c, i += c, a += c * c, u++;
3398
- } else o[l] = null;
3399
- var s = i / u, f = a / u - s * s, y = Math.sqrt(f);
3400
- return o.map((function(t) {
3401
- return null !== t ? (t - s) / y : null;
3402
- }));
3403
- }, Vr = function(t, e) {
3404
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5;
3405
- if (t.length !== e.length) throw new Error("Both arrays must have the same length");
3406
- for (var n = Hr(t, r), o = Hr(e, r), i = t.length, a = [], u = 0, l = 0, c = 0, s = 0, f = 0, y = 0, p = -1, h = 0; h < i; h++) {
3407
- if (null !== n[h] && null !== o[h]) {
3408
- p = h;
3409
- break;
3410
- }
3411
- a.push(0);
3412
- }
3413
- if (-1 === p)
3414
- // No valid data points
3415
- return new Array(i).fill(0);
3416
- for (var v = p; v < i; v++) {
3417
- var m = n[v], d = o[v];
3418
- if (null !== m && null !== d) if (u += m, l += d, c += m * d, s += m * m, f += d * d,
3419
- ++y < 2) a.push(0); else {
3420
- var b = y * c - u * l, g = Math.sqrt((y * s - u * u) * (y * f - l * l)), w = 0 === g ? 0 : b / g;
3421
- a.push(w);
3422
- } else
3423
- // Reset sums and counts when encountering null values
3424
- u = l = c = s = f = y = 0, a.push(0);
3425
- }
3426
- return a;
3427
- };
3428
- // ./src/utilities/verticalToHorizontal.js
3429
- function Ur(t, e) {
3430
- return function(t) {
3431
- if (Array.isArray(t)) return t;
3432
- }(t) || function(t, e) {
3433
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3434
- if (null != r) {
3435
- var n, o, i, a, u = [], l = !0, c = !1;
3436
- try {
3437
- if (i = (r = r.call(t)).next, 0 === e) {
3438
- if (Object(r) !== r) return;
3439
- l = !1;
3440
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
3441
- } catch (t) {
3442
- c = !0, o = t;
3443
- } finally {
3444
- try {
3445
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
3446
- } finally {
3447
- if (c) throw o;
3448
- }
3449
- }
3450
- return u;
3451
- }
3452
- }(t, e) || function(t, e) {
3453
- if (t) {
3454
- if ("string" == typeof t) return $r(t, e);
3455
- var r = {}.toString.call(t).slice(8, -1);
3456
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? $r(t, e) : void 0;
3457
- }
3458
- }(t, e) || function() {
3459
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3460
- }();
3461
- }
3462
- function $r(t, e) {
3463
- (null == e || e > t.length) && (e = t.length);
3464
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
3465
- return n;
3466
- }
3467
- var qr = function(t) {
3468
- var e = t.main, r = t.skipNull, n = void 0 !== r && r, o = t.startIndex, i = void 0 === o ? 0 : o, a = t.dateFormat, u = e.precisionMultiplier, l = e.priceBased, c = e.precision, s = e.verticalOhlcv, f = e.invalidValueIndex, y = e.len, p = e.verticalOhlcvKeyNames, h = e.verticalOhlcvTempCols;
3469
- if (0 === p.length) return [];
3470
- for (var v = n && f >= 0 ? f + 1 : 0, m = Math.max(v, i), d = y - m, b = Array.from({
3471
- length: d
3472
- }, (function() {
3473
- return {};
3474
- })), g = 0, w = Object.entries(s); g < w.length; g++) {
3475
- var O = Ur(w[g], 2), S = O[0], j = O[1];
3476
- if (!h.has(S)) for (var P = l.has(S) && c, _ = m; _ < y; _++) b[_ - m][S] = P ? j[_] / u : "date" === S ? or[a](j[_]) : j[_];
3477
- }
3478
- return b;
3479
- };
3480
- function zr(t, e) {
3481
- return function(t) {
3482
- if (Array.isArray(t)) return t;
3483
- }(t) || function(t, e) {
3484
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3485
- if (null != r) {
3486
- var n, o, i, a, u = [], l = !0, c = !1;
3487
- try {
3488
- if (i = (r = r.call(t)).next, 0 === e) {
3489
- if (Object(r) !== r) return;
3490
- l = !1;
3491
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
3492
- } catch (t) {
3493
- c = !0, o = t;
3494
- } finally {
3495
- try {
3496
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
3497
- } finally {
3498
- if (c) throw o;
3499
- }
3500
- }
3501
- return u;
3502
- }
3503
- }(t, e) || Gr(t, e) || function() {
3504
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3505
- }();
3506
- }
3507
- function Gr(t, e) {
3508
- if (t) {
3509
- if ("string" == typeof t) return Kr(t, e);
3510
- var r = {}.toString.call(t).slice(8, -1);
3511
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Kr(t, e) : void 0;
3512
- }
3513
- }
3514
- function Kr(t, e) {
3515
- (null == e || e > t.length) && (e = t.length);
3516
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
3517
- return n;
3518
- }
3519
- var Yr = function(t, e) {
3520
- var r = t.precision, n = t.priceBased;
3521
- if (!1 === r) return 1;
3522
- var o, i = 1, a = // ./src/utilities/precisionMultiplier.js
3523
- function(t, e) {
3524
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3525
- if (!r) {
3526
- if (Array.isArray(t) || (r = Gr(t)) || e && t && "number" == typeof t.length) {
3527
- r && (t = r);
3528
- var n = 0, o = function() {};
3529
- return {
3530
- s: o,
3531
- n: function() {
3532
- return n >= t.length ? {
3533
- done: !0
3534
- } : {
3535
- done: !1,
3536
- value: t[n++]
3537
- };
3538
- },
3539
- e: function(t) {
3540
- throw t;
3541
- },
3542
- f: o
3543
- };
3544
- }
3545
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3546
- }
3547
- var i, a = !0, u = !1;
3548
- return {
3549
- s: function() {
3550
- r = r.call(t);
3551
- },
3552
- n: function() {
3553
- var t = r.next();
3554
- return a = t.done, t;
3555
- },
3556
- e: function(t) {
3557
- u = !0, i = t;
3558
- },
3559
- f: function() {
3560
- try {
3561
- a || null == r.return || r.return();
3562
- } finally {
3563
- if (u) throw i;
3564
- }
3565
- }
3566
- };
3567
- }(Object.entries(e).filter((function(t) {
3568
- var e = zr(t, 2), r = e[0];
3569
- e[1];
3570
- return n.has(r);
3571
- })).map((function(t) {
3572
- var e = zr(t, 2);
3573
- e[0];
3574
- return e[1];
3575
- })));
3576
- try {
3577
- for (a.s(); !(o = a.n()).done; ) {
3578
- var u = o.value, l = zr(String(u).split("."), 2)[1], c = void 0 === l ? "" : l, s = Math.max(4, c.length), f = s > 1 ? Math.pow(10, s - 1) : 1;
3579
- f > i && (i = f);
3580
- }
3581
- } catch (t) {
3582
- a.e(t);
3583
- } finally {
3584
- a.f();
3585
- }
3586
- return i;
3587
- };
3588
- // ./index.js
3589
- function Jr(t) {
3590
- return Jr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
3591
- return typeof t;
3592
- } : function(t) {
3593
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
3594
- }, Jr(t);
3595
- }
3596
- function Zr(t) {
3597
- return function(t) {
3598
- if (Array.isArray(t)) return Xr(t);
3599
- }(t) || function(t) {
3600
- if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
3601
- }(t) || Wr(t) || function() {
3602
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3603
- }();
3604
- }
3605
- function Qr(t, e) {
3606
- return function(t) {
3607
- if (Array.isArray(t)) return t;
3608
- }(t) || function(t, e) {
3609
- var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3610
- if (null != r) {
3611
- var n, o, i, a, u = [], l = !0, c = !1;
3612
- try {
3613
- if (i = (r = r.call(t)).next, 0 === e) {
3614
- if (Object(r) !== r) return;
3615
- l = !1;
3616
- } else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
3617
- } catch (t) {
3618
- c = !0, o = t;
3619
- } finally {
3620
- try {
3621
- if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
3622
- } finally {
3623
- if (c) throw o;
3624
- }
3625
- }
3626
- return u;
3627
- }
3628
- }(t, e) || Wr(t, e) || function() {
3629
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3630
- }();
3631
- }
3632
- function Wr(t, e) {
3633
- if (t) {
3634
- if ("string" == typeof t) return Xr(t, e);
3635
- var r = {}.toString.call(t).slice(8, -1);
3636
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Xr(t, e) : void 0;
3637
- }
3638
- }
3639
- function Xr(t, e) {
3640
- (null == e || e > t.length) && (e = t.length);
3641
- for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
3642
- return n;
3643
- }
3644
- function tn(t, e) {
3645
- for (var r = 0; r < e.length; r++) {
3646
- var n = e[r];
3647
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
3648
- Object.defineProperty(t, en(n.key), n);
3649
- }
3650
- }
3651
- function en(t) {
3652
- var e = function(t, e) {
3653
- if ("object" != Jr(t) || !t) return t;
3654
- var r = t[Symbol.toPrimitive];
3655
- if (void 0 !== r) {
3656
- var n = r.call(t, e || "default");
3657
- if ("object" != Jr(n)) return n;
3658
- throw new TypeError("@@toPrimitive must return a primitive value.");
3659
- }
3660
- return ("string" === e ? String : Number)(t);
3661
- }
3662
- //precomputed
3663
- /**
3664
- * Class OHLCV_INDICATORS
3665
- *
3666
- * This class provides methods for calculating and managing technical indicators
3667
- * on financial OHLCV (Open, High, Low, Close, Volume) data. It enables users
3668
- * to parallel compute various technical indicators in 1 single loop.
3669
- * OHLCV datasets.
3670
- */ (t, "string");
3671
- return "symbol" == Jr(e) ? e : e + "";
3672
- }
3673
- var rn = function() {
3674
- return t = function t(e) {
3675
- var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, a = e.precision, l = void 0 === a || a, s = e.inputParams, f = void 0 === s ? null : s, h = e.chunkProcess, v = void 0 === h ? 2e3 : h;
3676
- if (function(t, e) {
3677
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
3678
- }(this, t), c(n, "input", null !== i ? "contructor ".concat(i) : "constuctor"),
3679
- 0 === n.length) throw Error("input OHLCV must not be empty: " + i);
3680
- y(l, "precision", "constructor"), p(v, {
3681
- min: 100,
3682
- max: 5e4,
3683
- allowDecimals: !1
3684
- }, "chunkProcess", "constructor"), this.chunkProcess = v, this.firstRow = n[0];
3685
- var m = function(t) {
3686
- for (var e = {}, r = {}, n = 0, o = Object.entries(t); n < o.length; n++) {
3687
- var i = ur(o[n], 2), a = i[0], u = i[1];
3688
- if ("date" === a) e[a] = ar(u), r[a] = "Array"; else if ("volume" === a) e[a] = ze(u, !0),
3689
- r[a] = "Int32Array"; else if (cr.has(a)) e[a] = ze(u, !0), r[a] = "Float64Array"; else {
3690
- var l = ze(u, !1);
3691
- e[a] = l, r[a] = "number" === l ? "Float64Array" : "Array";
3692
- }
3693
- }
3694
- return {
3695
- inputTypes: e,
3696
- arrayTypes: r
3697
- };
3698
- }(this.firstRow), d = m.inputTypes, b = m.arrayTypes;
3699
- if (this.inputTypes = d, this.arrayTypes = b, !this.firstRow.hasOwnProperty("close")) throw Error('input OHLCV array objects require at least "close" property: '.concat(i));
3700
- return this.dateType = this.inputTypes.date ? this.inputTypes.date : null, this.isComputed = !1,
3701
- this.input = n, this.priceBased = new Set([ "open", "high", "low", "close" ]), this.len = n.length,
3702
- this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {}, this.verticalOhlcvKeyNames = [],
3703
- this.verticalOhlcvTempCols = new Set, this.utilities = {
3704
- correlation: Vr
3705
- }, this.invalidValueIndex = -1, this.precision = l, this.precisionMultiplier = Yr(this, this.firstRow),
3706
- this.scaledGroups = {}, this.pushToMain = function(t) {
3707
- var e = t.index, n = t.key, o = t.value;
3708
- return function(t) {
3709
- var e = t.main, r = t.index, n = t.key, o = t.value, i = e.verticalOhlcv;
3710
- return null == o || Number.isNaN(o) ? (e.invalidValueIndex = r, i[n][r] = o, !1) : (i[n][r] = o,
3711
- !0);
3712
- }({
3713
- main: r,
3714
- index: e,
3715
- key: n,
3716
- value: o
3717
- });
3718
- }, null !== f && (u(f, this.len), this.inputParams = f, this.compute()), this.inputParams = [],
3719
- this;
3720
- }, e = [ {
3721
- key: "getDataAsCols",
3722
- value: function() {
3723
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
3724
- this.compute();
3725
- var e = t.skipNull, r = void 0 === e || e, n = t.dateFormat, o = void 0 === n ? "string" : n;
3726
- f(Object.keys(or), o, "dateFormat", "getDataAsCols"), s(t, "options", "getDataAsCols");
3727
- for (var i = this.precisionMultiplier, a = this.precision, u = this.invalidValueIndex, l = this.len, c = this.verticalOhlcv, y = this.priceBased, p = this.arrayTypes, h = this.verticalOhlcvTempCols, v = {}, m = r ? u + 1 : 0, d = l - m, b = 0, g = Object.entries(c); b < g.length; b++) {
3728
- var w = Qr(g[b], 2), O = w[0], S = w[1];
3729
- if (!h.has(O)) {
3730
- var j = y.has(O) && a;
3731
- v[O] = sr(p[O], d);
3732
- for (var P = m; P < l; P++) v[O][P] = j ? S[P] / i : "date" === O ? or[o](S[P]) : S[P];
3733
- }
3734
- }
3735
- return v;
3736
- }
3737
- }, {
3738
- key: "getData",
3739
- value: function() {
3740
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
3741
- //getData method returns the last object (row) of the new OHLCV with indicators: {open, high, low, close, rsi_14, bollinger_bands_upper}
3742
- this.compute();
3743
- var e = t.skipNull, r = void 0 === e || e, n = t.dateFormat, o = void 0 === n ? "string" : n;
3744
- return f(Object.keys(or), o, "dateFormat", "getData"), s(t, "options", "getData"),
3745
- qr({
3746
- main: this,
3747
- skipNull: r,
3748
- startIndex: 0,
3749
- dateFormat: o
3750
- });
3751
- }
3752
- }, {
3753
- key: "getLastValues",
3754
- value: function() {
3755
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
3756
- this.compute();
3757
- var e = t.dateFormat, r = void 0 === e ? "string" : e;
3758
- return f(Object.keys(or), r, "dateFormat", "getData"), qr({
3759
- skipNull: !1,
3760
- main: this,
3761
- startIndex: this.len - 1,
3762
- dateFormat: r
3763
- })[0];
3764
- }
3765
- }, {
3766
- key: "compute",
3767
- value: function() {
3768
- // If we've already computed, bail out immediately
3769
- return this.isComputed || (
3770
- // Mark as “in progress”
3771
- this.isComputed = !1,
3772
- // Figure out whether there’s a date field in the inputs
3773
- // Only run the full loop once (or when new data appears later,
3774
- // if you extend this to reset isComputed elsewhere)
3775
- this.len > 0 && (function(t, e) {
3776
- var r = e.len, n = e.inputParams, o = e.priceBased, i = e.precisionMultiplier, a = e.arrayTypes, l = e.verticalOhlcv, c = e.verticalOhlcvKeyNames, s = e.inputTypes, f = e.chunkProcess;
3777
- u(n, r);
3778
- for (var y = 0, p = Object.keys(s); y < p.length; y++) {
3779
- var h = p[y];
3780
- l[h] = sr(a[h], r);
3781
- }
3782
- // Process each row in the input
3783
- for (var v = 0; v < r; v += f) for (var m = Math.min(v + f, r), d = v; d < m; d++) {
3784
- for (var b = t[d], g = 0, w = Object.entries(s); g < w.length; g++) {
3785
- var O = Cr(w[g], 2), S = O[0], j = O[1], P = b[S];
3786
- if (qe.hasOwnProperty(j)) {
3787
- var _ = qe[j](P);
3788
- i > 1 && o.has(S) && (_ *= i), e.pushToMain({
3789
- index: d,
3790
- key: S,
3791
- value: _
3792
- });
3793
- } else ir.hasOwnProperty(j) ? e.pushToMain({
3794
- index: d,
3795
- key: S,
3796
- value: ir[j](P)
3797
- }) : e.pushToMain({
3798
- index: d,
3799
- key: S,
3800
- value: P
3801
- });
3802
- }
3803
- // Run all indicator functions except for the ones processed later
3804
- var N, T = Rr(n);
3805
- try {
3806
- for (T.s(); !(N = T.n()).done; ) {
3807
- var A = N.value, E = A.key, k = A.params;
3808
- "lag" !== E && "crossPairs" !== E &&
3809
- // resolve fn on-demand, no per-item object allocation here
3810
- Br[E].apply(Br, [ e, d ].concat(Mr(k)));
3811
- }
3812
- // Process these indicators separately (ensuring their execution order)
3813
- } catch (t) {
3814
- T.e(t);
3815
- } finally {
3816
- T.f();
3817
- }
3818
- vr(e, d), Pr(e, d), t[d] = null;
3819
- }
3820
- c.push.apply(c, Mr(Object.keys(l)));
3821
- }(this.input, this), this.isComputed = !0,
3822
- //flushing after mainLoop
3823
- this.input = [], this.instances = {}, this.firstRow = [])), this;
3824
- }
3825
- }, {
3826
- key: "crossPairs",
3827
- value: function() {
3828
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = "crossPairs";
3829
- return l(this), c(t, "arr", e), this.crossPairsList = [].concat(Zr(this.crossPairsList), Zr(t)),
3830
- this.inputParams.push({
3831
- key: e,
3832
- params: [ this.crossPairsList ]
3833
- }), this;
3834
- }
3835
- }, {
3836
- key: "lag",
3837
- value: function() {
3838
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ "close" ], e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, r = "lag";
3839
- l(this), c(t, "colKeys", r), p(e, {
3840
- min: 1,
3841
- max: this.len,
3842
- allowDecimals: !1
3843
- }, "lookback", r), this.inputParams.push({
3844
- key: r,
3845
- params: [ t, e ]
3846
- });
3847
- var n, o = function(t, e) {
3848
- var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
3849
- if (!r) {
3850
- if (Array.isArray(t) || (r = Wr(t)) || e && t && "number" == typeof t.length) {
3851
- r && (t = r);
3852
- var n = 0, o = function() {};
3853
- return {
3854
- s: o,
3855
- n: function() {
3856
- return n >= t.length ? {
3857
- done: !0
3858
- } : {
3859
- done: !1,
3860
- value: t[n++]
3861
- };
3862
- },
3863
- e: function(t) {
3864
- throw t;
3865
- },
3866
- f: o
3867
- };
3868
- }
3869
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3870
- }
3871
- var i, a = !0, u = !1;
3872
- return {
3873
- s: function() {
3874
- r = r.call(t);
3875
- },
3876
- n: function() {
3877
- var t = r.next();
3878
- return a = t.done, t;
3879
- },
3880
- e: function(t) {
3881
- u = !0, i = t;
3882
- },
3883
- f: function() {
3884
- try {
3885
- a || null == r.return || r.return();
3886
- } finally {
3887
- if (u) throw i;
3888
- }
3889
- }
3890
- };
3891
- }(t);
3892
- try {
3893
- for (o.s(); !(n = o.n()).done; ) {
3894
- var i = n.value;
3895
- this.priceBased.has(i) && this.priceBased.add(i);
3896
- }
3897
- } catch (t) {
3898
- o.e(t);
3899
- } finally {
3900
- o.f();
3901
- }
3902
- return this;
3903
- }
3904
- }, {
3905
- key: "relativeVolume",
3906
- value: function() {
3907
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 10, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "relativeVolume";
3908
- if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
3909
- l(this), p(t, {
3910
- min: 1,
3911
- max: this.len,
3912
- allowDecimals: !1
3913
- }, "size", r), s(e, "options", r);
3914
- var n = e.lag, o = void 0 === n ? 0 : n;
3915
- return p(o, {
3916
- min: 0,
3917
- max: this.len,
3918
- allowDecimals: !1
3919
- }, "options.lag", r), this.inputParams.push({
3920
- key: r,
3921
- params: [ t, {
3922
- lag: o
3923
- } ]
3924
- }), this;
3925
- }
3926
- }, {
3927
- key: "atr",
3928
- value: function() {
3929
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 14, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "atr";
3930
- l(this), p(t, {
3931
- min: 1,
3932
- max: this.len,
3933
- allowDecimals: !1
3934
- }, "size", r), s(e, "options", r);
3935
- var n = e.lag, o = void 0 === n ? 0 : n, i = e.type, a = void 0 === i ? "price" : i;
3936
- return p(o, {
3937
- min: 0,
3938
- max: this.len,
3939
- allowDecimals: !1
3940
- }, "options.lag", r), f([ "price", "percentage" ], a, "options.type", r), this.inputParams.push({
3941
- key: r,
3942
- params: [ t, {
3943
- lag: o,
3944
- type: a
3945
- } ]
3946
- }), this;
3947
- }
3948
- }, {
3949
- key: "ema",
3950
- value: function() {
3951
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "ema";
3952
- l(this), p(t, {
3953
- min: 1,
3954
- max: this.len,
3955
- allowDecimals: !1
3956
- }, "size", r), s(e, "options", r);
3957
- var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
3958
- p(a, {
3959
- min: 0,
3960
- max: this.len,
3961
- allowDecimals: !1
3962
- }, "options.lag", r);
3963
- var u = Fe({
3964
- main: this,
3965
- size: t,
3966
- target: o,
3967
- lag: a,
3968
- methodName: r
3969
- });
3970
- return this.inputParams.push({
3971
- key: r,
3972
- params: [ r, t, {
3973
- target: o,
3974
- lag: a,
3975
- precomputed: u
3976
- } ]
3977
- }), this;
3978
- }
3979
- }, {
3980
- key: "sma",
3981
- value: function() {
3982
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "sma";
3983
- l(this), p(t, {
3984
- min: 1,
3985
- max: this.len,
3986
- allowDecimals: !1
3987
- }, "size", r), s(e, "options", r);
3988
- var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
3989
- p(a, {
3990
- min: 0,
3991
- max: this.len,
3992
- allowDecimals: !1
3993
- }, "options.lag", r);
3994
- var u = Fe({
3995
- main: this,
3996
- size: t,
3997
- target: o,
3998
- lag: a,
3999
- methodName: r
4000
- });
4001
- return this.inputParams.push({
4002
- key: r,
4003
- params: [ r, t, {
4004
- target: o,
4005
- lag: a,
4006
- precomputed: u
4007
- } ]
4008
- }), this;
4009
- }
4010
- }, {
4011
- key: "macd",
4012
- value: function() {
4013
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 12, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 26, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 9, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, o = "macd";
4014
- l(this), p(t, {
4015
- min: 1,
4016
- max: this.len,
4017
- allowDecimals: !1
4018
- }, "fast", o), p(e, {
4019
- min: 1,
4020
- max: this.len,
4021
- allowDecimals: !1
4022
- }, "slow", o), p(r, {
4023
- min: 1,
4024
- max: this.len,
4025
- allowDecimals: !1
4026
- }, "signal", o), s(n, "options", o);
4027
- var i = n.target, a = void 0 === i ? "close" : i, u = n.lag, c = void 0 === u ? 0 : u;
4028
- p(c, {
4029
- min: 0,
4030
- max: this.len,
4031
- allowDecimals: !1
4032
- }, "options.lag", o);
4033
- var f = {
4034
- instanceKey: "".concat(t, "_").concat(e, "_").concat(r).concat("close" === a ? "" : "_".concat(a))
4035
- };
4036
- return this.inputParams.push({
4037
- key: o,
4038
- params: [ t, e, r, {
4039
- target: a,
4040
- lag: c,
4041
- precomputed: f
4042
- } ]
4043
- }), this;
4044
- }
4045
- }, {
4046
- key: "bollingerBands",
4047
- value: function() {
4048
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, n = "bollingerBands";
4049
- l(this), p(t, {
4050
- min: 1,
4051
- max: this.len,
4052
- allowDecimals: !1
4053
- }, "size", n), p(e, {
4054
- min: .01,
4055
- max: 50,
4056
- allowDecimals: !0
4057
- }, "stdDev", n), s(r, "options", n);
4058
- var o = r.target, i = void 0 === o ? "close" : o, a = r.height, u = void 0 !== a && a, f = r.range, h = void 0 === f ? [] : f, v = r.lag, m = void 0 === v ? 0 : v, d = r.decimals, b = void 0 === d ? null : d;
4059
- return c(h, "options.range", n), p(m, {
4060
- min: 0,
4061
- max: this.len,
4062
- allowDecimals: !1
4063
- }, "options.lag", n), y(u, "options.height", n), null !== b && p(b, {
4064
- min: 1,
4065
- max: 15,
4066
- allowDecimals: !1
4067
- }, "decimals", n), this.inputParams.push({
4068
- key: n,
4069
- params: [ t, e, {
4070
- target: i,
4071
- height: u,
4072
- range: h,
4073
- lag: m,
4074
- decimals: b
4075
- } ]
4076
- }), this;
4077
- }
4078
- }, {
4079
- key: "rsi",
4080
- value: function() {
4081
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 14, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "rsi";
4082
- l(this), p(t, {
4083
- min: 1,
4084
- max: this.len,
4085
- allowDecimals: !1
4086
- }, "size", r), s(e, "options", r);
4087
- var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
4088
- return p(a, {
4089
- min: 0,
4090
- max: this.len,
4091
- allowDecimals: !1
4092
- }, "options.lag", r), this.inputParams.push({
4093
- key: r,
4094
- params: [ t, {
4095
- target: o,
4096
- lag: a
4097
- } ]
4098
- }), this;
4099
- }
4100
- }, {
4101
- key: "donchianChannels",
4102
- value: function() {
4103
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, n = "donchianChannels";
4104
- l(this), p(t, {
4105
- min: 1,
4106
- max: this.len,
4107
- allowDecimals: !1
4108
- }, "size", n), p(e, {
4109
- min: 0,
4110
- max: this.len,
4111
- allowDecimals: !1
4112
- }, "offset", n), s(r, "options", n);
4113
- var o = r.height, i = void 0 !== o && o, a = r.range, u = void 0 === a ? [] : a, f = r.lag, h = void 0 === f ? 0 : f, v = r.decimals, m = void 0 === v ? null : v;
4114
- return c(u, "options.range", n), p(h, {
4115
- min: 0,
4116
- max: this.len,
4117
- allowDecimals: !1
4118
- }, "options.lag", n), y(i, "options.height", n), null !== m && p(m, {
4119
- min: 1,
4120
- max: 15,
4121
- allowDecimals: !1
4122
- }, "decimals", n), this.inputParams.push({
4123
- key: n,
4124
- params: [ t, e, {
4125
- height: i,
4126
- range: u,
4127
- lag: h,
4128
- decimals: m
4129
- } ]
4130
- }), this;
4131
- }
4132
- }, {
4133
- key: "volumeOscillator",
4134
- value: function() {
4135
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 10, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, n = "volumeOscillator";
4136
- if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');
4137
- l(this), p(t, {
4138
- min: 1,
4139
- max: this.len,
4140
- allowDecimals: !1
4141
- }, "fastSize", n), p(e, {
4142
- min: t,
4143
- max: this.len,
4144
- allowDecimals: !1
4145
- }, "slowSize", n), s(r, "options", n);
4146
- var o = r.lag, i = void 0 === o ? 0 : o;
4147
- return p(i, {
4148
- min: 0,
4149
- max: this.len,
4150
- allowDecimals: !1
4151
- }, "options.lag", n), this.inputParams.push({
4152
- key: n,
4153
- params: [ t, e, {
4154
- lag: i
4155
- } ]
4156
- }), this;
4157
- }
4158
- }, {
4159
- key: "dateTime",
4160
- value: function() {
4161
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = "dateTime";
4162
- l(this), s(t, "options", e);
4163
- var r = t.lag, n = void 0 === r ? 0 : r;
4164
- return p(n, {
4165
- min: 0,
4166
- max: this.len,
4167
- allowDecimals: !1
4168
- }, "options.lag", e), this.inputParams.push({
4169
- key: e,
4170
- params: [ {
4171
- lag: n
4172
- } ]
4173
- }), this;
4174
- }
4175
- }, {
4176
- key: "scaler",
4177
- value: function(t) {
4178
- var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, o = "scaler";
4179
- l(this), p(t, {
4180
- min: 1,
4181
- max: this.len,
4182
- allowDecimals: !1
4183
- }, "size", o), c(e, "colKeys", o);
4184
- var i = n.group, a = void 0 !== i && i, u = n.range, s = void 0 === u ? [ 0, 1 ] : u, h = n.lag, v = void 0 === h ? 0 : h, m = n.type, d = void 0 === m ? "minmax" : m, b = n.decimals, g = void 0 === b ? null : b;
4185
- y(a, "options.group", o), function(t, e, n) {
4186
- if (c(t, e, n), 2 !== t.length) throw new Error('Invalid "'.concat(e, '" array length: expected 2 items, but got ').concat(t.length, ' in "').concat(n, ".").concat(e, '".'));
4187
- var o = r(t, 2), i = o[0], a = o[1];
4188
- if (p(i, {
4189
- min: -100,
4190
- max: a,
4191
- allowDecimals: !1
4192
- }, "min", n), p(a, {
4193
- min: i,
4194
- max: 100,
4195
- allowDecimals: !1
4196
- }, "max", n), i === a) throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(n, ".").concat(e, '".'));
4197
- }(s, "options.range", o), f([ "minmax", "zscore" ], d, "options.type", o), null !== g && p(g, {
4198
- min: 1,
4199
- max: 15,
4200
- allowDecimals: !1
4201
- }, "decimals", o);
4202
- var w = {
4203
- groupKey: a ? "".concat(d, "_").concat(t, "_group_").concat(e.join("_")) : "",
4204
- groupKeyLen: e.length
4205
- };
4206
- return this.inputParams.push({
4207
- key: o,
4208
- params: [ t, e, {
4209
- type: d,
4210
- group: a,
4211
- range: s,
4212
- lag: v,
4213
- precomputed: w,
4214
- decimals: g
4215
- } ]
4216
- }), this;
4217
- }
4218
- } ], e && tn(t.prototype, e), n && tn(t, n), Object.defineProperty(t, "prototype", {
4219
- writable: !1
4220
- }), t;
4221
- var t, e, n;
4222
- }();
4223
- })(), OHLCV_INDICATORS = e;
4224
- })
4225
- /******/ ();
1
+ var OHLCV_INDICATORS;(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){l=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(l)throw a}}}}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{default:()=>mr});var a=function(t,e){if(!Array.isArray(t))throw new Error('Property "inputParams" must be an "Array" or "Set".');var r,o=n(t);try{for(o.s();!(r=o.n()).done;){var i,a=n(r.value.params);try{for(a.s();!(i=a.n()).done;){var u=i.value;if("number"==typeof u&&u>e)throw console.log(u,e),new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.")}}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}},u=function(t){if(!0===t.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.')},l=function(t,e,r){if(!Array.isArray(t))throw new Error('Param "'.concat(e,'" must be an array in "').concat(r,'".'));return!0},c=function(t,e,n){if(!Boolean(t)||"object"==!r(t))throw new Error('Param "'.concat(e,'" must be an object in "').concat(n,'".'));return!0},s=function(t,e,r,n){if(l(t,"arrayOptions","".concat(n,".").concat(r,".validateArrayOptions")),!t.includes(e.toString()))throw new Error('Param "'.concat(r,'" must be any of the following values [').concat(t.join(", "),'] in "').concat(n,'".'));return!0},f=function(t,e,r){if("boolean"!=typeof t)throw new Error('Param "'.concat(e,'" must be an boolean in "').concat(r,'".'));return!0},p=function(t,e,r,n){c(e,"options","".concat(n,".").concat(r,".validateNumber"));var o=e.allowDecimals,i=void 0!==o&&o,a=e.min,u=e.max,l=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(r,'" must be an integer in "').concat(n,'".'));if("number"!=typeof a||"number"!=typeof u||a>=u)throw new Error('Param "min" must be a valid '.concat(l,' lower than "max" "').concat(n,".").concat(r,'.validateNumber".'));if(t<a)throw new Error('Param "'.concat(r,'" must be an ').concat(l," greater than or equal to ").concat(a,' in "').concat(n,'".'));if(t>u)throw new Error('Param "'.concat(r,'" must be an ').concat(l," lower than or equal to ").concat(u,' in "').concat(n,'".'));return!0},y=1e6,h="[big.js] ",v=h+"Invalid ",m=v+"decimal places",d=v+"rounding mode",b=h+"Division by zero",g={},w=void 0,O=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function S(t,e,r,n){var o=t.c;if(r===w&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(d);if(e<1)n=3===r&&(n||!!o[0])||0===e&&(1===r&&o[0]>=5||2===r&&(o[0]>5||5===o[0]&&(n||o[1]!==w))),o.length=1,n?(t.e=t.e-e+1,o[0]=1):o[0]=t.e=0;else if(e<o.length){if(n=1===r&&o[e]>=5||2===r&&(o[e]>5||5===o[e]&&(n||o[e+1]!==w||1&o[e-1]))||3===r&&(n||!!o[0]),o.length=e,n)for(;++o[--e]>9;)if(o[e]=0,0===e){++t.e,o.unshift(1);break}for(e=o.length;!o[--e];)o.pop()}return t}function j(t,e,r){var n=t.e,o=t.c.join(""),i=o.length;if(e)o=o.charAt(0)+(i>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>i)for(n-=i;n--;)o+="0";else n<i&&(o=o.slice(0,n)+"."+o.slice(n));else i>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&r?"-"+o:o}function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function _(t){var e="function"==typeof Map?new Map:void 0;return _=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(N())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&T(o,r.prototype),o}(t,arguments,A(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),T(r,t)},_(t)}function N(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(N=function(){return!!t})()}function T(t,e){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},T(t,e)}function A(t){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},A(t)}g.abs=function(){var t=new this.constructor(this);return t.s=1,t},g.cmp=function(t){var e,r=this,n=r.c,o=(t=new r.constructor(t)).c,i=r.s,a=t.s,u=r.e,l=t.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(e=i<0,u!=l)return u>l^e?1:-1;for(a=(u=n.length)<(l=o.length)?u:l,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^e?1:-1;return u==l?0:u>l^e?1:-1},g.div=function(t){var e=this,r=e.constructor,n=e.c,o=(t=new r(t)).c,i=e.s==t.s?1:-1,a=r.DP;if(a!==~~a||a<0||a>y)throw Error(m);if(!o[0])throw Error(b);if(!n[0])return t.s=i,t.c=[t.e=0],t;var u,l,c,s,f,p=o.slice(),h=u=o.length,v=n.length,d=n.slice(0,u),g=d.length,O=t,j=O.c=[],P=0,_=a+(O.e=e.e-t.e)+1;for(O.s=i,i=_<0?0:_,p.unshift(0);g++<u;)d.push(0);do{for(c=0;c<10;c++){if(u!=(g=d.length))s=u>g?1:-1;else for(f=-1,s=0;++f<u;)if(o[f]!=d[f]){s=o[f]>d[f]?1:-1;break}if(!(s<0))break;for(l=g==u?o:p;g;){if(d[--g]<l[g]){for(f=g;f&&!d[--f];)d[f]=9;--d[f],d[g]+=10}d[g]-=l[g]}for(;!d[0];)d.shift()}j[P++]=s?c:++c,d[0]&&s?d[g]=n[h]||0:d=[n[h]]}while((h++<v||d[0]!==w)&&i--);return j[0]||1==P||(j.shift(),O.e--,_--),P>_&&S(O,_,r.RM,d[0]!==w),O},g.eq=function(t){return 0===this.cmp(t)},g.gt=function(t){return this.cmp(t)>0},g.gte=function(t){return this.cmp(t)>-1},g.lt=function(t){return this.cmp(t)<0},g.lte=function(t){return this.cmp(t)<1},g.minus=g.sub=function(t){var e,r,n,o,i=this,a=i.constructor,u=i.s,l=(t=new a(t)).s;if(u!=l)return t.s=-l,i.plus(t);var c=i.c.slice(),s=i.e,f=t.c,p=t.e;if(!c[0]||!f[0])return f[0]?t.s=-l:c[0]?t=new a(i):t.s=1,t;if(u=s-p){for((o=u<0)?(u=-u,n=c):(p=s,n=f),n.reverse(),l=u;l--;)n.push(0);n.reverse()}else for(r=((o=c.length<f.length)?c:f).length,u=l=0;l<r;l++)if(c[l]!=f[l]){o=c[l]<f[l];break}if(o&&(n=c,c=f,f=n,t.s=-t.s),(l=(r=f.length)-(e=c.length))>0)for(;l--;)c[e++]=0;for(l=e;r>u;){if(c[--r]<f[r]){for(e=r;e&&!c[--e];)c[e]=9;--c[e],c[r]+=10}c[r]-=f[r]}for(;0===c[--l];)c.pop();for(;0===c[0];)c.shift(),--p;return c[0]||(t.s=1,c=[p=0]),t.c=c,t.e=p,t},g.mod=function(t){var e,r=this,n=r.constructor,o=r.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(b);return r.s=t.s=1,e=1==t.cmp(r),r.s=o,t.s=i,e?new n(r):(o=n.DP,i=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=o,n.RM=i,this.minus(r.times(t)))},g.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},g.plus=g.add=function(t){var e,r,n,o=this,i=o.constructor;if(t=new i(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var a=o.e,u=o.c,l=t.e,c=t.c;if(!u[0]||!c[0])return c[0]||(u[0]?t=new i(o):t.s=o.s),t;if(u=u.slice(),e=a-l){for(e>0?(l=a,n=c):(e=-e,n=u),n.reverse();e--;)n.push(0);n.reverse()}for(u.length-c.length<0&&(n=c,c=u,u=n),e=c.length,r=0;e;u[e]%=10)r=(u[--e]=u[e]+c[e]+r)/10|0;for(r&&(u.unshift(r),++l),e=u.length;0===u[--e];)u.pop();return t.c=u,t.e=l,t},g.pow=function(t){var e=this,r=new e.constructor("1"),n=r,o=t<0;if(t!==~~t||t<-1e6||t>1e6)throw Error(v+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},g.prec=function(t,e){if(t!==~~t||t<1||t>y)throw Error(v+"precision");return S(new this.constructor(this),t,e)},g.round=function(t,e){if(t===w)t=0;else if(t!==~~t||t<-y||t>y)throw Error(m);return S(new this.constructor(this),t+this.e+1,e)},g.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,u=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(h+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((e=n.c.join("")).length+a&1||(e+="0"),a=((a+1)/2|0)-(a<0||1&a),t=new o(((i=Math.sqrt(e))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):t=new o(i+""),a=t.e+(o.DP+=4);do{r=t,t=u.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return S(t,(o.DP-=4)+t.e+1,o.RM)},g.times=g.mul=function(t){var e,r=this,n=r.constructor,o=r.c,i=(t=new n(t)).c,a=o.length,u=i.length,l=r.e,c=t.e;if(t.s=r.s==t.s?1:-1,!o[0]||!i[0])return t.c=[t.e=0],t;for(t.e=l+c,a<u&&(e=o,o=i,i=e,c=a,a=u,u=c),e=new Array(c=a+u);c--;)e[c]=0;for(l=u;l--;){for(u=0,c=a+l;c>l;)u=e[c]+i[l]*o[c-l-1]+u,e[c--]=u%10,u=u/10|0;e[c]=u}for(u?++t.e:e.shift(),l=e.length;!e[--l];)e.pop();return t.c=e,t},g.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==w){if(t!==~~t||t<0||t>y)throw Error(m);for(r=S(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return j(r,!0,!!n)},g.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==w){if(t!==~~t||t<0||t>y)throw Error(m);for(t=t+(r=S(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return j(r,!1,!!n)},g[Symbol.for("nodejs.util.inspect.custom")]=g.toJSON=g.toString=function(){var t=this,e=t.constructor;return j(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},g.toNumber=function(){var t=Number(j(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(h+"Imprecise conversion");return t},g.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==w){if(t!==~~t||t<1||t>y)throw Error(v+"precision");for(r=S(new n(r),t,e);r.c.length<t;)r.c.push(0)}return j(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},g.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(h+"valueOf disallowed");return j(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===w?t():new e(r);if(r instanceof e)n.s=r.s,n.e=r.e,n.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(v+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!O.test(e))throw Error(v+"number");for(t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n<o&&"0"==e.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[],r=0;n<=o;)t.c[r++]=+e.charAt(n++)}}(n,r)}n.constructor=e}return e.prototype=g,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=!1,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var E=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,r){return e=A(e),function(t,e){if(e&&("object"==P(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,N()?Reflect.construct(e,r||[],A(t).constructor):e.apply(t,r))}(this,e,[r]),Object.setPrototypeOf(t,(this instanceof e?this.constructor:void 0).prototype),t.name="NotEnoughDataError",t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&T(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(_(Error));function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function x(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,M(n.key),n)}}function I(t,e,r){return(e=M(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function M(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}var D=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),I(this,"previousHighest",void 0),I(this,"highest",void 0),I(this,"previousLowest",void 0),I(this,"lowest",void 0),I(this,"previousResult",void 0),I(this,"result",void 0)},(e=[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"setResult",value:function(t,e){return e&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:t>this.highest?(this.previousHighest=this.highest,this.highest=t):this.previousHighest=this.highest,void 0===this.lowest?this.lowest=t:t<this.lowest?(this.previousLowest=this.lowest,this.lowest=t):this.previousLowest=this.lowest,this.previousResult=this.result,this.result=t}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&x(t.prototype,e),r&&x(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function C(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,V(n.key),n)}}function F(t,e,r){return e=B(e),function(t,e){if(e&&("object"==R(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,L()?Reflect.construct(e,r||[],B(t).constructor):e.apply(t,r))}function L(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(L=function(){return!!t})()}function B(t){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},B(t)}function H(t,e){return H=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},H(t,e)}function V(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}var U=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=r=F(this,e),i=void 0,(o=V(o="interval"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.interval=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&H(t,e)}(e,t),r=e,(n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&C(r.prototype,n),o&&C(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function $(t){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$(t)}function q(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,J(n.key),n)}}function z(t,e,r){return e=K(e),function(t,e){if(e&&("object"==$(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,G()?Reflect.construct(e,r||[],K(t).constructor):e.apply(t,r))}function G(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(G=function(){return!!t})()}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}function J(t){var e=function(t,e){if("object"!=$(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$(e)?e:e+""}var W=function(t){function e(){var t,r,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=t=z(this,e,[].concat(a)),o=[],(n=J(n="prices"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t),this.prices.length>this.interval&&this.prices.shift(),this.prices.length===this.interval){var r=this.prices.reduce((function(t,e){return t+e}),0);return this.setResult(r/this.prices.length,e)}}}],n&&q(r.prototype,n),o&&q(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(U);function Z(t){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(t)}function Q(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ot(n.key),n)}}function X(t,e,r){return e=et(e),function(t,e){if(e&&("object"==Z(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,tt()?Reflect.construct(e,r||[],et(t).constructor):e.apply(t,r))}function tt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tt=function(){return!!t})()}function et(t){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},et(t)}function rt(t,e){return rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rt(t,e)}function nt(t,e,r){return(e=ot(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ot(t){var e=function(t,e){if("object"!=Z(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Z(e)?e:e+""}var it=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),nt(r=X(this,e),"interval",void 0),nt(r,"indicator",void 0),nt(r,"smoothingFactor",void 0),r.interval=t,r.indicator=new W(t),r.smoothingFactor=1/r.interval,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rt(t,e)}(e,t),r=e,n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.indicator.update(t);if(e&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,e)}if(!e&&void 0!==this.result){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,e)}if(void 0===this.result&&void 0!==r)return this.setResult(r,e)}}],n&&Q(r.prototype,n),o&&Q(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function at(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function ut(t){return ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ut(t)}function lt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ht(n.key),n)}}function ct(t,e,r){return e=ft(e),function(t,e){if(e&&("object"==ut(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,st()?Reflect.construct(e,r||[],ft(t).constructor):e.apply(t,r))}function st(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(st=function(){return!!t})()}function ft(t){return ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ft(t)}function pt(t,e){return pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pt(t,e)}function yt(t,e,r){return(e=ht(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){var e=function(t,e){if("object"!=ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ut(e)?e:e+""}var vt=function(t){function e(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return yt(t=ct(this,e,[].concat(n)),"previousCandle",void 0),yt(t,"twoPreviousCandle",void 0),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.high,n=t.low,o=r-n;if(this.previousCandle&&e&&(this.previousCandle=this.twoPreviousCandle),this.previousCandle){var i=Math.abs(r-this.previousCandle.close),a=Math.abs(n-this.previousCandle.close);return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(Math.max(o,i,a),e)}return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(o,e)}}],n&&lt(r.prototype,n),o&&lt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function dt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jt(n.key),n)}}function bt(t,e,r){return e=wt(e),function(t,e){if(e&&("object"==mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,gt()?Reflect.construct(e,r||[],wt(t).constructor):e.apply(t,r))}function gt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gt=function(){return!!t})()}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}function Ot(t,e){return Ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ot(t,e)}function St(t,e,r){return(e=jt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mt(e)?e:e+""}var Pt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),St(r=bt(this,e),"interval",void 0),St(r,"tr",void 0),St(r,"smoothing",void 0),r.interval=t,r.tr=new vt,r.smoothing=new n(t),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ot(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.tr.update(t,e);if(this.smoothing.update(r,e),this.smoothing.isStable)return this.setResult(this.smoothing.getResult(),e)}}],n&&dt(r.prototype,n),o&&dt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function Nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,At(n.key),n)}}function Tt(t,e,r){return(e=At(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function At(t){var e=function(t,e){if("object"!=_t(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_t(e)?e:e+""}var Et=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),Tt(this,"interval",void 0),Tt(this,"deviationMultiplier",void 0),Tt(this,"prices",[]),Tt(this,"result",void 0),this.interval=e,this.deviationMultiplier=r},(e=[{key:"update",value:function(t){if(this.prices.push(t),this.prices.length>this.interval){this.prices.shift();var e=at(this.prices),r=function(t,e){var r=e||at(t),n=at(t.map((function(t){return t-r})).map((function(t){return t*t})));return Math.sqrt(n)}(this.prices,e);return this.result={lower:e-r*this.deviationMultiplier,middle:e,upper:e+r*this.deviationMultiplier}}}},{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&Nt(t.prototype,e),r&&Nt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function xt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ft(n.key),n)}}function It(t,e,r){return e=Dt(e),function(t,e){if(e&&("object"==kt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Mt()?Reflect.construct(e,r||[],Dt(t).constructor):e.apply(t,r))}function Mt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Mt=function(){return!!t})()}function Dt(t){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dt(t)}function Rt(t,e){return Rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rt(t,e)}function Ct(t,e,r){return(e=Ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ft(t){var e=function(t,e){if("object"!=kt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kt(e)?e:e+""}var Lt=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ct(r=It(this,e,[t]),"interval",void 0),Ct(r,"pricesCounter",0),Ct(r,"weightFactor",void 0),r.interval=t,r.weightFactor=2/(r.interval+1),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?e&&0===this.pricesCounter&&this.pricesCounter++:this.pricesCounter++,e&&void 0!==this.previousResult?this.setResult(t*this.weightFactor+this.previousResult*(1-this.weightFactor),e):this.setResult(t*this.weightFactor+(void 0!==this.result?this.result:t)*(1-this.weightFactor),e)}},{key:"getResult",value:function(){if(this.pricesCounter<this.interval)throw new E;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&xt(r.prototype,n),o&&xt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(U);function Bt(t){return Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bt(t)}function Ht(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ut(n.key),n)}}function Vt(t,e,r){return(e=Ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ut(t){var e=function(t,e){if("object"!=Bt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bt(e)?e:e+""}var $t=function(){return t=function t(e,r,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),Vt(this,"short",void 0),Vt(this,"long",void 0),Vt(this,"signal",void 0),Vt(this,"prices",[]),Vt(this,"result",void 0),this.short=e,this.long=r,this.signal=n},e=[{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t);var r=this.short.update(t,e),n=this.long.update(t,e);if(this.prices.length>this.long.interval&&this.prices.shift(),this.prices.length===this.long.interval){var o=r-n,i=this.signal.update(o,e);return this.result={histogram:o-i,macd:o,signal:i}}}}],e&&Ht(t.prototype,e),r&&Ht(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function qt(t){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(t)}function zt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zt(n.key),n)}}function Gt(t,e,r){return e=Yt(e),function(t,e){if(e&&("object"==qt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Kt()?Reflect.construct(e,r||[],Yt(t).constructor):e.apply(t,r))}function Kt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kt=function(){return!!t})()}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yt(t)}function Jt(t,e){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jt(t,e)}function Wt(t,e,r){return(e=Zt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zt(t){var e=function(t,e){if("object"!=qt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qt(e)?e:e+""}var Qt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Wt(r=Gt(this,e),"interval",void 0),Wt(r,"previousPrices",[]),Wt(r,"avgGain",void 0),Wt(r,"avgLoss",void 0),Wt(r,"maxValue",100),r.interval=t,r.avgGain=new n(r.interval),r.avgLoss=new n(r.interval),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.previousPrices.length&&e?this.previousPrices[this.previousPrices.length-1]=t:this.previousPrices.push(t),!(this.previousPrices.length<2)){var r=t,n=this.previousPrices[this.previousPrices.length-2];if(r>n?(this.avgLoss.update(0,e),this.avgGain.update(t-n,e)):(this.avgLoss.update(n-r,e),this.avgGain.update(0,e)),this.avgGain.isStable){var o=this.avgLoss.getResult();if(0===o)return this.setResult(100,e);var i=this.avgGain.getResult()/o;return this.setResult(this.maxValue-this.maxValue/(i+1),e)}}}}],n&&zt(r.prototype,n),o&&zt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function Xt(t){return Xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xt(t)}function te(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Xt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ee={ema:Lt,sma:W},re=function(t,e,r,n,o){var i=o.target,a=(o.lag,o.precomputed),u=t.verticalOhlcv,l=t.instances,c=a.keyName;if(0===e&&!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(r,"."));var s=u[i][e],f=l[c];f.update(s);var p=NaN;try{p=f.getResult()}catch(t){}return t.pushToMain({index:e,key:c,value:p}),!0},ne=function(t){var e=t.main,r=t.size,n=t.target,o=t.lag,i=t.methodName,a=e.instances,u=e.verticalOhlcv,l=e.priceBased,c=e.arrayTypes,s=e.len,f="close"!==n?"_".concat(n):"",p="".concat(i,"_").concat(r).concat(f);return a[p]=new ee[i](r),u[p]=new Float64Array(s).fill(NaN),l.add(p),o>0&&e.lag([p],o),c[p]="Float64Array",{keyName:p}};function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function ie(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=oe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ae(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ue="close";function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}var ce={number:function(t){return t},numberCleanString:function(t){return Number(t)},numberDirtyString:function(t){return Number(t.replace(/(?!^-)[^0-9.]/g,""))}},se=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("number"==typeof t&&!Number.isNaN(t))return"number";if("string"==typeof t){var r=t.trim(),n=/^-?\d+(\.\d+)?$/;if(n.test(r))return"numberCleanString";var o=r.replace(/[^0-9.]/g,"");if(o&&n.test(o))return"numberDirtyString"}if(e)throw new TypeError("Invalid input: expected a number or numeric string");return le(t)},fe=function(t,e){var r=Math.pow(10,e);return Math.round((t+Number.EPSILON)*r)/r};function pe(t){return function(t){if(Array.isArray(t))return he(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ye(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(t,e){if(t){if("string"==typeof t)return he(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?he(t,e):void 0}}function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ve(t){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(t)}function me(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function de(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=ve(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ve(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function be(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ge(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ge(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function Oe(t){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe(t)}var Se={string:function(t){return t.toISOString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},je={dateObject:function(t){return t},dateMilliseconds:function(t){return new Date(t)},dateSeconds:function(t){return new Date(1e3*t)},dateIncompleteDayString:function(t){return new Date("".concat(t," 00:00:00"))},dateCompleteDateString:function(t){return new Date(t)}},Pe=function(t){var e=["Date -> object","Milliseconds Timestamp -> integer","Seconds Timestamp -> integer","UTC Time Format (ISO 8601) -> string","Including a Timezone Offset (ISO 8601) -> string","Local Time Format (ISO 8601) -> string","YYYY/MM/DD or YYYY-MM-DD -> string"],r=function(){throw new Error('Invalid "'.concat(Oe(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===Oe(t)){if(t instanceof Date&&!isNaN(t.valueOf()))return"dateObject";r()}else{if("number"==typeof t)return Math.abs(t)<1e11?"dateSeconds":"dateMillseconds";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t)&&t.length>10||/^\d{4}\/\d{2}\/\d{2}$/.test(t))return"dateCompleteDateString";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return"dateIncompleteDayString";r()}else r()}};function _e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ne(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ne(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Te=new Set(["open","high","low","close"]),Ae=function(t,e){return"Array"===t?new Array(e).fill(null):"Float64Array"===t?new Float64Array(e).fill(NaN):"Int32Array"===t?new Int32Array(e).fill(NaN):void 0};function Ee(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||xe(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ke(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=xe(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function xe(t,e){if(t){if("string"==typeof t)return Ie(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ie(t,e):void 0}}function Ie(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Me=function(t,e){var r=t.instances,n=t.verticalOhlcv,o=t.len,i=t.arrayTypes,a=t.priceBased;if(0===e){var u,l=[],c=ke(t.inputParams);try{for(c.s();!(u=c.n()).done;){var s=u.value;"lag"===s.key&&l.push(s.params)}}catch(t){c.e(t)}finally{c.f()}for(var f=0,p=l;f<p.length;f++){var y,h=Ee(p[f],2),v=h[0],m=h[1],d=ke(v);try{for(d.s();!(y=d.n()).done;){var b=y.value;if(a.has(b))for(var g=1;g<=m;g++)a.add("".concat(b,"_lag_").concat(g))}}catch(t){d.e(t)}finally{d.f()}}r.lag={lagParams:l}}var w,O=ke(r.lag.lagParams);try{for(O.s();!(w=O.n()).done;){var S,j=Ee(w.value,2),P=j[0],_=j[1],N=ke(P);try{for(N.s();!(S=N.n()).done;){var T=S.value,A=n[T];if(0===e)for(var E=1;E<=_;E++){var k="".concat(T,"_lag_").concat(E);if(!i.hasOwnProperty(T))throw new Error('Lag processing invoked by "'.concat(T,'" expected arrayTypes to have a "').concat(T,'" property, but it wasn’t found.'));n[k]=Ae(i[T],o),i[k]=i[T]}for(var x=1;x<=_;x++){var I="".concat(T,"_lag_").concat(x),M=e-x,D=M<=0||void 0===A[M]?null:A[M];t.pushToMain({index:e,key:I,value:D})}}}catch(t){N.e(t)}finally{N.f()}}}catch(t){O.e(t)}finally{O.f()}return!0};function De(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Re(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Re(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Re(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Ce(t){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ce(t)}function Fe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Le(n.key),n)}}function Le(t){var e=function(t,e){if("object"!=Ce(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ce(e)?e:e+""}var Be=function(t,e){return t>e},He=function(t,e){return t<e},Ve=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,{interval:0,prevState:.5,prevFast:NaN,prevSlow:NaN,prevHigh:NaN,prevLow:NaN,areHighAndLowUndefined:!1,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t,e){var r=e.fast,n=e.high,o=e.slow,i=e.low,a=this.prevState;this.areHighAndLowUndefined||void 0!==n&&void 0!==i||(this.areHighAndLowUndefined=!0),Number.isNaN(r)||Number.isNaN(o)||function(t,e){return t===e}(r,o)?a=.5:Be(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&He(i,o)&&Be(this.prevLow,this.prevSlow)?0:1:He(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&Be(n,o)&&He(this.prevHigh,this.prevSlow)?1:0),.5===a?this.interval=0:1===a?this.prevState<=.5?this.interval=1:this.interval++:0===a&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(t),-1===this.interval&&this.crossIndexes.down.push(t),Object.assign(this,{prevState:a,prevFast:r,prevSlow:o,prevHigh:n,prevLow:i})}},{key:"getResult",value:function(){return this.interval}}])&&Fe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),Ue=function(t,e){var r=t.verticalOhlcv,n=t.instances,o=t.len,i=t.arrayTypes,a=t.verticalOhlcvTempCols;if(0===e){var u=t.inputParams;n.crossPairsList=u.reduce((function(t,e){var r=e.key,n=e.params;if("crossPairs"===r){var o,i=De(n);try{for(i.s();!(o=i.n()).done;){var a,u=De(o.value);try{for(u.s();!(a=u.n()).done;){var l=a.value;t.push(l)}}catch(t){u.e(t)}finally{u.f()}}}catch(t){i.e(t)}finally{i.f()}}return t}),[])}var l,c=De(n.crossPairsList);try{for(c.s();!(l=c.n()).done;){var s=l.value,f=s.fast,p=s.slow;if(null!=f&&null!=p){var y="".concat(f,"_x_").concat(p);if(0===e){if("number"==typeof p&&(a.add(p.toString()),r[p.toString()]=new Int32Array(o).fill(p)),"price"!==f&&!r.hasOwnProperty(f))throw Error('fast "'.concat(f,' not found in crossPairs"'));if(!r.hasOwnProperty(p))throw Error('slow "'.concat(p,' not found in crossPairs"'));n[y]=new Ve,r[y]=new Int32Array(o).fill(NaN),i[y]="Int32Array"}var h=void 0,v=void 0,m=void 0,d=void 0,b=void 0;"price"===f?(v=r.close[e],m=r.high[e],d=r.low[e],b=r[p][e],n[y].update(e,{fast:v,slow:b,high:m,low:d})):(h=r[f][e],b=r[p][e],n[y].update(e,{fast:h,slow:b})),t.pushToMain({index:e,key:y,value:n[y].getResult()})}}}catch(t){c.e(t)}finally{c.f()}};function $e(t){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$e(t)}function qe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ze(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=$e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=$e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$e(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ge(t){return function(t){if(Array.isArray(t))return Je(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ye(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ye(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Ye(t,e){if(t){if("string"==typeof t)return Je(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Je(t,e):void 0}}function Je(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function We(t){return function(t){if(Array.isArray(t))return tr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Xe(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ze(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Xe(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Qe(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Xe(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xe(t,e){if(t){if("string"==typeof t)return tr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tr(t,e):void 0}}function tr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var er={dateTime:function(t,e,r){var n=r.lag,o=t.instances,i=t.verticalOhlcv;if(0===e){var a=t.len,u=t.dateType,l=t.arrayTypes;if(!u)throw Error('dateTime method found and invalid "date" in input ohlcv');Object.assign(o,{dateTime:{prevDateStr:i.date[0],sessionDailyIndexCount:0,sessionIntradayIndexCount:0,cachedDayInfo:i.date[0]}});for(var c=["day_of_the_week","day_of_the_month","week_of_the_month","minute","hour","month","year","session_daily_index","session_intraday_index"],s=0,f=c;s<f.length;s++)l[f[s]]="Int32Array";Object.assign(i,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?qe(Object(r),!0).forEach((function(e){ze(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},Object.fromEntries(c.map((function(t){return[t,new Int32Array(a).fill(NaN)]}))))),n>0&&t.lag(c,n)}var p=i.date[e],y=function(t){var e=t.getMonth(),r=t.getFullYear(),n=t.getHours(),o=t.getMinutes(),i=t.getDay(),a=t.getDate(),u=new Date(t.getFullYear(),t.getMonth(),1).getDay();return{month:e,year:r,hour:n,minute:o,day_of_the_week:i,day_of_the_month:a,week_of_the_month:Math.ceil((a+u)/7)}}(p),h=y.day_of_the_week,v=y.day_of_the_month,m=y.week_of_the_month,d=y.month,b=y.year,g=y.hour,w=y.minute,O=p;O!==o.dateTime.prevDateStr&&(o.dateTime.prevDateStr=O,o.dateTime.sessionDailyIndexCount++,o.dateTime.sessionIntradayIndexCount=0),t.pushToMain({index:e,key:"session_daily_index",value:o.dateTime.sessionDailyIndexCount}),t.pushToMain({index:e,key:"session_intraday_index",value:o.dateTime.sessionIntradayIndexCount}),t.pushToMain({index:e,key:"day_of_the_week",value:h}),t.pushToMain({index:e,key:"day_of_the_month",value:v}),t.pushToMain({index:e,key:"week_of_the_month",value:m}),t.pushToMain({index:e,key:"month",value:d}),t.pushToMain({index:e,key:"year",value:b}),t.pushToMain({index:e,key:"hour",value:g}),t.pushToMain({index:e,key:"minute",value:w}),o.dateTime.sessionIntradayIndexCount++},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=t.verticalOhlcv,u=t.instances,l="close"===o?"":"_".concat(o),c="rsi_".concat(r).concat(l),s="rsi_sma_".concat(r).concat(l);if(0===e){var f=t.crossPairsList,p=t.len,y=t.arrayTypes;if(!a.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));f.push({fast:c,slow:s,isDefault:!0}),Object.assign(u,te(te({},c,new Qt(r)),s,new W(r))),Object.assign(a,te(te({},c,new Float64Array(p).fill(NaN)),s,new Float64Array(p).fill(NaN)));var h=[c,s];i>0&&t.lag(h,i);for(var v=0,m=h;v<m.length;v++)y[m[v]]="Float64Array"}var d=a[o][e],b=NaN,g=NaN;u[c].update(d);try{b=u[c].getResult()}catch(t){b=NaN}t.pushToMain({index:e,key:c,value:b}),Number.isNaN(b)||u[s].update(b);try{g=u[s].getResult()}catch(t){g=NaN}t.pushToMain({index:e,key:s,value:g})},atr:function(t,e,r,n){var o=n.lag,i=n.percentage,a=n.upper,u=n.lower,l=t.verticalOhlcv,c=t.instances,s="atr_".concat(r);if(0===e){var f=t.instances,p=t.verticalOhlcv,y=t.arrayTypes,h=t.len,v=t.priceBased;f[s]=new Pt(r,it);var m=[s];i&&m.push("".concat(s,"_percentage")),null!==a&&m.push("".concat(s,"_upper")),null!==u&&m.push("".concat(s,"_lower"));for(var d=0,b=m;d<b.length;d++){var g=b[d];g.endsWith("_percentage")||v.add(g),p[g]=new Float64Array(h).fill(NaN),y[g]="Float64Array"}o>0&&t.lag(m,o)}var w={high:l.high[e],low:l.low[e],close:l.close[e]},O=c[s];O.update(w);var S=NaN;try{S=O.getResult()}catch(t){}if(i){var j=Number.isNaN(S)?NaN:S/w.close;t.pushToMain({index:e,key:"".concat(s,"_percentage"),value:j})}if(null!==a){var P=Number.isNaN(S)?NaN:w.close+S*a;t.pushToMain({index:e,key:"".concat(s,"_upper"),value:P})}if(null!==u){var _=Number.isNaN(S)?NaN:w.close-S*u;t.pushToMain({index:e,key:"".concat(s,"_lower"),value:_})}return t.pushToMain({index:e,key:s,value:S}),!0},ema:re,sma:re,macd:function(t,e,r,n,o,i){var a=i.target,u=i.lag,l=i.precomputed,c=t.verticalOhlcv,s=t.instances,f=l.instanceKey;if(0===e){var p=t.inputParams,y=t.crossPairsList,h=t.priceBased,v=t.len,m=t.arrayTypes;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var d,b=0,g=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ae(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ae(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(p);try{for(g.s();!(d=g.n()).done;)"macd"===d.value.key&&b++}catch(t){g.e(t)}finally{g.f()}var w=b>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",O=a===ue?"".concat(w,"_diff"):"".concat(w,"_diff_").concat(a),S=a===ue?"".concat(w,"_dea"):"".concat(w,"_dea_").concat(a),j=a===ue?"".concat(w,"_histogram"):"".concat(w,"_histogram_").concat(a);y.push({fast:O,slow:S,isDefault:!0}),s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:b,settings:{}}),s.macd.settings[f]=new $t(new Lt(r),new Lt(n),new Lt(o)),Object.assign(c,ie(ie(ie({},O,new Float64Array(v).fill(NaN)),S,new Float64Array(v).fill(NaN)),j,new Float64Array(v).fill(NaN)))[j].forEach((function(t){h.add(t)}));var P=[O,S,j];u>0&&t.lag(P,u);for(var _=0,N=P;_<N.length;_++)m[N[_]]="Float64Array"}var T=s.macd,A=T.numberOfIndicators,E=T.settings,k=A>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",x=a===ue?"".concat(k,"_diff"):"".concat(k,"_diff_").concat(a),I=a===ue?"".concat(k,"_dea"):"".concat(k,"_dea_").concat(a),M=a===ue?"".concat(k,"_histogram"):"".concat(k,"_histogram_").concat(a),D=E[f],R=c[a][e];D.update(R);var C={};try{C=D.getResult()}catch(t){}return t.pushToMain({index:e,key:x,value:C?C.macd:NaN}),t.pushToMain({index:e,key:I,value:C?C.signal:NaN}),t.pushToMain({index:e,key:M,value:C?C.histogram:NaN}),!0},relativeVolume:function(t,e,r,n){var o=n.lag,i="relative_volume_".concat(r),a=t.instances,u=t.verticalOhlcv;if(0===e){var l=t.len,c=t.arrayTypes;a[i]={instance:new W(r),prevRelativeVolumeSma:NaN},u[i]=new Float64Array(l).fill(NaN),o>0&&t.lag([i],o),c[i]="Float64Array"}var s=u.volume[e],f=a[i].instance;f.update(s);var p=NaN;try{p=f.getResult()}catch(t){}var y=a[i].prevRelativeVolumeSma,h=NaN;return Number.isNaN(p)||Number.isNaN(y)||(h=s/y),t.pushToMain({index:e,key:i,value:h}),a[i].prevRelativeVolumeSma=p,!0},donchianChannels:function(t,e,r,n,o){var i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.inputParams,c=t.priceBased,s=t.arrayTypes,f=t.lag,p=o.height,y=o.range,h=o.decimals,v="".concat(r,"_").concat(n);if(0===e){var m=l.filter((function(t){return"donchianChannels"===t.key})).length,d="donchian_channel",b=m>1?"".concat(d,"_").concat(v):d,g=["upper","basis","lower"].map((function(t){return"".concat(b,"_").concat(t)}));p&&g.push("".concat(b,"_height"));var w,O=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ye(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(y);try{for(O.s();!(w=O.n()).done;){var S=w.value;if(!(S in i)||!c.has(S))throw new Error('Invalid range key "'.concat(S,'". Only price-based keys are allowed: ').concat(pe(c)));g.push("".concat(b,"_range_").concat(S))}}catch(t){O.e(t)}finally{O.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:m,settings:{}}),a.donchian_channel.numberOfIndicators=m,a.donchian_channel.settings[v]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(g.map((function(t){return[t,new Float64Array(u).fill(NaN)]})))),f>0&&t.lag(g,f),["upper","basis","lower"].forEach((function(t){return c.add("".concat(b,"_").concat(t))})),g.forEach((function(t){return s[t]="Float64Array"}))}var j=a.donchian_channel,P=j.numberOfIndicators,_=j.settings,N=P>1?"donchian_channel_".concat(v):"donchian_channel",T=_[v],A=T.maxDeque,E=T.minDeque,k=e-n,x=k-r+1,I=["upper","basis","lower"].map((function(t){return"".concat(N,"_").concat(t)}));p&&I.push("".concat(N,"_height"));var M=y.map((function(t){return"".concat(N,"_range_").concat(t)}));if(x<0||k+1>u)return[].concat(pe(I),pe(M)).forEach((function(r){return t.pushToMain({index:e,key:r,value:NaN})})),!0;var D=i.high,R=i.low,C=function(t,e,r){for(;t.length&&t[0]<x;)t.shift();for(;t.length&&r(e[t.at(-1)],e[k]);)t.pop();t.push(k)};C(A,D,(function(t,e){return t<=e})),C(E,R,(function(t,e){return t>=e}));var F=A.length&&E.length,L=F?D[A[0]]:NaN,B=F?R[E[0]]:NaN,H=F?(L+B)/2:NaN;if(t.pushToMain({index:e,key:"".concat(N,"_upper"),value:L}),t.pushToMain({index:e,key:"".concat(N,"_basis"),value:H}),t.pushToMain({index:e,key:"".concat(N,"_lower"),value:B}),p){var V=F&&B?(L-B)/B:NaN;t.pushToMain({index:e,key:"".concat(N,"_height"),value:null===h?V:fe(V,h)})}for(var U=F?L-B:NaN,$=0;$<y.length;$++){var q=i[y[$]][e],z=F&&q==q&&U?(q-B)/U:NaN;t.pushToMain({index:e,key:M[$],value:null===h?z:fe(z,h)})}return!0},bollingerBands:function(t,e,r,n,o){var i,a,u,l,c,s,f,p=o.height,y=o.range,h=void 0===y?[]:y,v=o.target,m=o.lag,d=o.decimals,b=t.verticalOhlcv,g=t.instances,w="close"===v?"":"_".concat(v),O="".concat(r,"_").concat(n).concat(w);if(0===e){var S=t.priceBased,j=t.inputParams,P=t.verticalOhlcv,_=t.len,N=t.arrayTypes;if(!(v in P))throw new Error('bollingerBands could not find target "'.concat(v,'"'));var T,A=0,E=be(j);try{for(E.s();!(T=E.n()).done;)"bollingerBands"===T.value.key&&A++}catch(t){E.e(t)}finally{E.f()}f=A>1?"bollinger_bands_".concat(O):"bollinger_bands".concat(w),g.bollinger_bands||(g.bollinger_bands={numberOfIndicators:A,settings:{}}),g.bollinger_bands.settings[O]=new Et(r,n);var k=["".concat(f,"_upper"),"".concat(f,"_middle"),"".concat(f,"_lower")];p&&k.push("".concat(f,"_height"));var x,I=be(h);try{for(I.s();!(x=I.n()).done;){var M=x.value;if(!(M in P)||!S.has(M))throw new Error('Invalid range item value "'.concat(M,'" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(S)));k.push("".concat(f,"_range_").concat(M))}}catch(t){I.e(t)}finally{I.f()}var D=Object.fromEntries(k.map((function(t){return[t,new Float64Array(_).fill(NaN)]})));Object.assign(P,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?me(Object(r),!0).forEach((function(e){de(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):me(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},D)),m>0&&t.lag(k,m),["".concat(f,"_upper"),"".concat(f,"_middle"),"".concat(f,"_lower")].forEach((function(t){S.add(t)}));for(var R=0,C=k;R<C.length;R++)N[C[R]]="Float64Array"}f||(f=g.bollinger_bands.numberOfIndicators>1?"bollinger_bands_".concat(O):"bollinger_bands".concat(w));var F=f,L=g.bollinger_bands.settings[O],B=b[v][e];L.update(B);var H={};try{H=L.getResult()}catch(t){}var V=null!==(i=null===(a=H)||void 0===a?void 0:a.upper)&&void 0!==i?i:NaN,U=null!==(u=null===(l=H)||void 0===l?void 0:l.middle)&&void 0!==u?u:NaN,$=null!==(c=null===(s=H)||void 0===s?void 0:s.lower)&&void 0!==c?c:NaN;if(t.pushToMain({index:e,key:"".concat(F,"_upper"),value:V}),t.pushToMain({index:e,key:"".concat(F,"_middle"),value:U}),t.pushToMain({index:e,key:"".concat(F,"_lower"),value:$}),p){var q=NaN;Number.isNaN($)||Number.isNaN(V)||(q=(V-$)/$),t.pushToMain({index:e,key:"".concat(F,"_height"),value:null===d?q:fe(q,d)})}var z,G=be(h);try{for(G.s();!(z=G.n()).done;){var K=z.value,Y=NaN,J=b[K][e];Number.isNaN(J)||Number.isNaN($)||Number.isNaN(V)||(Y=(J-$)/(V-$)),t.pushToMain({index:e,key:"".concat(F,"_range_").concat(K),value:null===d?Y:fe(Y,d)})}}catch(t){G.e(t)}finally{G.f()}return!0},volumeOscillator:function(t,e,r,n,o){var i,a,u,l=o.lag,c=t.verticalOhlcv,s=t.instances,f=c.volume[e],p="volume_oscillator_".concat(r,"_").concat(n);if(0===e){var y=t.crossPairsList,h=t.len,v=t.arrayTypes;Object.assign(s,(i={},a=p,u={fastEMA:new Lt(r),slowEMA:new Lt(n)},(a=function(t){var e=function(t,e){if("object"!=we(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==we(e)?e:e+""}(a))in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,i)),c[p]=new Float64Array(h).fill(NaN),y.push({fast:p,slow:0,isDefault:!0}),l>0&&t.lag([p],l),v[p]="Float64Array"}var m=s[p],d=m.fastEMA,b=m.slowEMA;d.update(f),b.update(f);var g=NaN,w=NaN;try{g=d.getResult()}catch(t){}try{w=b.getResult()}catch(t){}var O=NaN;return Number.isNaN(g)||Number.isNaN(w)||(O=100*(g-w)/w),t.pushToMain({index:e,key:p,value:O}),!0},scaler:function(t,e,r,n,o){var i=o.type,a=o.group,u=o.range,l=o.lag,c=o.precomputed,s=o.decimals,f=c.groupKey,p=c.groupKeyLen,y=t.verticalOhlcv,h=t.instances,v=t.arrayTypes,m="".concat(i,"_").concat(r);if(0===e){var d=t.len;h.hasOwnProperty("scaler")||(h.scaler={windows:{}});var b,g=Ke(n);try{var w=function(){var e=b.value;if(!y.hasOwnProperty(e))throw new Error('Target property "'.concat(e,'" not found in verticalOhlcv'));var r="".concat(m,"_").concat(e);y[r]=new Float64Array(d).fill(NaN),v[r]="Float64Array";var n=a?f:e;if(h.scaler.windows[n]=[],a&&(t.scaledGroups[f]||(t.scaledGroups[f]=[]),t.scaledGroups[f].push(r)),l>0){if(a){var o,i=Array.from({length:l}).map((function(t,e){return"".concat(r,"_lag_").concat(e+1)}));(o=t.scaledGroups[f]).push.apply(o,Ge(i))}t.lag([r],l)}};for(g.s();!(b=g.n()).done;)w()}catch(t){g.e(t)}finally{g.f()}}var O,S=h.scaler.windows,j=Ke(n);try{for(j.s();!(O=j.n()).done;){var P=O.value,_=y[P][e],N=S[a?f:P];N.push(_),N.length>(a?r*p:r)&&N.shift()}}catch(t){j.e(t)}finally{j.f()}var T,A=e+1>=r,E=Ke(n);try{var k=function(){var r,n,o,l,c,p,h,v,d=T.value,b=y[d][e],g="".concat(m,"_").concat(d),w=null;if(A){var O=S[a?f:d];if("minmax"===i){r=b,n=Math.min.apply(Math,Ge(O)),o=Math.max.apply(Math,Ge(O)),v=2,l=function(t){if(Array.isArray(t))return t}(h=u)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(h,v)||Ye(h,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=l[0],p=l[1],w=(Math.min(Math.max(r,n),o)-n)/(o-n)*(p-c)+c}else{if("zscore"!==i)throw new Error('Unknown scaler type "'.concat(i,'"'));var j=O.reduce((function(t,e){return t+e}),0)/O.length,P=O.reduce((function(t,e){return t+Math.pow(e-j,2)}),0)/O.length,_=Math.sqrt(P);w=function(t,e,r){return 0===r?0:(t-e)/r}(b,j,_)}}t.pushToMain({index:e,key:g,value:null===s?w:fe(w,s)})};for(E.s();!(T=E.n()).done;)k()}catch(t){E.e(t)}finally{E.f()}}},rr=function(t,e){for(var r=t.length,n=new W(e),o=new Array(r),i=0,a=0,u=0,l=0;l<r;l++)if(n.update(t[l]),n.isStable){var c=n.getResult();o[l]=c,i+=c,a+=c*c,u++}else o[l]=null;var s=i/u,f=a/u-s*s,p=Math.sqrt(f);return o.map((function(t){return null!==t?(t-s)/p:null}))},nr=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(t.length!==e.length)throw new Error("Both arrays must have the same length");for(var n=rr(t,r),o=rr(e,r),i=t.length,a=[],u=0,l=0,c=0,s=0,f=0,p=0,y=-1,h=0;h<i;h++){if(null!==n[h]&&null!==o[h]){y=h;break}a.push(0)}if(-1===y)return new Array(i).fill(0);for(var v=y;v<i;v++){var m=n[v],d=o[v];if(null!==m&&null!==d)if(u+=m,l+=d,c+=m*d,s+=m*m,f+=d*d,++p<2)a.push(0);else{var b=p*c-u*l,g=Math.sqrt((p*s-u*u)*(p*f-l*l)),w=0===g?0:b/g;a.push(w)}else u=l=c=s=f=p=0,a.push(0)}return a};function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ir=function(t){var e,r,n=t.main,o=t.skipNull,i=void 0!==o&&o,a=t.startIndex,u=void 0===a?0:a,l=t.dateFormat,c=n.precisionMultiplier,s=n.priceBased,f=n.precision,p=n.verticalOhlcv,y=n.invalidValueIndex,h=n.len,v=n.verticalOhlcvKeyNames,m=n.verticalOhlcvTempCols;if(0===v.length)return[];for(var d=i&&y>=0?y+1:0,b=Math.max(d,u),g=h-b,w=Array.from({length:g},(function(){return{}})),O=0,S=Object.entries(p);O<S.length;O++){var j=(e=S[O],r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(e,r)||function(t,e){if(t){if("string"==typeof t)return or(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?or(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),P=j[0],_=j[1];if(!m.has(P))for(var N=s.has(P)&&f,T=b;T<h;T++)w[T-b][P]=N?_[T]/c:"date"===P?Se[l](_[T]):_[T]}return w};function ar(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||ur(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ur(t,e){if(t){if("string"==typeof t)return lr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lr(t,e):void 0}}function lr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function cr(t){return cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cr(t)}function sr(t){return function(t){if(Array.isArray(t))return yr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||pr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||pr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pr(t,e){if(t){if("string"==typeof t)return yr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yr(t,e):void 0}}function yr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function hr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vr(n.key),n)}}function vr(t){var e=function(t,e){if("object"!=cr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cr(e)?e:e+""}var mr=function(){return t=function t(e){var r=this,n=e.input,o=e.ticker,i=void 0===o?null:o,u=e.precision,c=void 0===u||u,s=e.inputParams,y=void 0===s?null:s,h=e.chunkProcess,v=void 0===h?2e3:h;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l(n,"input",null!==i?"contructor ".concat(i):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+i);f(c,"precision","constructor"),p(v,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),this.chunkProcess=v,this.firstRow=n[0];var m=function(t){for(var e={},r={},n=0,o=Object.entries(t);n<o.length;n++){var i=_e(o[n],2),a=i[0],u=i[1];if("date"===a)e[a]=Pe(u),r[a]="Array";else if("volume"===a)e[a]=se(u,!0),r[a]="Int32Array";else if(Te.has(a))e[a]=se(u,!0),r[a]="Float64Array";else{var l=se(u,!1);e[a]=l,r[a]="number"===l?"Float64Array":"Array"}}return{inputTypes:e,arrayTypes:r}}(this.firstRow),d=m.inputTypes,b=m.arrayTypes;if(this.inputTypes=d,this.arrayTypes=b,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(i));return this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.input=n,this.priceBased=new Set(["open","high","low","close"]),this.len=n.length,this.instances={},this.crossPairsList=[],this.verticalOhlcv={},this.verticalOhlcvKeyNames=[],this.verticalOhlcvTempCols=new Set,this.utilities={correlation:nr},this.invalidValueIndex=-1,this.precision=c,this.precisionMultiplier=function(t,e){var r=t.precision,n=t.priceBased;if(!1===r)return 1;var o,i=1,a=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ur(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(Object.entries(e).filter((function(t){var e=ar(t,2),r=e[0];return e[1],n.has(r)})).map((function(t){var e=ar(t,2);return e[0],e[1]})));try{for(a.s();!(o=a.n()).done;){var u=o.value,l=ar(String(u).split("."),2)[1],c=void 0===l?"":l,s=Math.max(4,c.length),f=s>1?Math.pow(10,s-1):1;f>i&&(i=f)}}catch(t){a.e(t)}finally{a.f()}return i}(this,this.firstRow),this.scaledGroups={},this.pushToMain=function(t){var e=t.index,n=t.key,o=t.value;return function(t){var e=t.main,r=t.index,n=t.key,o=t.value,i=e.verticalOhlcv;return null==o||Number.isNaN(o)?(e.invalidValueIndex=r,i[n][r]=o,!1):(i[n][r]=o,!0)}({main:r,index:e,key:n,value:o})},null!==y&&(a(y,this.len),this.inputParams=y,this.compute()),this.inputParams=[],this},e=[{key:"getDataAsCols",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.skipNull,r=void 0===e||e,n=t.dateFormat,o=void 0===n?"string":n;s(Object.keys(Se),o,"dateFormat","getDataAsCols"),c(t,"options","getDataAsCols");for(var i=this.precisionMultiplier,a=this.precision,u=this.invalidValueIndex,l=this.len,f=this.verticalOhlcv,p=this.priceBased,y=this.arrayTypes,h=this.verticalOhlcvTempCols,v={},m=r?u+1:0,d=l-m,b=0,g=Object.entries(f);b<g.length;b++){var w=fr(g[b],2),O=w[0],S=w[1];if(!h.has(O)){var j=p.has(O)&&a;v[O]=Ae(y[O],d);for(var P=m;P<l;P++)v[O][P]=j?S[P]/i:"date"===O?Se[o](S[P]):S[P]}}return v}},{key:"getData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.skipNull,r=void 0===e||e,n=t.dateFormat,o=void 0===n?"string":n;return s(Object.keys(Se),o,"dateFormat","getData"),c(t,"options","getData"),ir({main:this,skipNull:r,startIndex:0,dateFormat:o})}},{key:"getLastValues",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.dateFormat,r=void 0===e?"string":e;return s(Object.keys(Se),r,"dateFormat","getData"),ir({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:r})[0]}},{key:"compute",value:function(){return this.isComputed||(this.isComputed=!1,this.len>0&&(function(t,e){var r=e.len,n=e.inputParams,o=e.priceBased,i=e.precisionMultiplier,u=e.arrayTypes,l=e.verticalOhlcv,c=e.verticalOhlcvKeyNames,s=e.inputTypes,f=e.chunkProcess;a(n,r);for(var p=0,y=Object.keys(s);p<y.length;p++){var h=y[p];l[h]=Ae(u[h],r)}for(var v=0;v<r;v+=f)for(var m=Math.min(v+f,r),d=v;d<m;d++){for(var b=t[d],g=0,w=Object.entries(s);g<w.length;g++){var O=Qe(w[g],2),S=O[0],j=O[1],P=b[S];if(ce.hasOwnProperty(j)){var _=ce[j](P);i>1&&o.has(S)&&(_*=i),e.pushToMain({index:d,key:S,value:_})}else je.hasOwnProperty(j)?e.pushToMain({index:d,key:S,value:je[j](P)}):e.pushToMain({index:d,key:S,value:P})}var N,T=Ze(n);try{for(T.s();!(N=T.n()).done;){var A=N.value,E=A.key,k=A.params;"lag"!==E&&"crossPairs"!==E&&er[E].apply(er,[e,d].concat(We(k)))}}catch(t){T.e(t)}finally{T.f()}Me(e,d),Ue(e,d),t[d]=null}c.push.apply(c,We(Object.keys(l)))}(this.input,this),this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[])),this}},{key:"crossPairs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e="crossPairs";return u(this),l(t,"arr",e),this.crossPairsList=[].concat(sr(this.crossPairsList),sr(t)),this.inputParams.push({key:e,params:[this.crossPairsList]}),this}},{key:"lag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r="lag";u(this),l(t,"colKeys",r),p(e,{min:1,max:this.len,allowDecimals:!1},"lookback",r),this.inputParams.push({key:r,params:[t,e]});var n,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=pr(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t);try{for(o.s();!(n=o.n()).done;){var i=n.value;this.priceBased.has(i)&&this.priceBased.add(i)}}catch(t){o.e(t)}finally{o.f()}return this}},{key:"relativeVolume",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="relativeVolume";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[t,{lag:o}]}),this}},{key:"atr",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="atr";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.percentage,a=void 0!==i&&i,l=e.upper,s=void 0===l?null:l,y=e.lower,h=void 0===y?null:y;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(a,"options.percentage","atr"),null!==s&&p(s,{min:.001,max:100,allowDecimals:!0},"options.upper","atr"),null!==h&&p(h,{min:.001,max:100,allowDecimals:!0},"options.lower","atr"),this.inputParams.push({key:r,params:[t,{lag:o,percentage:a,upper:s,lower:h}]}),this}},{key:"ema",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="ema";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r);var l=ne({main:this,size:t,target:o,lag:a,methodName:r});return this.inputParams.push({key:r,params:[r,t,{target:o,lag:a,precomputed:l}]}),this}},{key:"sma",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="sma";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r);var l=ne({main:this,size:t,target:o,lag:a,methodName:r});return this.inputParams.push({key:r,params:[r,t,{target:o,lag:a,precomputed:l}]}),this}},{key:"macd",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:26,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="macd";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),p(e,{min:1,max:this.len,allowDecimals:!1},"slow",o),p(r,{min:1,max:this.len,allowDecimals:!1},"signal",o),c(n,"options",o);var i=n.target,a=void 0===i?"close":i,l=n.lag,s=void 0===l?0:l;p(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var f={instanceKey:"".concat(t,"_").concat(e,"_").concat(r).concat("close"===a?"":"_".concat(a))};return this.inputParams.push({key:o,params:[t,e,r,{target:a,lag:s,precomputed:f}]}),this}},{key:"bollingerBands",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="bollingerBands";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),p(e,{min:.01,max:50,allowDecimals:!0},"stdDev",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.height,s=void 0!==a&&a,y=r.range,h=void 0===y?[]:y,v=r.lag,m=void 0===v?0:v,d=r.decimals,b=void 0===d?null:d;return l(h,"options.range",n),p(m,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(s,"options.height",n),null!==b&&p(b,{min:1,max:15,allowDecimals:!1},"decimals",n),this.inputParams.push({key:n,params:[t,e,{target:i,height:s,range:h,lag:m,decimals:b}]}),this}},{key:"rsi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="rsi";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[t,{target:o,lag:a}]}),this}},{key:"donchianChannels",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="donchianChannels";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),p(e,{min:0,max:this.len,allowDecimals:!1},"offset",n),c(r,"options",n);var o=r.height,i=void 0!==o&&o,a=r.range,s=void 0===a?[]:a,y=r.lag,h=void 0===y?0:y,v=r.decimals,m=void 0===v?null:v;return l(s,"options.range",n),p(h,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(i,"options.height",n),null!==m&&p(m,{min:1,max:15,allowDecimals:!1},"decimals",n),this.inputParams.push({key:n,params:[t,e,{height:i,range:s,lag:h,decimals:m}]}),this}},{key:"volumeOscillator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="volumeOscillator";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"fastSize",n),p(e,{min:t,max:this.len,allowDecimals:!1},"slowSize",n),c(r,"options",n);var o=r.lag,i=void 0===o?0:o;return p(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,params:[t,e,{lag:i}]}),this}},{key:"dateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="dateTime";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r;return p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),this.inputParams.push({key:e,params:[{lag:n}]}),this}},{key:"scaler",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="scaler";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),l(e,"colKeys",n);var i=r.group,a=void 0!==i&&i,c=r.range,y=void 0===c?[0,1]:c,h=r.lag,v=void 0===h?0:h,m=r.type,d=void 0===m?"minmax":m,b=r.decimals,g=void 0===b?null:b;f(a,"options.group",n),function(t,e,r){if(l(t,e,r),2!==t.length)throw new Error('Invalid "'.concat(e,'" array length: expected 2 items, but got ').concat(t.length,' in "').concat(r,".").concat(e,'".'));var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),i=n[0],a=n[1];if(p(i,{min:-100,max:a,allowDecimals:!1},"min",r),p(a,{min:i,max:100,allowDecimals:!1},"max",r),i===a)throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(r,".").concat(e,'".'))}(y,"options.range",n),s(["minmax","zscore"],d,"options.type",n),null!==g&&p(g,{min:1,max:15,allowDecimals:!1},"decimals",n);var w={groupKey:a?"".concat(d,"_").concat(t,"_group_").concat(e.join("_")):"",groupKeyLen:e.length};return this.inputParams.push({key:n,params:[t,e,{type:d,group:a,range:y,lag:v,precomputed:w,decimals:g}]}),this}}],e&&hr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();