ohlcv-indicators 3.4.5 → 3.4.7
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.
- package/dist/ohlcv-indicators.min.js +1121 -1077
- package/index.js +50 -15
- package/package.json +1 -1
- package/src/moving-averages/bollingerBands.js +4 -3
- package/src/moving-averages/donchianChannel.js +7 -13
- package/src/studies/scaler.js +6 -2
- package/src/utilities/dateUtilities.js +7 -0
- package/src/utilities/numberUtilities.js +8 -0
- package/src/utilities/verticalToHorizontal.js +16 -8
|
@@ -130,21 +130,47 @@ var OHLCV_INDICATORS;
|
|
|
130
130
|
t.r(e),
|
|
131
131
|
// EXPORTS
|
|
132
132
|
t.d(e, {
|
|
133
|
-
default: () => /* binding */
|
|
133
|
+
default: () => /* binding */ Ir
|
|
134
134
|
});
|
|
135
|
-
var u = function(t) {
|
|
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) {
|
|
136
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.');
|
|
137
|
-
},
|
|
159
|
+
}, c = function(t, e, r) {
|
|
138
160
|
if (!Array.isArray(t)) throw new Error('Param "'.concat(e, '" must be an array in "').concat(r, '".'));
|
|
139
161
|
return !0;
|
|
140
|
-
},
|
|
162
|
+
}, s = function(t, e, r) {
|
|
141
163
|
if (!Boolean(t) || "object" == !n(t)) throw new Error('Param "'.concat(e, '" must be an object in "').concat(r, '".'));
|
|
142
164
|
return !0;
|
|
143
|
-
},
|
|
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) {
|
|
144
170
|
if ("boolean" != typeof t) throw new Error('Param "'.concat(e, '" must be an boolean in "').concat(r, '".'));
|
|
145
171
|
return !0;
|
|
146
|
-
},
|
|
147
|
-
|
|
172
|
+
}, h = function(t, e, r, n) {
|
|
173
|
+
s(e, "options", "".concat(n, ".").concat(r, ".validateNumber"));
|
|
148
174
|
var o = e.allowDecimals, i = void 0 !== o && o, a = e.min, u = e.max, l = i ? "number" : "integer";
|
|
149
175
|
if ("number" != typeof t || !1 === i && !Number.isInteger(t)) throw new Error('Param "'.concat(r, '" must be an integer in "').concat(n, '".'));
|
|
150
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".'));
|
|
@@ -153,14 +179,14 @@ var OHLCV_INDICATORS;
|
|
|
153
179
|
return !0;
|
|
154
180
|
}, // 0, 1, 2 or 3
|
|
155
181
|
// The maximum value of DP and Big.DP.
|
|
156
|
-
|
|
182
|
+
p = 1e6, // 0 to 1000000
|
|
157
183
|
// The maximum magnitude of the exponent argument to the pow method.
|
|
158
|
-
|
|
184
|
+
v = 1e6, // true or false
|
|
159
185
|
/**************************************************************************************************/
|
|
160
186
|
// Error messages.
|
|
161
|
-
|
|
187
|
+
m = "[big.js] ", d = m + "Invalid ", b = d + "decimal places", g = d + "rounding mode", w = m + "Division by zero",
|
|
162
188
|
// The shared prototype object.
|
|
163
|
-
|
|
189
|
+
S = {}, O = void 0, j = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
164
190
|
/*
|
|
165
191
|
* Round Big x to a maximum of sd significant digits using rounding mode rm.
|
|
166
192
|
*
|
|
@@ -169,10 +195,10 @@ var OHLCV_INDICATORS;
|
|
|
169
195
|
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
170
196
|
* [more] {boolean} Whether the result of division was truncated.
|
|
171
197
|
*/
|
|
172
|
-
function
|
|
198
|
+
function P(t, e, r, n) {
|
|
173
199
|
var o = t.c;
|
|
174
|
-
if (r ===
|
|
175
|
-
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] !==
|
|
200
|
+
if (r === O && (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] !== O))),
|
|
176
202
|
o.length = 1, n ? (
|
|
177
203
|
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
|
178
204
|
t.e = t.e - e + 1, o[0] = 1) :
|
|
@@ -181,7 +207,7 @@ var OHLCV_INDICATORS;
|
|
|
181
207
|
// Round up?
|
|
182
208
|
if (
|
|
183
209
|
// xc[sd] is the digit after the digit that may be rounded up.
|
|
184
|
-
n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !==
|
|
210
|
+
n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !== O || 1 & o[e - 1])) || 3 === r && (n || !!o[0]),
|
|
185
211
|
// Remove any digits after the required precision.
|
|
186
212
|
o.length = e, n)
|
|
187
213
|
// Rounding up may mean the previous digit has to be rounded up.
|
|
@@ -197,7 +223,7 @@ var OHLCV_INDICATORS;
|
|
|
197
223
|
/*
|
|
198
224
|
* Return a string representing the value of Big x in normal or exponential notation.
|
|
199
225
|
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
200
|
-
*/ function
|
|
226
|
+
*/ function _(t, e, r) {
|
|
201
227
|
var n = t.e, o = t.c.join(""), i = o.length;
|
|
202
228
|
// Exponential notation?
|
|
203
229
|
if (e) o = o.charAt(0) + (i > 1 ? "." + o.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
|
|
@@ -211,7 +237,7 @@ var OHLCV_INDICATORS;
|
|
|
211
237
|
// Prototype/instance methods
|
|
212
238
|
/*
|
|
213
239
|
* Return a new Big whose value is the absolute value of this Big.
|
|
214
|
-
*/
|
|
240
|
+
*/ S.abs = function() {
|
|
215
241
|
var t = new this.constructor(this);
|
|
216
242
|
return t.s = 1, t;
|
|
217
243
|
},
|
|
@@ -220,7 +246,7 @@ var OHLCV_INDICATORS;
|
|
|
220
246
|
* -1 if the value of this Big is less than the value of Big y, or
|
|
221
247
|
* 0 if they have the same value.
|
|
222
248
|
*/
|
|
223
|
-
|
|
249
|
+
S.cmp = function(t) {
|
|
224
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;
|
|
225
251
|
// Either zero?
|
|
226
252
|
if (!n[0] || !o[0]) return n[0] ? i : o[0] ? -a : 0;
|
|
@@ -237,93 +263,93 @@ var OHLCV_INDICATORS;
|
|
|
237
263
|
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
|
|
238
264
|
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
239
265
|
*/
|
|
240
|
-
|
|
266
|
+
S.div = function(t) {
|
|
241
267
|
var e = this, r = e.constructor, n = e.c, // dividend
|
|
242
268
|
o = (t = new r(t)).c, // divisor
|
|
243
269
|
i = e.s == t.s ? 1 : -1, a = r.DP;
|
|
244
|
-
if (a !== ~~a || a < 0 || a >
|
|
270
|
+
if (a !== ~~a || a < 0 || a > p) throw Error(b);
|
|
245
271
|
// Divisor is zero?
|
|
246
|
-
if (!o[0]) throw Error(
|
|
272
|
+
if (!o[0]) throw Error(w);
|
|
247
273
|
// Dividend is 0? Return +-0.
|
|
248
274
|
if (!n[0]) return t.s = i, t.c = [ t.e = 0 ], t;
|
|
249
|
-
var u, l, c, s, f,
|
|
250
|
-
|
|
251
|
-
|
|
275
|
+
var u, l, c, s, f, y = o.slice(), h = u = o.length, v = n.length, m = n.slice(0, u), // remainder
|
|
276
|
+
d = m.length, g = t, // quotient
|
|
277
|
+
S = g.c = [], j = 0, _ = a + (g.e = e.e - t.e) + 1;
|
|
252
278
|
// precision of the result
|
|
253
279
|
// Add zeros to make remainder as long as divisor.
|
|
254
|
-
for (
|
|
280
|
+
for (g.s = i, i = _ < 0 ? 0 : _,
|
|
255
281
|
// Create version of divisor with leading zero.
|
|
256
|
-
|
|
282
|
+
y.unshift(0); d++ < u; ) m.push(0);
|
|
257
283
|
do {
|
|
258
284
|
// n is how many times the divisor goes into current remainder.
|
|
259
285
|
for (c = 0; c < 10; c++) {
|
|
260
286
|
// Compare divisor and remainder.
|
|
261
|
-
if (u != (
|
|
262
|
-
s = o[f] >
|
|
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;
|
|
263
289
|
break;
|
|
264
290
|
}
|
|
265
291
|
// If divisor < remainder, subtract divisor from remainder.
|
|
266
292
|
if (!(s < 0)) break;
|
|
267
293
|
// Remainder can't be more than 1 digit longer than divisor.
|
|
268
294
|
// Equalise lengths using divisor with extra leading zero?
|
|
269
|
-
for (l =
|
|
270
|
-
if (
|
|
271
|
-
for (f =
|
|
272
|
-
--
|
|
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;
|
|
273
299
|
}
|
|
274
|
-
d
|
|
300
|
+
m[d] -= l[d];
|
|
275
301
|
}
|
|
276
|
-
for (;!
|
|
302
|
+
for (;!m[0]; ) m.shift();
|
|
277
303
|
}
|
|
278
304
|
// Add the digit n to the result array.
|
|
279
|
-
j
|
|
305
|
+
S[j++] = s ? c : ++c,
|
|
280
306
|
// Update the remainder.
|
|
281
|
-
|
|
282
|
-
} while ((
|
|
307
|
+
m[0] && s ? m[d] = n[h] || 0 : m = [ n[h] ];
|
|
308
|
+
} while ((h++ < v || m[0] !== O) && i--);
|
|
283
309
|
// Leading zero? Do not remove if result is simply zero (qi == 1).
|
|
284
|
-
return
|
|
310
|
+
return S[0] || 1 == j || (
|
|
285
311
|
// There can't be more than one zero.
|
|
286
|
-
|
|
312
|
+
S.shift(), g.e--, _--),
|
|
287
313
|
// Round?
|
|
288
|
-
|
|
314
|
+
j > _ && P(g, _, r.RM, m[0] !== O), g;
|
|
289
315
|
},
|
|
290
316
|
/*
|
|
291
317
|
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
292
318
|
*/
|
|
293
|
-
|
|
319
|
+
S.eq = function(t) {
|
|
294
320
|
return 0 === this.cmp(t);
|
|
295
321
|
},
|
|
296
322
|
/*
|
|
297
323
|
* Return true if the value of this Big is greater than the value of Big y, otherwise return
|
|
298
324
|
* false.
|
|
299
325
|
*/
|
|
300
|
-
|
|
326
|
+
S.gt = function(t) {
|
|
301
327
|
return this.cmp(t) > 0;
|
|
302
328
|
},
|
|
303
329
|
/*
|
|
304
330
|
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
|
|
305
331
|
* return false.
|
|
306
332
|
*/
|
|
307
|
-
|
|
333
|
+
S.gte = function(t) {
|
|
308
334
|
return this.cmp(t) > -1;
|
|
309
335
|
},
|
|
310
336
|
/*
|
|
311
337
|
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
|
|
312
338
|
*/
|
|
313
|
-
|
|
339
|
+
S.lt = function(t) {
|
|
314
340
|
return this.cmp(t) < 0;
|
|
315
341
|
},
|
|
316
342
|
/*
|
|
317
343
|
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
|
|
318
344
|
* return false.
|
|
319
345
|
*/
|
|
320
|
-
|
|
346
|
+
S.lte = function(t) {
|
|
321
347
|
return this.cmp(t) < 1;
|
|
322
348
|
},
|
|
323
349
|
/*
|
|
324
350
|
* Return a new Big whose value is the value of this Big minus the value of Big y.
|
|
325
351
|
*/
|
|
326
|
-
|
|
352
|
+
S.minus = S.sub = function(t) {
|
|
327
353
|
var e, r, n, o, i = this, a = i.constructor, u = i.s, l = (t = new a(t)).s;
|
|
328
354
|
// Signs differ?
|
|
329
355
|
if (u != l) return t.s = -l, i.plus(t);
|
|
@@ -368,23 +394,23 @@ var OHLCV_INDICATORS;
|
|
|
368
394
|
/*
|
|
369
395
|
* Return a new Big whose value is the value of this Big modulo the value of Big y.
|
|
370
396
|
*/
|
|
371
|
-
|
|
397
|
+
S.mod = function(t) {
|
|
372
398
|
var e, r = this, n = r.constructor, o = r.s, i = (t = new n(t)).s;
|
|
373
|
-
if (!t.c[0]) throw Error(
|
|
399
|
+
if (!t.c[0]) throw Error(w);
|
|
374
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,
|
|
375
401
|
i = n.RM, n.DP = n.RM = 0, r = r.div(t), n.DP = o, n.RM = i, this.minus(r.times(t)));
|
|
376
402
|
},
|
|
377
403
|
/*
|
|
378
404
|
* Return a new Big whose value is the value of this Big negated.
|
|
379
405
|
*/
|
|
380
|
-
|
|
406
|
+
S.neg = function() {
|
|
381
407
|
var t = new this.constructor(this);
|
|
382
408
|
return t.s = -t.s, t;
|
|
383
409
|
},
|
|
384
410
|
/*
|
|
385
411
|
* Return a new Big whose value is the value of this Big plus the value of Big y.
|
|
386
412
|
*/
|
|
387
|
-
|
|
413
|
+
S.plus = S.add = function(t) {
|
|
388
414
|
var e, r, n, o = this, i = o.constructor;
|
|
389
415
|
// Signs differ?
|
|
390
416
|
if (t = new i(t), o.s != t.s) return t.s = -t.s, o.minus(t);
|
|
@@ -413,9 +439,9 @@ var OHLCV_INDICATORS;
|
|
|
413
439
|
*
|
|
414
440
|
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
|
|
415
441
|
*/
|
|
416
|
-
|
|
442
|
+
S.pow = function(t) {
|
|
417
443
|
var e = this, r = new e.constructor("1"), n = r, o = t < 0;
|
|
418
|
-
if (t !== ~~t || t < -1e6 || t >
|
|
444
|
+
if (t !== ~~t || t < -1e6 || t > v) throw Error(d + "exponent");
|
|
419
445
|
for (o && (t = -t); 1 & t && (n = n.times(e)), t >>= 1; ) e = e.times(e);
|
|
420
446
|
return o ? r.div(n) : n;
|
|
421
447
|
},
|
|
@@ -426,9 +452,9 @@ var OHLCV_INDICATORS;
|
|
|
426
452
|
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
427
453
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
428
454
|
*/
|
|
429
|
-
|
|
430
|
-
if (t !== ~~t || t < 1 || t >
|
|
431
|
-
return
|
|
455
|
+
S.prec = function(t, e) {
|
|
456
|
+
if (t !== ~~t || t < 1 || t > p) throw Error(d + "precision");
|
|
457
|
+
return P(new this.constructor(this), t, e);
|
|
432
458
|
},
|
|
433
459
|
/*
|
|
434
460
|
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
@@ -439,20 +465,20 @@ var OHLCV_INDICATORS;
|
|
|
439
465
|
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
|
|
440
466
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
441
467
|
*/
|
|
442
|
-
|
|
443
|
-
if (t ===
|
|
444
|
-
return
|
|
468
|
+
S.round = function(t, e) {
|
|
469
|
+
if (t === O) t = 0; else if (t !== ~~t || t < -p || t > p) throw Error(b);
|
|
470
|
+
return P(new this.constructor(this), t + this.e + 1, e);
|
|
445
471
|
},
|
|
446
472
|
/*
|
|
447
473
|
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
448
474
|
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
449
475
|
*/
|
|
450
|
-
|
|
476
|
+
S.sqrt = function() {
|
|
451
477
|
var t, e, r, n = this, o = n.constructor, i = n.s, a = n.e, u = new o("0.5");
|
|
452
478
|
// Zero?
|
|
453
479
|
if (!n.c[0]) return new o(n);
|
|
454
480
|
// Negative?
|
|
455
|
-
if (i < 0) throw Error(
|
|
481
|
+
if (i < 0) throw Error(m + "No square root");
|
|
456
482
|
// Estimate.
|
|
457
483
|
// Math.sqrt underflow/overflow?
|
|
458
484
|
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
|
|
@@ -463,12 +489,12 @@ var OHLCV_INDICATORS;
|
|
|
463
489
|
do {
|
|
464
490
|
r = t, t = u.times(r.plus(n.div(r)));
|
|
465
491
|
} while (r.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
|
|
466
|
-
return
|
|
492
|
+
return P(t, (o.DP -= 4) + t.e + 1, o.RM);
|
|
467
493
|
},
|
|
468
494
|
/*
|
|
469
495
|
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
470
496
|
*/
|
|
471
|
-
|
|
497
|
+
S.times = S.mul = function(t) {
|
|
472
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;
|
|
473
499
|
// Determine sign of result.
|
|
474
500
|
// Return signed 0 if either 0.
|
|
@@ -501,13 +527,13 @@ var OHLCV_INDICATORS;
|
|
|
501
527
|
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
502
528
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
503
529
|
*/
|
|
504
|
-
|
|
530
|
+
S.toExponential = function(t, e) {
|
|
505
531
|
var r = this, n = r.c[0];
|
|
506
|
-
if (t !==
|
|
507
|
-
if (t !== ~~t || t < 0 || t >
|
|
508
|
-
for (r =
|
|
532
|
+
if (t !== O) {
|
|
533
|
+
if (t !== ~~t || t < 0 || t > p) throw Error(b);
|
|
534
|
+
for (r = P(new r.constructor(r), ++t, e); r.c.length < t; ) r.c.push(0);
|
|
509
535
|
}
|
|
510
|
-
return
|
|
536
|
+
return _(r, !0, !!n);
|
|
511
537
|
},
|
|
512
538
|
/*
|
|
513
539
|
* Return a string representing the value of this Big in normal notation rounded to dp fixed
|
|
@@ -519,14 +545,14 @@ var OHLCV_INDICATORS;
|
|
|
519
545
|
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
|
|
520
546
|
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
|
|
521
547
|
*/
|
|
522
|
-
|
|
548
|
+
S.toFixed = function(t, e) {
|
|
523
549
|
var r = this, n = r.c[0];
|
|
524
|
-
if (t !==
|
|
525
|
-
if (t !== ~~t || t < 0 || t >
|
|
550
|
+
if (t !== O) {
|
|
551
|
+
if (t !== ~~t || t < 0 || t > p) throw Error(b);
|
|
526
552
|
// x.e may have changed if the value is rounded up.
|
|
527
|
-
for (t = t + (r =
|
|
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);
|
|
528
554
|
}
|
|
529
|
-
return
|
|
555
|
+
return _(r, !1, !!n);
|
|
530
556
|
},
|
|
531
557
|
/*
|
|
532
558
|
* Return a string representing the value of this Big.
|
|
@@ -534,16 +560,16 @@ var OHLCV_INDICATORS;
|
|
|
534
560
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
535
561
|
* Omit the sign for negative zero.
|
|
536
562
|
*/
|
|
537
|
-
|
|
563
|
+
S[Symbol.for("nodejs.util.inspect.custom")] = S.toJSON = S.toString = function() {
|
|
538
564
|
var t = this, e = t.constructor;
|
|
539
|
-
return
|
|
565
|
+
return _(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
|
|
540
566
|
},
|
|
541
567
|
/*
|
|
542
568
|
* Return the value of this Big as a primitve number.
|
|
543
569
|
*/
|
|
544
|
-
|
|
545
|
-
var t = Number(
|
|
546
|
-
if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(
|
|
570
|
+
S.toNumber = function() {
|
|
571
|
+
var t = Number(_(this, !0, !0));
|
|
572
|
+
if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(m + "Imprecise conversion");
|
|
547
573
|
return t;
|
|
548
574
|
},
|
|
549
575
|
/*
|
|
@@ -555,13 +581,13 @@ var OHLCV_INDICATORS;
|
|
|
555
581
|
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
556
582
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
557
583
|
*/
|
|
558
|
-
|
|
584
|
+
S.toPrecision = function(t, e) {
|
|
559
585
|
var r = this, n = r.constructor, o = r.c[0];
|
|
560
|
-
if (t !==
|
|
561
|
-
if (t !== ~~t || t < 1 || t >
|
|
562
|
-
for (r =
|
|
586
|
+
if (t !== O) {
|
|
587
|
+
if (t !== ~~t || t < 1 || t > p) throw Error(d + "precision");
|
|
588
|
+
for (r = P(new n(r), t, e); r.c.length < t; ) r.c.push(0);
|
|
563
589
|
}
|
|
564
|
-
return
|
|
590
|
+
return _(r, t <= r.e || r.e <= n.NE || r.e >= n.PE, !!o);
|
|
565
591
|
},
|
|
566
592
|
/*
|
|
567
593
|
* Return a string representing the value of this Big.
|
|
@@ -569,10 +595,10 @@ var OHLCV_INDICATORS;
|
|
|
569
595
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
570
596
|
* Include the sign for negative zero.
|
|
571
597
|
*/
|
|
572
|
-
|
|
598
|
+
S.valueOf = function() {
|
|
573
599
|
var t = this, e = t.constructor;
|
|
574
|
-
if (!0 === e.strict) throw Error(
|
|
575
|
-
return
|
|
600
|
+
if (!0 === e.strict) throw Error(m + "valueOf disallowed");
|
|
601
|
+
return _(t, t.e <= e.NE || t.e >= e.PE, !0);
|
|
576
602
|
};
|
|
577
603
|
// Export
|
|
578
604
|
(
|
|
@@ -589,11 +615,11 @@ var OHLCV_INDICATORS;
|
|
|
589
615
|
function e(r) {
|
|
590
616
|
var n = this;
|
|
591
617
|
// Enable constructor usage without new.
|
|
592
|
-
if (!(n instanceof e)) return r ===
|
|
618
|
+
if (!(n instanceof e)) return r === O ? t() : new e(r);
|
|
593
619
|
// Duplicate.
|
|
594
620
|
if (r instanceof e) n.s = r.s, n.e = r.e, n.c = r.c.slice(); else {
|
|
595
621
|
if ("string" != typeof r) {
|
|
596
|
-
if (!0 === e.strict && "bigint" != typeof r) throw TypeError(
|
|
622
|
+
if (!0 === e.strict && "bigint" != typeof r) throw TypeError(d + "value");
|
|
597
623
|
// Minus zero?
|
|
598
624
|
r = 0 === r && 1 / r < 0 ? "-0" : String(r);
|
|
599
625
|
}
|
|
@@ -606,7 +632,7 @@ var OHLCV_INDICATORS;
|
|
|
606
632
|
*/
|
|
607
633
|
function(t, e) {
|
|
608
634
|
var r, n, o;
|
|
609
|
-
if (!
|
|
635
|
+
if (!j.test(e)) throw Error(d + "number");
|
|
610
636
|
// Determine sign.
|
|
611
637
|
// Decimal point?
|
|
612
638
|
t.s = "-" == e.charAt(0) ? (e = e.slice(1), -1) : 1, (r = e.indexOf(".")) > -1 && (e = e.replace(".", ""));
|
|
@@ -632,51 +658,51 @@ var OHLCV_INDICATORS;
|
|
|
632
658
|
// Shadow Big.prototype.constructor which points to Object.
|
|
633
659
|
n.constructor = e;
|
|
634
660
|
}
|
|
635
|
-
return e.prototype =
|
|
661
|
+
return e.prototype = S, e.DP = 20, e.RM = 1, e.NE = -7, e.PE = 21, e.strict = false,
|
|
636
662
|
e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e;
|
|
637
663
|
})();
|
|
638
664
|
/// <reference types="https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/big.js/index.d.ts" />
|
|
639
665
|
/* harmony default export */ // ./node_modules/trading-signals/dist/error/NotEnoughDataError.js
|
|
640
|
-
function
|
|
641
|
-
return
|
|
666
|
+
function N(t) {
|
|
667
|
+
return N = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
642
668
|
return typeof t;
|
|
643
669
|
} : function(t) {
|
|
644
670
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
645
|
-
},
|
|
671
|
+
}, N(t);
|
|
646
672
|
}
|
|
647
|
-
function
|
|
673
|
+
function A(t, e) {
|
|
648
674
|
for (var r = 0; r < e.length; r++) {
|
|
649
675
|
var n = e[r];
|
|
650
676
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
651
|
-
Object.defineProperty(t,
|
|
677
|
+
Object.defineProperty(t, T(n.key), n);
|
|
652
678
|
}
|
|
653
679
|
}
|
|
654
|
-
function
|
|
680
|
+
function T(t) {
|
|
655
681
|
var e = function(t, e) {
|
|
656
|
-
if ("object" !=
|
|
682
|
+
if ("object" != N(t) || !t) return t;
|
|
657
683
|
var r = t[Symbol.toPrimitive];
|
|
658
684
|
if (void 0 !== r) {
|
|
659
685
|
var n = r.call(t, e || "default");
|
|
660
|
-
if ("object" !=
|
|
686
|
+
if ("object" != N(n)) return n;
|
|
661
687
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
662
688
|
}
|
|
663
689
|
return ("string" === e ? String : Number)(t);
|
|
664
690
|
}(t, "string");
|
|
665
|
-
return "symbol" ==
|
|
691
|
+
return "symbol" == N(e) ? e : e + "";
|
|
666
692
|
}
|
|
667
|
-
function
|
|
668
|
-
return e =
|
|
669
|
-
if (e && ("object" ==
|
|
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;
|
|
670
696
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
671
697
|
return function(t) {
|
|
672
698
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
673
699
|
return t;
|
|
674
700
|
}(t);
|
|
675
|
-
}(t,
|
|
701
|
+
}(t, x() ? Reflect.construct(e, r || [], D(t).constructor) : e.apply(t, r));
|
|
676
702
|
}
|
|
677
|
-
function
|
|
703
|
+
function k(t) {
|
|
678
704
|
var e = "function" == typeof Map ? new Map : void 0;
|
|
679
|
-
return
|
|
705
|
+
return k = function(t) {
|
|
680
706
|
if (null === t || !function(t) {
|
|
681
707
|
try {
|
|
682
708
|
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
@@ -691,12 +717,12 @@ var OHLCV_INDICATORS;
|
|
|
691
717
|
}
|
|
692
718
|
function r() {
|
|
693
719
|
return function(t, e, r) {
|
|
694
|
-
if (
|
|
720
|
+
if (x()) return Reflect.construct.apply(null, arguments);
|
|
695
721
|
var n = [ null ];
|
|
696
722
|
n.push.apply(n, e);
|
|
697
723
|
var o = new (t.bind.apply(t, n));
|
|
698
|
-
return r &&
|
|
699
|
-
}(t, arguments,
|
|
724
|
+
return r && I(o, r.prototype), o;
|
|
725
|
+
}(t, arguments, D(this).constructor);
|
|
700
726
|
}
|
|
701
727
|
return r.prototype = Object.create(t.prototype, {
|
|
702
728
|
constructor: {
|
|
@@ -705,33 +731,33 @@ var OHLCV_INDICATORS;
|
|
|
705
731
|
writable: !0,
|
|
706
732
|
configurable: !0
|
|
707
733
|
}
|
|
708
|
-
}),
|
|
709
|
-
},
|
|
734
|
+
}), I(r, t);
|
|
735
|
+
}, k(t);
|
|
710
736
|
}
|
|
711
|
-
function
|
|
737
|
+
function x() {
|
|
712
738
|
try {
|
|
713
739
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
714
740
|
} catch (t) {}
|
|
715
|
-
return (
|
|
741
|
+
return (x = function() {
|
|
716
742
|
return !!t;
|
|
717
743
|
})();
|
|
718
744
|
}
|
|
719
|
-
function
|
|
720
|
-
return
|
|
745
|
+
function I(t, e) {
|
|
746
|
+
return I = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
721
747
|
return t.__proto__ = e, t;
|
|
722
|
-
},
|
|
748
|
+
}, I(t, e);
|
|
723
749
|
}
|
|
724
|
-
function
|
|
725
|
-
return
|
|
750
|
+
function D(t) {
|
|
751
|
+
return D = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
726
752
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
727
|
-
},
|
|
753
|
+
}, D(t);
|
|
728
754
|
}
|
|
729
|
-
var
|
|
755
|
+
var M = function(t) {
|
|
730
756
|
function e() {
|
|
731
757
|
var t, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "Not enough data";
|
|
732
758
|
return function(t, e) {
|
|
733
759
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
734
|
-
}(this, e), t =
|
|
760
|
+
}(this, e), t = E(this, e, [ r ]), Object.setPrototypeOf(t, (this instanceof e ? this.constructor : void 0).prototype),
|
|
735
761
|
t.name = "NotEnoughDataError", t;
|
|
736
762
|
}
|
|
737
763
|
return function(t, e) {
|
|
@@ -744,60 +770,60 @@ var OHLCV_INDICATORS;
|
|
|
744
770
|
}
|
|
745
771
|
}), Object.defineProperty(t, "prototype", {
|
|
746
772
|
writable: !1
|
|
747
|
-
}), e &&
|
|
748
|
-
}(e, t), r = e, n &&
|
|
773
|
+
}), e && I(t, e);
|
|
774
|
+
}(e, t), r = e, n && A(r.prototype, n), o && A(r, o), Object.defineProperty(r, "prototype", {
|
|
749
775
|
writable: !1
|
|
750
776
|
}), r;
|
|
751
777
|
var r, n, o;
|
|
752
|
-
}(
|
|
778
|
+
}( k(Error));
|
|
753
779
|
// ./node_modules/trading-signals/dist/Indicator.js
|
|
754
|
-
function
|
|
755
|
-
return
|
|
780
|
+
function R(t) {
|
|
781
|
+
return R = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
756
782
|
return typeof t;
|
|
757
783
|
} : function(t) {
|
|
758
784
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
759
|
-
},
|
|
785
|
+
}, R(t);
|
|
760
786
|
}
|
|
761
|
-
function
|
|
787
|
+
function C(t, e) {
|
|
762
788
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
763
789
|
}
|
|
764
|
-
function
|
|
790
|
+
function F(t, e) {
|
|
765
791
|
for (var r = 0; r < e.length; r++) {
|
|
766
792
|
var n = e[r];
|
|
767
793
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
768
|
-
Object.defineProperty(t,
|
|
794
|
+
Object.defineProperty(t, H(n.key), n);
|
|
769
795
|
}
|
|
770
796
|
}
|
|
771
|
-
function
|
|
772
|
-
return e &&
|
|
797
|
+
function L(t, e, r) {
|
|
798
|
+
return e && F(t.prototype, e), r && F(t, r), Object.defineProperty(t, "prototype", {
|
|
773
799
|
writable: !1
|
|
774
800
|
}), t;
|
|
775
801
|
}
|
|
776
|
-
function
|
|
777
|
-
return (e =
|
|
802
|
+
function B(t, e, r) {
|
|
803
|
+
return (e = H(e)) in t ? Object.defineProperty(t, e, {
|
|
778
804
|
value: r,
|
|
779
805
|
enumerable: !0,
|
|
780
806
|
configurable: !0,
|
|
781
807
|
writable: !0
|
|
782
808
|
}) : t[e] = r, t;
|
|
783
809
|
}
|
|
784
|
-
function
|
|
810
|
+
function H(t) {
|
|
785
811
|
var e = function(t, e) {
|
|
786
|
-
if ("object" !=
|
|
812
|
+
if ("object" != R(t) || !t) return t;
|
|
787
813
|
var r = t[Symbol.toPrimitive];
|
|
788
814
|
if (void 0 !== r) {
|
|
789
815
|
var n = r.call(t, e || "default");
|
|
790
|
-
if ("object" !=
|
|
816
|
+
if ("object" != R(n)) return n;
|
|
791
817
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
792
818
|
}
|
|
793
819
|
return ("string" === e ? String : Number)(t);
|
|
794
820
|
}(t, "string");
|
|
795
|
-
return "symbol" ==
|
|
821
|
+
return "symbol" == R(e) ? e : e + "";
|
|
796
822
|
}
|
|
797
|
-
var
|
|
798
|
-
return
|
|
799
|
-
|
|
800
|
-
|
|
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);
|
|
801
827
|
}), [ {
|
|
802
828
|
key: "isStable",
|
|
803
829
|
get: function() {
|
|
@@ -806,7 +832,7 @@ var OHLCV_INDICATORS;
|
|
|
806
832
|
}, {
|
|
807
833
|
key: "getResult",
|
|
808
834
|
value: function() {
|
|
809
|
-
if (void 0 === this.result) throw new
|
|
835
|
+
if (void 0 === this.result) throw new M;
|
|
810
836
|
return this.result;
|
|
811
837
|
}
|
|
812
838
|
}, {
|
|
@@ -826,52 +852,52 @@ var OHLCV_INDICATORS;
|
|
|
826
852
|
} ]);
|
|
827
853
|
}();
|
|
828
854
|
// ./node_modules/trading-signals/dist/MA/MovingAverage.js
|
|
829
|
-
function
|
|
830
|
-
return
|
|
855
|
+
function U(t) {
|
|
856
|
+
return U = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
831
857
|
return typeof t;
|
|
832
858
|
} : function(t) {
|
|
833
859
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
834
|
-
},
|
|
860
|
+
}, U(t);
|
|
835
861
|
}
|
|
836
|
-
function
|
|
862
|
+
function $(t, e) {
|
|
837
863
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
838
864
|
}
|
|
839
|
-
function
|
|
865
|
+
function q(t, e) {
|
|
840
866
|
for (var r = 0; r < e.length; r++) {
|
|
841
867
|
var n = e[r];
|
|
842
868
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
843
|
-
Object.defineProperty(t,
|
|
869
|
+
Object.defineProperty(t, W(n.key), n);
|
|
844
870
|
}
|
|
845
871
|
}
|
|
846
|
-
function
|
|
847
|
-
return e &&
|
|
872
|
+
function z(t, e, r) {
|
|
873
|
+
return e && q(t.prototype, e), r && q(t, r), Object.defineProperty(t, "prototype", {
|
|
848
874
|
writable: !1
|
|
849
875
|
}), t;
|
|
850
876
|
}
|
|
851
|
-
function
|
|
852
|
-
return e =
|
|
853
|
-
if (e && ("object" ==
|
|
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;
|
|
854
880
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
855
881
|
return function(t) {
|
|
856
882
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
857
883
|
return t;
|
|
858
884
|
}(t);
|
|
859
|
-
}(t,
|
|
885
|
+
}(t, K() ? Reflect.construct(e, r || [], Y(t).constructor) : e.apply(t, r));
|
|
860
886
|
}
|
|
861
|
-
function
|
|
887
|
+
function K() {
|
|
862
888
|
try {
|
|
863
889
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
864
890
|
} catch (t) {}
|
|
865
|
-
return (
|
|
891
|
+
return (K = function() {
|
|
866
892
|
return !!t;
|
|
867
893
|
})();
|
|
868
894
|
}
|
|
869
|
-
function
|
|
870
|
-
return
|
|
895
|
+
function Y(t) {
|
|
896
|
+
return Y = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
871
897
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
872
|
-
},
|
|
898
|
+
}, Y(t);
|
|
873
899
|
}
|
|
874
|
-
function
|
|
900
|
+
function J(t, e) {
|
|
875
901
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
876
902
|
t.prototype = Object.create(e && e.prototype, {
|
|
877
903
|
constructor: {
|
|
@@ -881,40 +907,40 @@ var OHLCV_INDICATORS;
|
|
|
881
907
|
}
|
|
882
908
|
}), Object.defineProperty(t, "prototype", {
|
|
883
909
|
writable: !1
|
|
884
|
-
}), e &&
|
|
910
|
+
}), e && Z(t, e);
|
|
885
911
|
}
|
|
886
|
-
function
|
|
887
|
-
return
|
|
912
|
+
function Z(t, e) {
|
|
913
|
+
return Z = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
888
914
|
return t.__proto__ = e, t;
|
|
889
|
-
},
|
|
915
|
+
}, Z(t, e);
|
|
890
916
|
}
|
|
891
|
-
function
|
|
892
|
-
return (e =
|
|
917
|
+
function Q(t, e, r) {
|
|
918
|
+
return (e = W(e)) in t ? Object.defineProperty(t, e, {
|
|
893
919
|
value: r,
|
|
894
920
|
enumerable: !0,
|
|
895
921
|
configurable: !0,
|
|
896
922
|
writable: !0
|
|
897
923
|
}) : t[e] = r, t;
|
|
898
924
|
}
|
|
899
|
-
function
|
|
925
|
+
function W(t) {
|
|
900
926
|
var e = function(t, e) {
|
|
901
|
-
if ("object" !=
|
|
927
|
+
if ("object" != U(t) || !t) return t;
|
|
902
928
|
var r = t[Symbol.toPrimitive];
|
|
903
929
|
if (void 0 !== r) {
|
|
904
930
|
var n = r.call(t, e || "default");
|
|
905
|
-
if ("object" !=
|
|
931
|
+
if ("object" != U(n)) return n;
|
|
906
932
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
907
933
|
}
|
|
908
934
|
return ("string" === e ? String : Number)(t);
|
|
909
935
|
}(t, "string");
|
|
910
|
-
return "symbol" ==
|
|
936
|
+
return "symbol" == U(e) ? e : e + "";
|
|
911
937
|
}
|
|
912
|
-
var
|
|
938
|
+
var X = function(t) {
|
|
913
939
|
function e(t) {
|
|
914
940
|
var r;
|
|
915
|
-
return
|
|
941
|
+
return $(this, e), Q(r = G(this, e), "interval", void 0), r.interval = t, r;
|
|
916
942
|
}
|
|
917
|
-
return
|
|
943
|
+
return J(e, t), z(e, [ {
|
|
918
944
|
key: "updates",
|
|
919
945
|
value: function(t) {
|
|
920
946
|
var e = this;
|
|
@@ -928,54 +954,54 @@ var OHLCV_INDICATORS;
|
|
|
928
954
|
return this.update(t, !0);
|
|
929
955
|
}
|
|
930
956
|
} ]);
|
|
931
|
-
}(
|
|
957
|
+
}(V);
|
|
932
958
|
// ./node_modules/trading-signals/dist/SMA/SMA.js
|
|
933
|
-
function
|
|
934
|
-
return
|
|
959
|
+
function tt(t) {
|
|
960
|
+
return tt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
935
961
|
return typeof t;
|
|
936
962
|
} : function(t) {
|
|
937
963
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
938
|
-
},
|
|
964
|
+
}, tt(t);
|
|
939
965
|
}
|
|
940
|
-
function
|
|
966
|
+
function et(t, e) {
|
|
941
967
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
942
968
|
}
|
|
943
|
-
function
|
|
969
|
+
function rt(t, e) {
|
|
944
970
|
for (var r = 0; r < e.length; r++) {
|
|
945
971
|
var n = e[r];
|
|
946
972
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
947
|
-
Object.defineProperty(t,
|
|
973
|
+
Object.defineProperty(t, st(n.key), n);
|
|
948
974
|
}
|
|
949
975
|
}
|
|
950
|
-
function
|
|
951
|
-
return e &&
|
|
976
|
+
function nt(t, e, r) {
|
|
977
|
+
return e && rt(t.prototype, e), r && rt(t, r), Object.defineProperty(t, "prototype", {
|
|
952
978
|
writable: !1
|
|
953
979
|
}), t;
|
|
954
980
|
}
|
|
955
|
-
function
|
|
956
|
-
return e =
|
|
957
|
-
if (e && ("object" ==
|
|
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;
|
|
958
984
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
959
985
|
return function(t) {
|
|
960
986
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
961
987
|
return t;
|
|
962
988
|
}(t);
|
|
963
|
-
}(t,
|
|
989
|
+
}(t, it() ? Reflect.construct(e, r || [], at(t).constructor) : e.apply(t, r));
|
|
964
990
|
}
|
|
965
|
-
function
|
|
991
|
+
function it() {
|
|
966
992
|
try {
|
|
967
993
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
968
994
|
} catch (t) {}
|
|
969
|
-
return (
|
|
995
|
+
return (it = function() {
|
|
970
996
|
return !!t;
|
|
971
997
|
})();
|
|
972
998
|
}
|
|
973
|
-
function
|
|
974
|
-
return
|
|
999
|
+
function at(t) {
|
|
1000
|
+
return at = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
975
1001
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
976
|
-
},
|
|
1002
|
+
}, at(t);
|
|
977
1003
|
}
|
|
978
|
-
function
|
|
1004
|
+
function ut(t, e) {
|
|
979
1005
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
980
1006
|
t.prototype = Object.create(e && e.prototype, {
|
|
981
1007
|
constructor: {
|
|
@@ -985,42 +1011,42 @@ var OHLCV_INDICATORS;
|
|
|
985
1011
|
}
|
|
986
1012
|
}), Object.defineProperty(t, "prototype", {
|
|
987
1013
|
writable: !1
|
|
988
|
-
}), e &&
|
|
1014
|
+
}), e && lt(t, e);
|
|
989
1015
|
}
|
|
990
|
-
function
|
|
991
|
-
return
|
|
1016
|
+
function lt(t, e) {
|
|
1017
|
+
return lt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
992
1018
|
return t.__proto__ = e, t;
|
|
993
|
-
},
|
|
1019
|
+
}, lt(t, e);
|
|
994
1020
|
}
|
|
995
|
-
function
|
|
996
|
-
return (e =
|
|
1021
|
+
function ct(t, e, r) {
|
|
1022
|
+
return (e = st(e)) in t ? Object.defineProperty(t, e, {
|
|
997
1023
|
value: r,
|
|
998
1024
|
enumerable: !0,
|
|
999
1025
|
configurable: !0,
|
|
1000
1026
|
writable: !0
|
|
1001
1027
|
}) : t[e] = r, t;
|
|
1002
1028
|
}
|
|
1003
|
-
function
|
|
1029
|
+
function st(t) {
|
|
1004
1030
|
var e = function(t, e) {
|
|
1005
|
-
if ("object" !=
|
|
1031
|
+
if ("object" != tt(t) || !t) return t;
|
|
1006
1032
|
var r = t[Symbol.toPrimitive];
|
|
1007
1033
|
if (void 0 !== r) {
|
|
1008
1034
|
var n = r.call(t, e || "default");
|
|
1009
|
-
if ("object" !=
|
|
1035
|
+
if ("object" != tt(n)) return n;
|
|
1010
1036
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1011
1037
|
}
|
|
1012
1038
|
return ("string" === e ? String : Number)(t);
|
|
1013
1039
|
}(t, "string");
|
|
1014
|
-
return "symbol" ==
|
|
1040
|
+
return "symbol" == tt(e) ? e : e + "";
|
|
1015
1041
|
}
|
|
1016
|
-
var
|
|
1042
|
+
var ft = function(t) {
|
|
1017
1043
|
function e() {
|
|
1018
1044
|
var t;
|
|
1019
|
-
|
|
1045
|
+
et(this, e);
|
|
1020
1046
|
for (var r = arguments.length, n = new Array(r), o = 0; o < r; o++) n[o] = arguments[o];
|
|
1021
|
-
return
|
|
1047
|
+
return ct(t = ot(this, e, [].concat(n)), "prices", []), t;
|
|
1022
1048
|
}
|
|
1023
|
-
return
|
|
1049
|
+
return ut(e, t), nt(e, [ {
|
|
1024
1050
|
key: "update",
|
|
1025
1051
|
value: function(t) {
|
|
1026
1052
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1033,54 +1059,54 @@ var OHLCV_INDICATORS;
|
|
|
1033
1059
|
}
|
|
1034
1060
|
}
|
|
1035
1061
|
} ]);
|
|
1036
|
-
}(
|
|
1062
|
+
}(X);
|
|
1037
1063
|
// ./node_modules/trading-signals/dist/WSMA/WSMA.js
|
|
1038
|
-
function
|
|
1039
|
-
return
|
|
1064
|
+
function yt(t) {
|
|
1065
|
+
return yt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1040
1066
|
return typeof t;
|
|
1041
1067
|
} : function(t) {
|
|
1042
1068
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1043
|
-
},
|
|
1069
|
+
}, yt(t);
|
|
1044
1070
|
}
|
|
1045
|
-
function
|
|
1071
|
+
function ht(t, e) {
|
|
1046
1072
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1047
1073
|
}
|
|
1048
|
-
function
|
|
1074
|
+
function pt(t, e) {
|
|
1049
1075
|
for (var r = 0; r < e.length; r++) {
|
|
1050
1076
|
var n = e[r];
|
|
1051
1077
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1052
|
-
Object.defineProperty(t,
|
|
1078
|
+
Object.defineProperty(t, Ot(n.key), n);
|
|
1053
1079
|
}
|
|
1054
1080
|
}
|
|
1055
|
-
function
|
|
1056
|
-
return e &&
|
|
1081
|
+
function vt(t, e, r) {
|
|
1082
|
+
return e && pt(t.prototype, e), r && pt(t, r), Object.defineProperty(t, "prototype", {
|
|
1057
1083
|
writable: !1
|
|
1058
1084
|
}), t;
|
|
1059
1085
|
}
|
|
1060
|
-
function
|
|
1061
|
-
return e =
|
|
1062
|
-
if (e && ("object" ==
|
|
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;
|
|
1063
1089
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1064
1090
|
return function(t) {
|
|
1065
1091
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1066
1092
|
return t;
|
|
1067
1093
|
}(t);
|
|
1068
|
-
}(t,
|
|
1094
|
+
}(t, dt() ? Reflect.construct(e, r || [], bt(t).constructor) : e.apply(t, r));
|
|
1069
1095
|
}
|
|
1070
|
-
function
|
|
1096
|
+
function dt() {
|
|
1071
1097
|
try {
|
|
1072
1098
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1073
1099
|
} catch (t) {}
|
|
1074
|
-
return (
|
|
1100
|
+
return (dt = function() {
|
|
1075
1101
|
return !!t;
|
|
1076
1102
|
})();
|
|
1077
1103
|
}
|
|
1078
|
-
function
|
|
1079
|
-
return
|
|
1104
|
+
function bt(t) {
|
|
1105
|
+
return bt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1080
1106
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1081
|
-
},
|
|
1107
|
+
}, bt(t);
|
|
1082
1108
|
}
|
|
1083
|
-
function
|
|
1109
|
+
function gt(t, e) {
|
|
1084
1110
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1085
1111
|
t.prototype = Object.create(e && e.prototype, {
|
|
1086
1112
|
constructor: {
|
|
@@ -1090,42 +1116,42 @@ var OHLCV_INDICATORS;
|
|
|
1090
1116
|
}
|
|
1091
1117
|
}), Object.defineProperty(t, "prototype", {
|
|
1092
1118
|
writable: !1
|
|
1093
|
-
}), e &&
|
|
1119
|
+
}), e && wt(t, e);
|
|
1094
1120
|
}
|
|
1095
|
-
function
|
|
1096
|
-
return
|
|
1121
|
+
function wt(t, e) {
|
|
1122
|
+
return wt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1097
1123
|
return t.__proto__ = e, t;
|
|
1098
|
-
},
|
|
1124
|
+
}, wt(t, e);
|
|
1099
1125
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return (e =
|
|
1126
|
+
function St(t, e, r) {
|
|
1127
|
+
return (e = Ot(e)) in t ? Object.defineProperty(t, e, {
|
|
1102
1128
|
value: r,
|
|
1103
1129
|
enumerable: !0,
|
|
1104
1130
|
configurable: !0,
|
|
1105
1131
|
writable: !0
|
|
1106
1132
|
}) : t[e] = r, t;
|
|
1107
1133
|
}
|
|
1108
|
-
function
|
|
1134
|
+
function Ot(t) {
|
|
1109
1135
|
var e = function(t, e) {
|
|
1110
|
-
if ("object" !=
|
|
1136
|
+
if ("object" != yt(t) || !t) return t;
|
|
1111
1137
|
var r = t[Symbol.toPrimitive];
|
|
1112
1138
|
if (void 0 !== r) {
|
|
1113
1139
|
var n = r.call(t, e || "default");
|
|
1114
|
-
if ("object" !=
|
|
1140
|
+
if ("object" != yt(n)) return n;
|
|
1115
1141
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1116
1142
|
}
|
|
1117
1143
|
return ("string" === e ? String : Number)(t);
|
|
1118
1144
|
}(t, "string");
|
|
1119
|
-
return "symbol" ==
|
|
1145
|
+
return "symbol" == yt(e) ? e : e + "";
|
|
1120
1146
|
}
|
|
1121
|
-
var
|
|
1147
|
+
var jt = function(t) {
|
|
1122
1148
|
function e(t) {
|
|
1123
1149
|
var r;
|
|
1124
|
-
return
|
|
1125
|
-
|
|
1150
|
+
return ht(this, e), St(r = mt(this, e), "interval", void 0), St(r, "indicator", void 0),
|
|
1151
|
+
St(r, "smoothingFactor", void 0), r.interval = t, r.indicator = new ft(t), r.smoothingFactor = 1 / r.interval,
|
|
1126
1152
|
r;
|
|
1127
1153
|
}
|
|
1128
|
-
return
|
|
1154
|
+
return gt(e, t), vt(e, [ {
|
|
1129
1155
|
key: "updates",
|
|
1130
1156
|
value: function(t) {
|
|
1131
1157
|
var e = this;
|
|
@@ -1148,68 +1174,68 @@ var OHLCV_INDICATORS;
|
|
|
1148
1174
|
if (void 0 === this.result && void 0 !== r) return this.setResult(r, e);
|
|
1149
1175
|
}
|
|
1150
1176
|
} ]);
|
|
1151
|
-
}(
|
|
1152
|
-
function
|
|
1177
|
+
}(V);
|
|
1178
|
+
function Pt(t) {
|
|
1153
1179
|
return t.length ? t.reduce((function(t, e) {
|
|
1154
1180
|
return t + e;
|
|
1155
1181
|
}), 0) / t.length : 0;
|
|
1156
1182
|
}
|
|
1157
1183
|
// ./node_modules/trading-signals/dist/BBANDS/BollingerBands.js
|
|
1158
|
-
function
|
|
1159
|
-
return
|
|
1184
|
+
function _t(t) {
|
|
1185
|
+
return _t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1160
1186
|
return typeof t;
|
|
1161
1187
|
} : function(t) {
|
|
1162
1188
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1163
|
-
},
|
|
1189
|
+
}, _t(t);
|
|
1164
1190
|
}
|
|
1165
|
-
function
|
|
1191
|
+
function Nt(t, e) {
|
|
1166
1192
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1167
1193
|
}
|
|
1168
|
-
function
|
|
1194
|
+
function At(t, e) {
|
|
1169
1195
|
for (var r = 0; r < e.length; r++) {
|
|
1170
1196
|
var n = e[r];
|
|
1171
1197
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1172
|
-
Object.defineProperty(t,
|
|
1198
|
+
Object.defineProperty(t, kt(n.key), n);
|
|
1173
1199
|
}
|
|
1174
1200
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return e &&
|
|
1201
|
+
function Tt(t, e, r) {
|
|
1202
|
+
return e && At(t.prototype, e), r && At(t, r), Object.defineProperty(t, "prototype", {
|
|
1177
1203
|
writable: !1
|
|
1178
1204
|
}), t;
|
|
1179
1205
|
}
|
|
1180
|
-
function
|
|
1181
|
-
return (e =
|
|
1206
|
+
function Et(t, e, r) {
|
|
1207
|
+
return (e = kt(e)) in t ? Object.defineProperty(t, e, {
|
|
1182
1208
|
value: r,
|
|
1183
1209
|
enumerable: !0,
|
|
1184
1210
|
configurable: !0,
|
|
1185
1211
|
writable: !0
|
|
1186
1212
|
}) : t[e] = r, t;
|
|
1187
1213
|
}
|
|
1188
|
-
function
|
|
1214
|
+
function kt(t) {
|
|
1189
1215
|
var e = function(t, e) {
|
|
1190
|
-
if ("object" !=
|
|
1216
|
+
if ("object" != _t(t) || !t) return t;
|
|
1191
1217
|
var r = t[Symbol.toPrimitive];
|
|
1192
1218
|
if (void 0 !== r) {
|
|
1193
1219
|
var n = r.call(t, e || "default");
|
|
1194
|
-
if ("object" !=
|
|
1220
|
+
if ("object" != _t(n)) return n;
|
|
1195
1221
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1196
1222
|
}
|
|
1197
1223
|
return ("string" === e ? String : Number)(t);
|
|
1198
1224
|
}(t, "string");
|
|
1199
|
-
return "symbol" ==
|
|
1225
|
+
return "symbol" == _t(e) ? e : e + "";
|
|
1200
1226
|
}
|
|
1201
|
-
var
|
|
1202
|
-
return
|
|
1227
|
+
var xt = function() {
|
|
1228
|
+
return Tt((function t(e) {
|
|
1203
1229
|
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2;
|
|
1204
|
-
|
|
1205
|
-
|
|
1230
|
+
Nt(this, t), Et(this, "interval", void 0), Et(this, "deviationMultiplier", void 0),
|
|
1231
|
+
Et(this, "prices", []), Et(this, "result", void 0), this.interval = e, this.deviationMultiplier = r;
|
|
1206
1232
|
}), [ {
|
|
1207
1233
|
key: "update",
|
|
1208
1234
|
value: function(t) {
|
|
1209
1235
|
if (this.prices.push(t), this.prices.length > this.interval) {
|
|
1210
1236
|
this.prices.shift();
|
|
1211
|
-
var e =
|
|
1212
|
-
var r = e ||
|
|
1237
|
+
var e = Pt(this.prices), r = function(t, e) {
|
|
1238
|
+
var r = e || Pt(t), n = Pt(t.map((function(t) {
|
|
1213
1239
|
return t - r;
|
|
1214
1240
|
})).map((function(t) {
|
|
1215
1241
|
return t * t;
|
|
@@ -1226,7 +1252,7 @@ var OHLCV_INDICATORS;
|
|
|
1226
1252
|
}, {
|
|
1227
1253
|
key: "getResult",
|
|
1228
1254
|
value: function() {
|
|
1229
|
-
if (void 0 === this.result) throw new
|
|
1255
|
+
if (void 0 === this.result) throw new M;
|
|
1230
1256
|
return this.result;
|
|
1231
1257
|
}
|
|
1232
1258
|
}, {
|
|
@@ -1237,52 +1263,52 @@ var OHLCV_INDICATORS;
|
|
|
1237
1263
|
} ]);
|
|
1238
1264
|
}();
|
|
1239
1265
|
// ./node_modules/trading-signals/dist/EMA/EMA.js
|
|
1240
|
-
function
|
|
1241
|
-
return
|
|
1266
|
+
function It(t) {
|
|
1267
|
+
return It = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1242
1268
|
return typeof t;
|
|
1243
1269
|
} : function(t) {
|
|
1244
1270
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1245
|
-
},
|
|
1271
|
+
}, It(t);
|
|
1246
1272
|
}
|
|
1247
|
-
function
|
|
1273
|
+
function Dt(t, e) {
|
|
1248
1274
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1249
1275
|
}
|
|
1250
|
-
function
|
|
1276
|
+
function Mt(t, e) {
|
|
1251
1277
|
for (var r = 0; r < e.length; r++) {
|
|
1252
1278
|
var n = e[r];
|
|
1253
1279
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1254
|
-
Object.defineProperty(t,
|
|
1280
|
+
Object.defineProperty(t, Ut(n.key), n);
|
|
1255
1281
|
}
|
|
1256
1282
|
}
|
|
1257
|
-
function
|
|
1258
|
-
return e &&
|
|
1283
|
+
function Rt(t, e, r) {
|
|
1284
|
+
return e && Mt(t.prototype, e), r && Mt(t, r), Object.defineProperty(t, "prototype", {
|
|
1259
1285
|
writable: !1
|
|
1260
1286
|
}), t;
|
|
1261
1287
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return e =
|
|
1264
|
-
if (e && ("object" ==
|
|
1288
|
+
function Ct(t, e, r) {
|
|
1289
|
+
return e = Lt(e), function(t, e) {
|
|
1290
|
+
if (e && ("object" == It(e) || "function" == typeof e)) return e;
|
|
1265
1291
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1266
1292
|
return function(t) {
|
|
1267
1293
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1268
1294
|
return t;
|
|
1269
1295
|
}(t);
|
|
1270
|
-
}(t,
|
|
1296
|
+
}(t, Ft() ? Reflect.construct(e, r || [], Lt(t).constructor) : e.apply(t, r));
|
|
1271
1297
|
}
|
|
1272
|
-
function
|
|
1298
|
+
function Ft() {
|
|
1273
1299
|
try {
|
|
1274
1300
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1275
1301
|
} catch (t) {}
|
|
1276
|
-
return (
|
|
1302
|
+
return (Ft = function() {
|
|
1277
1303
|
return !!t;
|
|
1278
1304
|
})();
|
|
1279
1305
|
}
|
|
1280
|
-
function
|
|
1281
|
-
return
|
|
1306
|
+
function Lt(t) {
|
|
1307
|
+
return Lt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1282
1308
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1283
|
-
},
|
|
1309
|
+
}, Lt(t);
|
|
1284
1310
|
}
|
|
1285
|
-
function
|
|
1311
|
+
function Bt(t, e) {
|
|
1286
1312
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1287
1313
|
t.prototype = Object.create(e && e.prototype, {
|
|
1288
1314
|
constructor: {
|
|
@@ -1292,42 +1318,42 @@ var OHLCV_INDICATORS;
|
|
|
1292
1318
|
}
|
|
1293
1319
|
}), Object.defineProperty(t, "prototype", {
|
|
1294
1320
|
writable: !1
|
|
1295
|
-
}), e &&
|
|
1321
|
+
}), e && Ht(t, e);
|
|
1296
1322
|
}
|
|
1297
|
-
function
|
|
1298
|
-
return
|
|
1323
|
+
function Ht(t, e) {
|
|
1324
|
+
return Ht = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1299
1325
|
return t.__proto__ = e, t;
|
|
1300
|
-
},
|
|
1326
|
+
}, Ht(t, e);
|
|
1301
1327
|
}
|
|
1302
|
-
function
|
|
1303
|
-
return (e =
|
|
1328
|
+
function Vt(t, e, r) {
|
|
1329
|
+
return (e = Ut(e)) in t ? Object.defineProperty(t, e, {
|
|
1304
1330
|
value: r,
|
|
1305
1331
|
enumerable: !0,
|
|
1306
1332
|
configurable: !0,
|
|
1307
1333
|
writable: !0
|
|
1308
1334
|
}) : t[e] = r, t;
|
|
1309
1335
|
}
|
|
1310
|
-
function
|
|
1336
|
+
function Ut(t) {
|
|
1311
1337
|
var e = function(t, e) {
|
|
1312
|
-
if ("object" !=
|
|
1338
|
+
if ("object" != It(t) || !t) return t;
|
|
1313
1339
|
var r = t[Symbol.toPrimitive];
|
|
1314
1340
|
if (void 0 !== r) {
|
|
1315
1341
|
var n = r.call(t, e || "default");
|
|
1316
|
-
if ("object" !=
|
|
1342
|
+
if ("object" != It(n)) return n;
|
|
1317
1343
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1318
1344
|
}
|
|
1319
1345
|
return ("string" === e ? String : Number)(t);
|
|
1320
1346
|
}(t, "string");
|
|
1321
|
-
return "symbol" ==
|
|
1347
|
+
return "symbol" == It(e) ? e : e + "";
|
|
1322
1348
|
}
|
|
1323
|
-
var
|
|
1349
|
+
var $t = function(t) {
|
|
1324
1350
|
function e(t) {
|
|
1325
1351
|
var r;
|
|
1326
|
-
return
|
|
1327
|
-
|
|
1352
|
+
return Dt(this, e), Vt(r = Ct(this, e, [ t ]), "interval", void 0), Vt(r, "pricesCounter", 0),
|
|
1353
|
+
Vt(r, "weightFactor", void 0), r.interval = t, r.weightFactor = 2 / (r.interval + 1),
|
|
1328
1354
|
r;
|
|
1329
1355
|
}
|
|
1330
|
-
return
|
|
1356
|
+
return Bt(e, t), Rt(e, [ {
|
|
1331
1357
|
key: "update",
|
|
1332
1358
|
value: function(t) {
|
|
1333
1359
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1337,7 +1363,7 @@ var OHLCV_INDICATORS;
|
|
|
1337
1363
|
}, {
|
|
1338
1364
|
key: "getResult",
|
|
1339
1365
|
value: function() {
|
|
1340
|
-
if (this.pricesCounter < this.interval) throw new
|
|
1366
|
+
if (this.pricesCounter < this.interval) throw new M;
|
|
1341
1367
|
return this.result;
|
|
1342
1368
|
}
|
|
1343
1369
|
}, {
|
|
@@ -1350,60 +1376,60 @@ var OHLCV_INDICATORS;
|
|
|
1350
1376
|
}
|
|
1351
1377
|
}
|
|
1352
1378
|
} ]);
|
|
1353
|
-
}(
|
|
1379
|
+
}(X);
|
|
1354
1380
|
// ./node_modules/trading-signals/dist/MACD/MACD.js
|
|
1355
|
-
function
|
|
1356
|
-
return
|
|
1381
|
+
function qt(t) {
|
|
1382
|
+
return qt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1357
1383
|
return typeof t;
|
|
1358
1384
|
} : function(t) {
|
|
1359
1385
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1360
|
-
},
|
|
1386
|
+
}, qt(t);
|
|
1361
1387
|
}
|
|
1362
|
-
function
|
|
1388
|
+
function zt(t, e) {
|
|
1363
1389
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1364
1390
|
}
|
|
1365
|
-
function
|
|
1391
|
+
function Gt(t, e) {
|
|
1366
1392
|
for (var r = 0; r < e.length; r++) {
|
|
1367
1393
|
var n = e[r];
|
|
1368
1394
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1369
|
-
Object.defineProperty(t,
|
|
1395
|
+
Object.defineProperty(t, Jt(n.key), n);
|
|
1370
1396
|
}
|
|
1371
1397
|
}
|
|
1372
|
-
function
|
|
1373
|
-
return e &&
|
|
1398
|
+
function Kt(t, e, r) {
|
|
1399
|
+
return e && Gt(t.prototype, e), r && Gt(t, r), Object.defineProperty(t, "prototype", {
|
|
1374
1400
|
writable: !1
|
|
1375
1401
|
}), t;
|
|
1376
1402
|
}
|
|
1377
|
-
function
|
|
1378
|
-
return (e =
|
|
1403
|
+
function Yt(t, e, r) {
|
|
1404
|
+
return (e = Jt(e)) in t ? Object.defineProperty(t, e, {
|
|
1379
1405
|
value: r,
|
|
1380
1406
|
enumerable: !0,
|
|
1381
1407
|
configurable: !0,
|
|
1382
1408
|
writable: !0
|
|
1383
1409
|
}) : t[e] = r, t;
|
|
1384
1410
|
}
|
|
1385
|
-
function
|
|
1411
|
+
function Jt(t) {
|
|
1386
1412
|
var e = function(t, e) {
|
|
1387
|
-
if ("object" !=
|
|
1413
|
+
if ("object" != qt(t) || !t) return t;
|
|
1388
1414
|
var r = t[Symbol.toPrimitive];
|
|
1389
1415
|
if (void 0 !== r) {
|
|
1390
1416
|
var n = r.call(t, e || "default");
|
|
1391
|
-
if ("object" !=
|
|
1417
|
+
if ("object" != qt(n)) return n;
|
|
1392
1418
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1393
1419
|
}
|
|
1394
1420
|
return ("string" === e ? String : Number)(t);
|
|
1395
1421
|
}(t, "string");
|
|
1396
|
-
return "symbol" ==
|
|
1422
|
+
return "symbol" == qt(e) ? e : e + "";
|
|
1397
1423
|
}
|
|
1398
|
-
var
|
|
1399
|
-
return
|
|
1400
|
-
|
|
1401
|
-
|
|
1424
|
+
var Zt = function() {
|
|
1425
|
+
return Kt((function t(e, r, n) {
|
|
1426
|
+
zt(this, t), Yt(this, "short", void 0), Yt(this, "long", void 0), Yt(this, "signal", void 0),
|
|
1427
|
+
Yt(this, "prices", []), Yt(this, "result", void 0), this.short = e, this.long = r,
|
|
1402
1428
|
this.signal = n;
|
|
1403
1429
|
}), [ {
|
|
1404
1430
|
key: "getResult",
|
|
1405
1431
|
value: function() {
|
|
1406
|
-
if (void 0 === this.result) throw new
|
|
1432
|
+
if (void 0 === this.result) throw new M;
|
|
1407
1433
|
return this.result;
|
|
1408
1434
|
}
|
|
1409
1435
|
}, {
|
|
@@ -1429,52 +1455,52 @@ var OHLCV_INDICATORS;
|
|
|
1429
1455
|
} ]);
|
|
1430
1456
|
}();
|
|
1431
1457
|
// ./node_modules/trading-signals/dist/RSI/RSI.js
|
|
1432
|
-
function
|
|
1433
|
-
return
|
|
1458
|
+
function Qt(t) {
|
|
1459
|
+
return Qt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1434
1460
|
return typeof t;
|
|
1435
1461
|
} : function(t) {
|
|
1436
1462
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1437
|
-
},
|
|
1463
|
+
}, Qt(t);
|
|
1438
1464
|
}
|
|
1439
|
-
function
|
|
1465
|
+
function Wt(t, e) {
|
|
1440
1466
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1441
1467
|
}
|
|
1442
|
-
function
|
|
1468
|
+
function Xt(t, e) {
|
|
1443
1469
|
for (var r = 0; r < e.length; r++) {
|
|
1444
1470
|
var n = e[r];
|
|
1445
1471
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1446
|
-
Object.defineProperty(t,
|
|
1472
|
+
Object.defineProperty(t, ue(n.key), n);
|
|
1447
1473
|
}
|
|
1448
1474
|
}
|
|
1449
|
-
function
|
|
1450
|
-
return e &&
|
|
1475
|
+
function te(t, e, r) {
|
|
1476
|
+
return e && Xt(t.prototype, e), r && Xt(t, r), Object.defineProperty(t, "prototype", {
|
|
1451
1477
|
writable: !1
|
|
1452
1478
|
}), t;
|
|
1453
1479
|
}
|
|
1454
|
-
function
|
|
1455
|
-
return e =
|
|
1456
|
-
if (e && ("object" ==
|
|
1480
|
+
function ee(t, e, r) {
|
|
1481
|
+
return e = ne(e), function(t, e) {
|
|
1482
|
+
if (e && ("object" == Qt(e) || "function" == typeof e)) return e;
|
|
1457
1483
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1458
1484
|
return function(t) {
|
|
1459
1485
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1460
1486
|
return t;
|
|
1461
1487
|
}(t);
|
|
1462
|
-
}(t,
|
|
1488
|
+
}(t, re() ? Reflect.construct(e, r || [], ne(t).constructor) : e.apply(t, r));
|
|
1463
1489
|
}
|
|
1464
|
-
function
|
|
1490
|
+
function re() {
|
|
1465
1491
|
try {
|
|
1466
1492
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1467
1493
|
} catch (t) {}
|
|
1468
|
-
return (
|
|
1494
|
+
return (re = function() {
|
|
1469
1495
|
return !!t;
|
|
1470
1496
|
})();
|
|
1471
1497
|
}
|
|
1472
|
-
function
|
|
1473
|
-
return
|
|
1498
|
+
function ne(t) {
|
|
1499
|
+
return ne = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1474
1500
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1475
|
-
},
|
|
1501
|
+
}, ne(t);
|
|
1476
1502
|
}
|
|
1477
|
-
function
|
|
1503
|
+
function oe(t, e) {
|
|
1478
1504
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1479
1505
|
t.prototype = Object.create(e && e.prototype, {
|
|
1480
1506
|
constructor: {
|
|
@@ -1484,42 +1510,42 @@ var OHLCV_INDICATORS;
|
|
|
1484
1510
|
}
|
|
1485
1511
|
}), Object.defineProperty(t, "prototype", {
|
|
1486
1512
|
writable: !1
|
|
1487
|
-
}), e &&
|
|
1513
|
+
}), e && ie(t, e);
|
|
1488
1514
|
}
|
|
1489
|
-
function
|
|
1490
|
-
return
|
|
1515
|
+
function ie(t, e) {
|
|
1516
|
+
return ie = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1491
1517
|
return t.__proto__ = e, t;
|
|
1492
|
-
},
|
|
1518
|
+
}, ie(t, e);
|
|
1493
1519
|
}
|
|
1494
|
-
function
|
|
1495
|
-
return (e =
|
|
1520
|
+
function ae(t, e, r) {
|
|
1521
|
+
return (e = ue(e)) in t ? Object.defineProperty(t, e, {
|
|
1496
1522
|
value: r,
|
|
1497
1523
|
enumerable: !0,
|
|
1498
1524
|
configurable: !0,
|
|
1499
1525
|
writable: !0
|
|
1500
1526
|
}) : t[e] = r, t;
|
|
1501
1527
|
}
|
|
1502
|
-
function
|
|
1528
|
+
function ue(t) {
|
|
1503
1529
|
var e = function(t, e) {
|
|
1504
|
-
if ("object" !=
|
|
1530
|
+
if ("object" != Qt(t) || !t) return t;
|
|
1505
1531
|
var r = t[Symbol.toPrimitive];
|
|
1506
1532
|
if (void 0 !== r) {
|
|
1507
1533
|
var n = r.call(t, e || "default");
|
|
1508
|
-
if ("object" !=
|
|
1534
|
+
if ("object" != Qt(n)) return n;
|
|
1509
1535
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1510
1536
|
}
|
|
1511
1537
|
return ("string" === e ? String : Number)(t);
|
|
1512
1538
|
}(t, "string");
|
|
1513
|
-
return "symbol" ==
|
|
1539
|
+
return "symbol" == Qt(e) ? e : e + "";
|
|
1514
1540
|
}
|
|
1515
|
-
var
|
|
1541
|
+
var le = function(t) {
|
|
1516
1542
|
function e(t) {
|
|
1517
|
-
var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] :
|
|
1518
|
-
return
|
|
1519
|
-
|
|
1543
|
+
var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : jt;
|
|
1544
|
+
return Wt(this, e), ae(r = ee(this, e), "interval", void 0), ae(r, "previousPrices", []),
|
|
1545
|
+
ae(r, "avgGain", void 0), ae(r, "avgLoss", void 0), ae(r, "maxValue", 100), r.interval = t,
|
|
1520
1546
|
r.avgGain = new n(r.interval), r.avgLoss = new n(r.interval), r;
|
|
1521
1547
|
}
|
|
1522
|
-
return
|
|
1548
|
+
return oe(e, t), te(e, [ {
|
|
1523
1549
|
key: "update",
|
|
1524
1550
|
value: function(t) {
|
|
1525
1551
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1536,28 +1562,28 @@ var OHLCV_INDICATORS;
|
|
|
1536
1562
|
}
|
|
1537
1563
|
}
|
|
1538
1564
|
} ]);
|
|
1539
|
-
}(
|
|
1565
|
+
}(V);
|
|
1540
1566
|
// ./src/oscillators/rsi.js
|
|
1541
|
-
function
|
|
1542
|
-
return
|
|
1567
|
+
function ce(t) {
|
|
1568
|
+
return ce = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1543
1569
|
return typeof t;
|
|
1544
1570
|
} : function(t) {
|
|
1545
1571
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1546
|
-
},
|
|
1572
|
+
}, ce(t);
|
|
1547
1573
|
}
|
|
1548
|
-
function
|
|
1574
|
+
function se(t, e, r) {
|
|
1549
1575
|
return (e = function(t) {
|
|
1550
1576
|
var e = function(t, e) {
|
|
1551
|
-
if ("object" !=
|
|
1577
|
+
if ("object" != ce(t) || !t) return t;
|
|
1552
1578
|
var r = t[Symbol.toPrimitive];
|
|
1553
1579
|
if (void 0 !== r) {
|
|
1554
1580
|
var n = r.call(t, e || "default");
|
|
1555
|
-
if ("object" !=
|
|
1581
|
+
if ("object" != ce(n)) return n;
|
|
1556
1582
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1557
1583
|
}
|
|
1558
1584
|
return ("string" === e ? String : Number)(t);
|
|
1559
1585
|
}(t, "string");
|
|
1560
|
-
return "symbol" ==
|
|
1586
|
+
return "symbol" == ce(e) ? e : e + "";
|
|
1561
1587
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1562
1588
|
value: r,
|
|
1563
1589
|
enumerable: !0,
|
|
@@ -1565,57 +1591,57 @@ var OHLCV_INDICATORS;
|
|
|
1565
1591
|
writable: !0
|
|
1566
1592
|
}) : t[e] = r, t;
|
|
1567
1593
|
}
|
|
1568
|
-
var
|
|
1569
|
-
ema:
|
|
1570
|
-
sma:
|
|
1571
|
-
},
|
|
1572
|
-
var i = o.target, a = o.lag, u = t.verticalOhlcv, l = t.instances, c =
|
|
1573
|
-
if (0 === e)
|
|
1574
|
-
var y = t.len, h = t.arrayTypes;
|
|
1575
|
-
if (!u.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for ").concat(r, "."));
|
|
1576
|
-
// Create the main moving average instance.
|
|
1577
|
-
l[f] = {
|
|
1578
|
-
maInstance: new ce[r](n)
|
|
1579
|
-
}, u[f] = new Float64Array(y).fill(NaN), c.add(f), a > 0 && t.lag([ f ], a), h[f] = "Float64Array";
|
|
1580
|
-
}
|
|
1594
|
+
var fe = {
|
|
1595
|
+
ema: $t,
|
|
1596
|
+
sma: ft
|
|
1597
|
+
}, ye = function(t, e, r, n, o) {
|
|
1598
|
+
var i = o.target, a = (o.lag, o.precomputed), u = t.verticalOhlcv, l = t.instances, c = a.keyName;
|
|
1599
|
+
if (0 === e && !u.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for ").concat(r, "."));
|
|
1581
1600
|
// Retrieve the current price value.
|
|
1582
|
-
var
|
|
1601
|
+
var s = u[i][e], f = l[c].maInstance;
|
|
1583
1602
|
// Update the moving average instance.
|
|
1584
|
-
|
|
1585
|
-
var
|
|
1603
|
+
f.update(s);
|
|
1604
|
+
var y = NaN;
|
|
1586
1605
|
try {
|
|
1587
|
-
|
|
1588
|
-
} catch (t) {
|
|
1589
|
-
m = NaN;
|
|
1590
|
-
}
|
|
1606
|
+
y = f.getResult();
|
|
1607
|
+
} catch (t) {}
|
|
1591
1608
|
// Always push the MA value (even if NaN).
|
|
1592
1609
|
return t.pushToMain({
|
|
1593
1610
|
index: e,
|
|
1594
|
-
key:
|
|
1595
|
-
value:
|
|
1611
|
+
key: c,
|
|
1612
|
+
value: y
|
|
1596
1613
|
}), !0;
|
|
1614
|
+
}, he = function(t) {
|
|
1615
|
+
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);
|
|
1616
|
+
// Create the main moving average instance.
|
|
1617
|
+
return a[y] = {
|
|
1618
|
+
maInstance: new fe[i](r)
|
|
1619
|
+
}, u[y] = new Float64Array(s).fill(NaN), l.add(y), o > 0 && e.lag([ y ], o), c[y] = "Float64Array",
|
|
1620
|
+
{
|
|
1621
|
+
keyName: y
|
|
1622
|
+
};
|
|
1597
1623
|
};
|
|
1598
1624
|
// ./src/moving-averages/macd.js
|
|
1599
|
-
function
|
|
1600
|
-
return
|
|
1625
|
+
function pe(t) {
|
|
1626
|
+
return pe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1601
1627
|
return typeof t;
|
|
1602
1628
|
} : function(t) {
|
|
1603
1629
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1604
|
-
},
|
|
1630
|
+
}, pe(t);
|
|
1605
1631
|
}
|
|
1606
|
-
function
|
|
1632
|
+
function ve(t, e, r) {
|
|
1607
1633
|
return (e = function(t) {
|
|
1608
1634
|
var e = function(t, e) {
|
|
1609
|
-
if ("object" !=
|
|
1635
|
+
if ("object" != pe(t) || !t) return t;
|
|
1610
1636
|
var r = t[Symbol.toPrimitive];
|
|
1611
1637
|
if (void 0 !== r) {
|
|
1612
1638
|
var n = r.call(t, e || "default");
|
|
1613
|
-
if ("object" !=
|
|
1639
|
+
if ("object" != pe(n)) return n;
|
|
1614
1640
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1615
1641
|
}
|
|
1616
1642
|
return ("string" === e ? String : Number)(t);
|
|
1617
1643
|
}(t, "string");
|
|
1618
|
-
return "symbol" ==
|
|
1644
|
+
return "symbol" == pe(e) ? e : e + "";
|
|
1619
1645
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1620
1646
|
value: r,
|
|
1621
1647
|
enumerable: !0,
|
|
@@ -1623,14 +1649,14 @@ var OHLCV_INDICATORS;
|
|
|
1623
1649
|
writable: !0
|
|
1624
1650
|
}) : t[e] = r, t;
|
|
1625
1651
|
}
|
|
1626
|
-
function
|
|
1652
|
+
function me(t, e) {
|
|
1627
1653
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1628
1654
|
if (!r) {
|
|
1629
1655
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
1630
1656
|
if (t) {
|
|
1631
|
-
if ("string" == typeof t) return
|
|
1657
|
+
if ("string" == typeof t) return de(t, e);
|
|
1632
1658
|
var r = {}.toString.call(t).slice(8, -1);
|
|
1633
|
-
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) ?
|
|
1659
|
+
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) ? de(t, e) : void 0;
|
|
1634
1660
|
}
|
|
1635
1661
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
1636
1662
|
r && (t = r);
|
|
@@ -1674,21 +1700,83 @@ var OHLCV_INDICATORS;
|
|
|
1674
1700
|
}
|
|
1675
1701
|
};
|
|
1676
1702
|
}
|
|
1677
|
-
function
|
|
1703
|
+
function de(t, e) {
|
|
1678
1704
|
(null == e || e > t.length) && (e = t.length);
|
|
1679
1705
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1680
1706
|
return n;
|
|
1681
1707
|
}
|
|
1682
|
-
var
|
|
1708
|
+
var be = "close";
|
|
1709
|
+
// ./src/utilities/numberUtilities.js
|
|
1710
|
+
function ge(t) {
|
|
1711
|
+
return ge = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1712
|
+
return typeof t;
|
|
1713
|
+
} : function(t) {
|
|
1714
|
+
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1715
|
+
}, ge(t);
|
|
1716
|
+
}
|
|
1717
|
+
// Helper to clean non-numeric characters (except "-" at the start and decimal point)
|
|
1718
|
+
var we = {
|
|
1719
|
+
number: function(t) {
|
|
1720
|
+
return t;
|
|
1721
|
+
},
|
|
1722
|
+
numberCleanString: function(t) {
|
|
1723
|
+
return Number(t);
|
|
1724
|
+
},
|
|
1725
|
+
numberDirtyString: function(t) {
|
|
1726
|
+
return Number(t.replace(/(?!^-)[^0-9.]/g, ""));
|
|
1727
|
+
}
|
|
1728
|
+
}, Se = function(t) {
|
|
1729
|
+
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
1730
|
+
// 1) true numbers
|
|
1731
|
+
if ("number" == typeof t && !Number.isNaN(t)) return "number";
|
|
1732
|
+
// 2) strings
|
|
1733
|
+
if ("string" == typeof t) {
|
|
1734
|
+
var r = t.trim(), n = /^-?\d+(\.\d+)?$/;
|
|
1735
|
+
// a) clean numeric string: only digits and an optional single period
|
|
1736
|
+
if (n.test(r)) return "numberCleanString";
|
|
1737
|
+
// b) dirty numeric string: contains non-digits (dollar, commas, letters, etc.)
|
|
1738
|
+
// but once you strip those out, you're left with a valid number
|
|
1739
|
+
var o = r.replace(/[^0-9.]/g, "");
|
|
1740
|
+
if (o && n.test(o)) return "numberDirtyString";
|
|
1741
|
+
}
|
|
1742
|
+
if (e) throw new TypeError("Invalid input: expected a number or numeric string");
|
|
1743
|
+
return ge(t);
|
|
1744
|
+
}, Oe = function(t, e) {
|
|
1745
|
+
var r = Math.pow(10, e);
|
|
1746
|
+
// add a tiny epsilon to mitigate floating-point quirks around .5
|
|
1747
|
+
return Math.round((t + Number.EPSILON) * r) / r;
|
|
1748
|
+
};
|
|
1683
1749
|
// ./src/moving-averages/donchianChannel.js
|
|
1684
|
-
function
|
|
1685
|
-
return
|
|
1750
|
+
function je(t) {
|
|
1751
|
+
return function(t) {
|
|
1752
|
+
if (Array.isArray(t)) return _e(t);
|
|
1753
|
+
}(t) || function(t) {
|
|
1754
|
+
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
1755
|
+
}(t) || Pe(t) || function() {
|
|
1756
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1757
|
+
}();
|
|
1758
|
+
}
|
|
1759
|
+
function Pe(t, e) {
|
|
1760
|
+
if (t) {
|
|
1761
|
+
if ("string" == typeof t) return _e(t, e);
|
|
1762
|
+
var r = {}.toString.call(t).slice(8, -1);
|
|
1763
|
+
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) ? _e(t, e) : void 0;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
function _e(t, e) {
|
|
1767
|
+
(null == e || e > t.length) && (e = t.length);
|
|
1768
|
+
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1769
|
+
return n;
|
|
1770
|
+
}
|
|
1771
|
+
// ./src/moving-averages/bollingerBands.js
|
|
1772
|
+
function Ne(t) {
|
|
1773
|
+
return Ne = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1686
1774
|
return typeof t;
|
|
1687
1775
|
} : function(t) {
|
|
1688
1776
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1689
|
-
},
|
|
1777
|
+
}, Ne(t);
|
|
1690
1778
|
}
|
|
1691
|
-
function
|
|
1779
|
+
function Ae(t, e) {
|
|
1692
1780
|
var r = Object.keys(t);
|
|
1693
1781
|
if (Object.getOwnPropertySymbols) {
|
|
1694
1782
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -1698,19 +1786,19 @@ var OHLCV_INDICATORS;
|
|
|
1698
1786
|
}
|
|
1699
1787
|
return r;
|
|
1700
1788
|
}
|
|
1701
|
-
function
|
|
1789
|
+
function Te(t, e, r) {
|
|
1702
1790
|
return (e = function(t) {
|
|
1703
1791
|
var e = function(t, e) {
|
|
1704
|
-
if ("object" !=
|
|
1792
|
+
if ("object" != Ne(t) || !t) return t;
|
|
1705
1793
|
var r = t[Symbol.toPrimitive];
|
|
1706
1794
|
if (void 0 !== r) {
|
|
1707
1795
|
var n = r.call(t, e || "default");
|
|
1708
|
-
if ("object" !=
|
|
1796
|
+
if ("object" != Ne(n)) return n;
|
|
1709
1797
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1710
1798
|
}
|
|
1711
1799
|
return ("string" === e ? String : Number)(t);
|
|
1712
1800
|
}(t, "string");
|
|
1713
|
-
return "symbol" ==
|
|
1801
|
+
return "symbol" == Ne(e) ? e : e + "";
|
|
1714
1802
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1715
1803
|
value: r,
|
|
1716
1804
|
enumerable: !0,
|
|
@@ -1718,14 +1806,14 @@ var OHLCV_INDICATORS;
|
|
|
1718
1806
|
writable: !0
|
|
1719
1807
|
}) : t[e] = r, t;
|
|
1720
1808
|
}
|
|
1721
|
-
function
|
|
1809
|
+
function Ee(t, e) {
|
|
1722
1810
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1723
1811
|
if (!r) {
|
|
1724
1812
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
1725
1813
|
if (t) {
|
|
1726
|
-
if ("string" == typeof t) return
|
|
1814
|
+
if ("string" == typeof t) return ke(t, e);
|
|
1727
1815
|
var r = {}.toString.call(t).slice(8, -1);
|
|
1728
|
-
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) ?
|
|
1816
|
+
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) ? ke(t, e) : void 0;
|
|
1729
1817
|
}
|
|
1730
1818
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
1731
1819
|
r && (t = r);
|
|
@@ -1769,42 +1857,32 @@ var OHLCV_INDICATORS;
|
|
|
1769
1857
|
}
|
|
1770
1858
|
};
|
|
1771
1859
|
}
|
|
1772
|
-
function
|
|
1860
|
+
function ke(t, e) {
|
|
1773
1861
|
(null == e || e > t.length) && (e = t.length);
|
|
1774
1862
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1775
1863
|
return n;
|
|
1776
1864
|
}
|
|
1777
|
-
// ./src/
|
|
1778
|
-
function
|
|
1779
|
-
return
|
|
1865
|
+
// ./src/oscillators/volumeOscillator.js
|
|
1866
|
+
function xe(t) {
|
|
1867
|
+
return xe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1780
1868
|
return typeof t;
|
|
1781
1869
|
} : function(t) {
|
|
1782
1870
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1783
|
-
},
|
|
1784
|
-
}
|
|
1785
|
-
function Se(t, e) {
|
|
1786
|
-
var r = Object.keys(t);
|
|
1787
|
-
if (Object.getOwnPropertySymbols) {
|
|
1788
|
-
var n = Object.getOwnPropertySymbols(t);
|
|
1789
|
-
e && (n = n.filter((function(e) {
|
|
1790
|
-
return Object.getOwnPropertyDescriptor(t, e).enumerable;
|
|
1791
|
-
}))), r.push.apply(r, n);
|
|
1792
|
-
}
|
|
1793
|
-
return r;
|
|
1871
|
+
}, xe(t);
|
|
1794
1872
|
}
|
|
1795
|
-
function
|
|
1873
|
+
function Ie(t, e, r) {
|
|
1796
1874
|
return (e = function(t) {
|
|
1797
1875
|
var e = function(t, e) {
|
|
1798
|
-
if ("object" !=
|
|
1876
|
+
if ("object" != xe(t) || !t) return t;
|
|
1799
1877
|
var r = t[Symbol.toPrimitive];
|
|
1800
1878
|
if (void 0 !== r) {
|
|
1801
1879
|
var n = r.call(t, e || "default");
|
|
1802
|
-
if ("object" !=
|
|
1880
|
+
if ("object" != xe(n)) return n;
|
|
1803
1881
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1804
1882
|
}
|
|
1805
1883
|
return ("string" === e ? String : Number)(t);
|
|
1806
1884
|
}(t, "string");
|
|
1807
|
-
return "symbol" ==
|
|
1885
|
+
return "symbol" == xe(e) ? e : e + "";
|
|
1808
1886
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1809
1887
|
value: r,
|
|
1810
1888
|
enumerable: !0,
|
|
@@ -1812,107 +1890,28 @@ var OHLCV_INDICATORS;
|
|
|
1812
1890
|
writable: !0
|
|
1813
1891
|
}) : t[e] = r, t;
|
|
1814
1892
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
if (Array.isArray(t) || (r = function(t, e) {
|
|
1819
|
-
if (t) {
|
|
1820
|
-
if ("string" == typeof t) return _e(t, e);
|
|
1821
|
-
var r = {}.toString.call(t).slice(8, -1);
|
|
1822
|
-
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) ? _e(t, e) : void 0;
|
|
1823
|
-
}
|
|
1824
|
-
}(t)) || e && t && "number" == typeof t.length) {
|
|
1825
|
-
r && (t = r);
|
|
1826
|
-
var n = 0, o = function() {};
|
|
1827
|
-
return {
|
|
1828
|
-
s: o,
|
|
1829
|
-
n: function() {
|
|
1830
|
-
return n >= t.length ? {
|
|
1831
|
-
done: !0
|
|
1832
|
-
} : {
|
|
1833
|
-
done: !1,
|
|
1834
|
-
value: t[n++]
|
|
1835
|
-
};
|
|
1836
|
-
},
|
|
1837
|
-
e: function(t) {
|
|
1838
|
-
throw t;
|
|
1839
|
-
},
|
|
1840
|
-
f: o
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1844
|
-
}
|
|
1845
|
-
var i, a = !0, u = !1;
|
|
1846
|
-
return {
|
|
1847
|
-
s: function() {
|
|
1848
|
-
r = r.call(t);
|
|
1849
|
-
},
|
|
1850
|
-
n: function() {
|
|
1851
|
-
var t = r.next();
|
|
1852
|
-
return a = t.done, t;
|
|
1853
|
-
},
|
|
1854
|
-
e: function(t) {
|
|
1855
|
-
u = !0, i = t;
|
|
1856
|
-
},
|
|
1857
|
-
f: function() {
|
|
1858
|
-
try {
|
|
1859
|
-
a || null == r.return || r.return();
|
|
1860
|
-
} finally {
|
|
1861
|
-
if (u) throw i;
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
function _e(t, e) {
|
|
1867
|
-
(null == e || e > t.length) && (e = t.length);
|
|
1868
|
-
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1869
|
-
return n;
|
|
1870
|
-
}
|
|
1871
|
-
// ./src/utilities/numberUtilities.js
|
|
1872
|
-
function Ne(t) {
|
|
1873
|
-
return Ne = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1893
|
+
// ./src/utilities/dateUtilities.js
|
|
1894
|
+
function De(t) {
|
|
1895
|
+
return De = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1874
1896
|
return typeof t;
|
|
1875
1897
|
} : function(t) {
|
|
1876
1898
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1877
|
-
},
|
|
1899
|
+
}, De(t);
|
|
1878
1900
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
return t;
|
|
1901
|
+
var Me = {
|
|
1902
|
+
string: function(t) {
|
|
1903
|
+
return t.toISOString();
|
|
1883
1904
|
},
|
|
1884
|
-
|
|
1885
|
-
return
|
|
1905
|
+
milliseconds: function(t) {
|
|
1906
|
+
return t.getTime();
|
|
1886
1907
|
},
|
|
1887
|
-
|
|
1888
|
-
return
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
// 1) true numbers
|
|
1893
|
-
if ("number" == typeof t && !Number.isNaN(t)) return "number";
|
|
1894
|
-
// 2) strings
|
|
1895
|
-
if ("string" == typeof t) {
|
|
1896
|
-
var r = t.trim(), n = /^-?\d+(\.\d+)?$/;
|
|
1897
|
-
// a) clean numeric string: only digits and an optional single period
|
|
1898
|
-
if (n.test(r)) return "numberCleanString";
|
|
1899
|
-
// b) dirty numeric string: contains non-digits (dollar, commas, letters, etc.)
|
|
1900
|
-
// but once you strip those out, you're left with a valid number
|
|
1901
|
-
var o = r.replace(/[^0-9.]/g, "");
|
|
1902
|
-
if (o && n.test(o)) return "numberDirtyString";
|
|
1908
|
+
seconds: function(t) {
|
|
1909
|
+
return t.getTime() / 1e3;
|
|
1910
|
+
},
|
|
1911
|
+
object: function(t) {
|
|
1912
|
+
return t;
|
|
1903
1913
|
}
|
|
1904
|
-
|
|
1905
|
-
return Ne(t);
|
|
1906
|
-
};
|
|
1907
|
-
// ./src/utilities/dateUtilities.js
|
|
1908
|
-
function Ee(t) {
|
|
1909
|
-
return Ee = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1910
|
-
return typeof t;
|
|
1911
|
-
} : function(t) {
|
|
1912
|
-
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1913
|
-
}, Ee(t);
|
|
1914
|
-
}
|
|
1915
|
-
var xe = {
|
|
1914
|
+
}, Re = {
|
|
1916
1915
|
dateObject: function(t) {
|
|
1917
1916
|
return t;
|
|
1918
1917
|
},
|
|
@@ -1928,14 +1927,14 @@ var OHLCV_INDICATORS;
|
|
|
1928
1927
|
dateCompleteDateString: function(t) {
|
|
1929
1928
|
return new Date(t);
|
|
1930
1929
|
}
|
|
1931
|
-
},
|
|
1930
|
+
}, Ce = function(t) {
|
|
1932
1931
|
// Regex for a UTC Time Format where the string ends with "Z".
|
|
1933
1932
|
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() {
|
|
1934
|
-
throw new Error('Invalid "'.concat(
|
|
1933
|
+
throw new Error('Invalid "'.concat(De(t), '" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")));
|
|
1935
1934
|
};
|
|
1936
1935
|
// Regex for a Timezone Offset Format,
|
|
1937
1936
|
// which includes a plus or minus sign followed by HH:MM at the end.
|
|
1938
|
-
if ("object" ===
|
|
1937
|
+
if ("object" === De(t)) {
|
|
1939
1938
|
if (t instanceof Date && !isNaN(t.valueOf())) return "dateObject";
|
|
1940
1939
|
r();
|
|
1941
1940
|
} else {
|
|
@@ -1952,7 +1951,7 @@ var OHLCV_INDICATORS;
|
|
|
1952
1951
|
}
|
|
1953
1952
|
};
|
|
1954
1953
|
// ./src/utilities/assignTypes.js
|
|
1955
|
-
function
|
|
1954
|
+
function Fe(t, e) {
|
|
1956
1955
|
return function(t) {
|
|
1957
1956
|
if (Array.isArray(t)) return t;
|
|
1958
1957
|
}(t) || function(t, e) {
|
|
@@ -1977,24 +1976,24 @@ var OHLCV_INDICATORS;
|
|
|
1977
1976
|
}
|
|
1978
1977
|
}(t, e) || function(t, e) {
|
|
1979
1978
|
if (t) {
|
|
1980
|
-
if ("string" == typeof t) return
|
|
1979
|
+
if ("string" == typeof t) return Le(t, e);
|
|
1981
1980
|
var r = {}.toString.call(t).slice(8, -1);
|
|
1982
|
-
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) ?
|
|
1981
|
+
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) ? Le(t, e) : void 0;
|
|
1983
1982
|
}
|
|
1984
1983
|
}(t, e) || function() {
|
|
1985
1984
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1986
1985
|
}();
|
|
1987
1986
|
}
|
|
1988
|
-
function
|
|
1987
|
+
function Le(t, e) {
|
|
1989
1988
|
(null == e || e > t.length) && (e = t.length);
|
|
1990
1989
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1991
1990
|
return n;
|
|
1992
1991
|
}
|
|
1993
|
-
var
|
|
1992
|
+
var Be = new Set([ "open", "high", "low", "close" ]), He = function(t, e) {
|
|
1994
1993
|
return "Array" === t ? new Array(e).fill(null) : "Float64Array" === t ? new Float64Array(e).fill(NaN) : "Int32Array" === t ? new Int32Array(e).fill(NaN) : void 0;
|
|
1995
1994
|
};
|
|
1996
1995
|
// ./src/studies/lag.js
|
|
1997
|
-
function
|
|
1996
|
+
function Ve(t, e) {
|
|
1998
1997
|
return function(t) {
|
|
1999
1998
|
if (Array.isArray(t)) return t;
|
|
2000
1999
|
}(t) || function(t, e) {
|
|
@@ -2017,14 +2016,14 @@ var OHLCV_INDICATORS;
|
|
|
2017
2016
|
}
|
|
2018
2017
|
return u;
|
|
2019
2018
|
}
|
|
2020
|
-
}(t, e) ||
|
|
2019
|
+
}(t, e) || $e(t, e) || function() {
|
|
2021
2020
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2022
2021
|
}();
|
|
2023
2022
|
}
|
|
2024
|
-
function
|
|
2023
|
+
function Ue(t, e) {
|
|
2025
2024
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2026
2025
|
if (!r) {
|
|
2027
|
-
if (Array.isArray(t) || (r =
|
|
2026
|
+
if (Array.isArray(t) || (r = $e(t)) || e && t && "number" == typeof t.length) {
|
|
2028
2027
|
r && (t = r);
|
|
2029
2028
|
var n = 0, o = function() {};
|
|
2030
2029
|
return {
|
|
@@ -2066,22 +2065,22 @@ var OHLCV_INDICATORS;
|
|
|
2066
2065
|
}
|
|
2067
2066
|
};
|
|
2068
2067
|
}
|
|
2069
|
-
function
|
|
2068
|
+
function $e(t, e) {
|
|
2070
2069
|
if (t) {
|
|
2071
|
-
if ("string" == typeof t) return
|
|
2070
|
+
if ("string" == typeof t) return qe(t, e);
|
|
2072
2071
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2073
|
-
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) ?
|
|
2072
|
+
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) ? qe(t, e) : void 0;
|
|
2074
2073
|
}
|
|
2075
2074
|
}
|
|
2076
|
-
function
|
|
2075
|
+
function qe(t, e) {
|
|
2077
2076
|
(null == e || e > t.length) && (e = t.length);
|
|
2078
2077
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2079
2078
|
return n;
|
|
2080
2079
|
}
|
|
2081
|
-
var
|
|
2080
|
+
var ze = function(t, e) {
|
|
2082
2081
|
var r = t.instances, n = t.verticalOhlcv, o = t.len, i = t.arrayTypes, a = t.priceBased;
|
|
2083
2082
|
if (0 === e) {
|
|
2084
|
-
var u, l = [], c =
|
|
2083
|
+
var u, l = [], c = Ue(t.inputParams);
|
|
2085
2084
|
try {
|
|
2086
2085
|
for (c.s(); !(u = c.n()).done; ) {
|
|
2087
2086
|
var s = u.value;
|
|
@@ -2093,7 +2092,7 @@ var OHLCV_INDICATORS;
|
|
|
2093
2092
|
c.f();
|
|
2094
2093
|
}
|
|
2095
2094
|
for (var f = 0, y = l; f < y.length; f++) {
|
|
2096
|
-
var h, p =
|
|
2095
|
+
var h, p = Ve(y[f], 2), v = p[0], m = p[1], d = Ue(v);
|
|
2097
2096
|
try {
|
|
2098
2097
|
for (d.s(); !(h = d.n()).done; ) {
|
|
2099
2098
|
var b = h.value;
|
|
@@ -2109,26 +2108,26 @@ var OHLCV_INDICATORS;
|
|
|
2109
2108
|
lagParams: l
|
|
2110
2109
|
};
|
|
2111
2110
|
}
|
|
2112
|
-
var w,
|
|
2111
|
+
var w, S = Ue(r.lag.lagParams);
|
|
2113
2112
|
try {
|
|
2114
|
-
for (
|
|
2115
|
-
var
|
|
2113
|
+
for (S.s(); !(w = S.n()).done; ) {
|
|
2114
|
+
var O, j = Ve(w.value, 2), P = j[0], _ = j[1], N = Ue(P);
|
|
2116
2115
|
try {
|
|
2117
|
-
for (N.s(); !(
|
|
2118
|
-
var
|
|
2116
|
+
for (N.s(); !(O = N.n()).done; ) {
|
|
2117
|
+
var A = O.value, T = n[A];
|
|
2119
2118
|
// Initialize lagged arrays only on the first index
|
|
2120
2119
|
if (0 === e) for (var E = 1; E <= _; E++) {
|
|
2121
|
-
var
|
|
2122
|
-
if (!i.hasOwnProperty(
|
|
2123
|
-
n[
|
|
2120
|
+
var k = "".concat(A, "_lag_").concat(E);
|
|
2121
|
+
if (!i.hasOwnProperty(A)) throw new Error('Lag processing invoked by "'.concat(A, '" expected arrayTypes to have a "').concat(A, '" property, but it wasn’t found.'));
|
|
2122
|
+
n[k] = He(i[A], o), i[k] = i[A];
|
|
2124
2123
|
}
|
|
2125
2124
|
// Populate lagged values
|
|
2126
|
-
for (var
|
|
2127
|
-
var I = "".concat(
|
|
2125
|
+
for (var x = 1; x <= _; x++) {
|
|
2126
|
+
var I = "".concat(A, "_lag_").concat(x), D = e - x, M = D <= 0 || void 0 === T[D] ? null : T[D];
|
|
2128
2127
|
t.pushToMain({
|
|
2129
2128
|
index: e,
|
|
2130
2129
|
key: I,
|
|
2131
|
-
value:
|
|
2130
|
+
value: M
|
|
2132
2131
|
});
|
|
2133
2132
|
}
|
|
2134
2133
|
}
|
|
@@ -2139,21 +2138,21 @@ var OHLCV_INDICATORS;
|
|
|
2139
2138
|
}
|
|
2140
2139
|
}
|
|
2141
2140
|
} catch (t) {
|
|
2142
|
-
|
|
2141
|
+
S.e(t);
|
|
2143
2142
|
} finally {
|
|
2144
|
-
|
|
2143
|
+
S.f();
|
|
2145
2144
|
}
|
|
2146
2145
|
return !0;
|
|
2147
2146
|
};
|
|
2148
2147
|
// ./src/studies/findCrosses.js
|
|
2149
|
-
function
|
|
2148
|
+
function Ge(t, e) {
|
|
2150
2149
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2151
2150
|
if (!r) {
|
|
2152
2151
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
2153
2152
|
if (t) {
|
|
2154
|
-
if ("string" == typeof t) return
|
|
2153
|
+
if ("string" == typeof t) return Ke(t, e);
|
|
2155
2154
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2156
|
-
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) ?
|
|
2155
|
+
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) ? Ke(t, e) : void 0;
|
|
2157
2156
|
}
|
|
2158
2157
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
2159
2158
|
r && (t = r);
|
|
@@ -2197,43 +2196,43 @@ var OHLCV_INDICATORS;
|
|
|
2197
2196
|
}
|
|
2198
2197
|
};
|
|
2199
2198
|
}
|
|
2200
|
-
function
|
|
2199
|
+
function Ke(t, e) {
|
|
2201
2200
|
(null == e || e > t.length) && (e = t.length);
|
|
2202
2201
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2203
2202
|
return n;
|
|
2204
2203
|
}
|
|
2205
|
-
function
|
|
2206
|
-
return
|
|
2204
|
+
function Ye(t) {
|
|
2205
|
+
return Ye = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2207
2206
|
return typeof t;
|
|
2208
2207
|
} : function(t) {
|
|
2209
2208
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2210
|
-
},
|
|
2209
|
+
}, Ye(t);
|
|
2211
2210
|
}
|
|
2212
|
-
function
|
|
2211
|
+
function Je(t, e) {
|
|
2213
2212
|
for (var r = 0; r < e.length; r++) {
|
|
2214
2213
|
var n = e[r];
|
|
2215
2214
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
2216
|
-
Object.defineProperty(t,
|
|
2215
|
+
Object.defineProperty(t, Ze(n.key), n);
|
|
2217
2216
|
}
|
|
2218
2217
|
}
|
|
2219
|
-
function
|
|
2218
|
+
function Ze(t) {
|
|
2220
2219
|
var e = function(t, e) {
|
|
2221
|
-
if ("object" !=
|
|
2220
|
+
if ("object" != Ye(t) || !t) return t;
|
|
2222
2221
|
var r = t[Symbol.toPrimitive];
|
|
2223
2222
|
if (void 0 !== r) {
|
|
2224
2223
|
var n = r.call(t, e || "default");
|
|
2225
|
-
if ("object" !=
|
|
2224
|
+
if ("object" != Ye(n)) return n;
|
|
2226
2225
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2227
2226
|
}
|
|
2228
2227
|
return ("string" === e ? String : Number)(t);
|
|
2229
2228
|
}(t, "string");
|
|
2230
|
-
return "symbol" ==
|
|
2229
|
+
return "symbol" == Ye(e) ? e : e + "";
|
|
2231
2230
|
}
|
|
2232
|
-
var
|
|
2231
|
+
var Qe = function(t, e) {
|
|
2233
2232
|
return t > e;
|
|
2234
|
-
},
|
|
2233
|
+
}, We = function(t, e) {
|
|
2235
2234
|
return t < e;
|
|
2236
|
-
},
|
|
2235
|
+
}, Xe = function() {
|
|
2237
2236
|
return t = function t() {
|
|
2238
2237
|
!function(t, e) {
|
|
2239
2238
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -2257,11 +2256,11 @@ var OHLCV_INDICATORS;
|
|
|
2257
2256
|
this.areHighAndLowUndefined || void 0 !== n && void 0 !== i || (this.areHighAndLowUndefined = !0),
|
|
2258
2257
|
Number.isNaN(r) || Number.isNaN(o) || function(t, e) {
|
|
2259
2258
|
return t === e;
|
|
2260
|
-
}(r, o) ? a = .5 :
|
|
2259
|
+
}(r, o) ? a = .5 : Qe(r, o) ? a = this.areHighAndLowUndefined ? 1 : [ i, o, this.prevLow, this.prevSlow ].every((function(t) {
|
|
2261
2260
|
return !Number.isNaN(t);
|
|
2262
|
-
})) &&
|
|
2261
|
+
})) && We(i, o) && Qe(this.prevLow, this.prevSlow) ? 0 : 1 : We(r, o) && (a = this.areHighAndLowUndefined ? 0 : [ n, o, this.prevHigh, this.prevSlow ].every((function(t) {
|
|
2263
2262
|
return !Number.isNaN(t);
|
|
2264
|
-
})) &&
|
|
2263
|
+
})) && Qe(n, o) && We(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--),
|
|
2265
2264
|
1 === this.interval && this.crossIndexes.up.push(t), -1 === this.interval && this.crossIndexes.down.push(t),
|
|
2266
2265
|
//save prev state
|
|
2267
2266
|
Object.assign(this, {
|
|
@@ -2277,21 +2276,21 @@ var OHLCV_INDICATORS;
|
|
|
2277
2276
|
value: function() {
|
|
2278
2277
|
return this.interval;
|
|
2279
2278
|
}
|
|
2280
|
-
} ]) &&
|
|
2279
|
+
} ]) && Je(t.prototype, e), r && Je(t, r), Object.defineProperty(t, "prototype", {
|
|
2281
2280
|
writable: !1
|
|
2282
2281
|
}), t;
|
|
2283
2282
|
var t, e, r;
|
|
2284
|
-
}(),
|
|
2283
|
+
}(), tr = function(t, e) {
|
|
2285
2284
|
var r = t.verticalOhlcv, n = t.instances, o = t.len, i = t.arrayTypes, a = t.verticalOhlcvTempCols;
|
|
2286
2285
|
if (0 === e) {
|
|
2287
2286
|
var u = t.inputParams;
|
|
2288
2287
|
n.crossPairsList = u.reduce((function(t, e) {
|
|
2289
2288
|
var r = e.key, n = e.params;
|
|
2290
2289
|
if ("crossPairs" === r) {
|
|
2291
|
-
var o, i =
|
|
2290
|
+
var o, i = Ge(n);
|
|
2292
2291
|
try {
|
|
2293
2292
|
for (i.s(); !(o = i.n()).done; ) {
|
|
2294
|
-
var a, u =
|
|
2293
|
+
var a, u = Ge(o.value);
|
|
2295
2294
|
try {
|
|
2296
2295
|
for (u.s(); !(a = u.n()).done; ) {
|
|
2297
2296
|
var l = a.value;
|
|
@@ -2312,7 +2311,7 @@ var OHLCV_INDICATORS;
|
|
|
2312
2311
|
return t;
|
|
2313
2312
|
}), []);
|
|
2314
2313
|
}
|
|
2315
|
-
var l, c =
|
|
2314
|
+
var l, c = Ge(n.crossPairsList);
|
|
2316
2315
|
try {
|
|
2317
2316
|
for (c.s(); !(l = c.n()).done; ) {
|
|
2318
2317
|
var s = l.value, f = s.fast, y = s.slow;
|
|
@@ -2322,7 +2321,7 @@ var OHLCV_INDICATORS;
|
|
|
2322
2321
|
if ("number" == typeof y && (a.add(y.toString()), r[y.toString()] = new Int32Array(o).fill(y)),
|
|
2323
2322
|
"price" !== f && !r.hasOwnProperty(f)) throw Error('fast "'.concat(f, ' not found in crossPairs"'));
|
|
2324
2323
|
if (!r.hasOwnProperty(y)) throw Error('slow "'.concat(y, ' not found in crossPairs"'));
|
|
2325
|
-
n[h] = new
|
|
2324
|
+
n[h] = new Xe, r[h] = new Int32Array(o).fill(NaN), i[h] = "Int32Array";
|
|
2326
2325
|
}
|
|
2327
2326
|
var p = void 0, v = void 0, m = void 0, d = void 0, b = void 0;
|
|
2328
2327
|
"price" === f ? (v = r.close[e], m = r.high[e], d = r.low[e], b = r[y][e], n[h].update(e, {
|
|
@@ -2347,14 +2346,14 @@ var OHLCV_INDICATORS;
|
|
|
2347
2346
|
}
|
|
2348
2347
|
};
|
|
2349
2348
|
// ./src/studies/dateTime.js
|
|
2350
|
-
function
|
|
2351
|
-
return
|
|
2349
|
+
function er(t) {
|
|
2350
|
+
return er = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2352
2351
|
return typeof t;
|
|
2353
2352
|
} : function(t) {
|
|
2354
2353
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2355
|
-
},
|
|
2354
|
+
}, er(t);
|
|
2356
2355
|
}
|
|
2357
|
-
function
|
|
2356
|
+
function rr(t, e) {
|
|
2358
2357
|
var r = Object.keys(t);
|
|
2359
2358
|
if (Object.getOwnPropertySymbols) {
|
|
2360
2359
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -2364,19 +2363,19 @@ var OHLCV_INDICATORS;
|
|
|
2364
2363
|
}
|
|
2365
2364
|
return r;
|
|
2366
2365
|
}
|
|
2367
|
-
function
|
|
2366
|
+
function nr(t, e, r) {
|
|
2368
2367
|
return (e = function(t) {
|
|
2369
2368
|
var e = function(t, e) {
|
|
2370
|
-
if ("object" !=
|
|
2369
|
+
if ("object" != er(t) || !t) return t;
|
|
2371
2370
|
var r = t[Symbol.toPrimitive];
|
|
2372
2371
|
if (void 0 !== r) {
|
|
2373
2372
|
var n = r.call(t, e || "default");
|
|
2374
|
-
if ("object" !=
|
|
2373
|
+
if ("object" != er(n)) return n;
|
|
2375
2374
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2376
2375
|
}
|
|
2377
2376
|
return ("string" === e ? String : Number)(t);
|
|
2378
2377
|
}(t, "string");
|
|
2379
|
-
return "symbol" ==
|
|
2378
|
+
return "symbol" == er(e) ? e : e + "";
|
|
2380
2379
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
2381
2380
|
value: r,
|
|
2382
2381
|
enumerable: !0,
|
|
@@ -2384,7 +2383,7 @@ var OHLCV_INDICATORS;
|
|
|
2384
2383
|
writable: !0
|
|
2385
2384
|
}) : t[e] = r, t;
|
|
2386
2385
|
}
|
|
2387
|
-
var
|
|
2386
|
+
var or = function(t) {
|
|
2388
2387
|
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();
|
|
2389
2388
|
return {
|
|
2390
2389
|
month: e,
|
|
@@ -2397,19 +2396,19 @@ var OHLCV_INDICATORS;
|
|
|
2397
2396
|
};
|
|
2398
2397
|
};
|
|
2399
2398
|
// ./src/studies/scaler.js
|
|
2400
|
-
function
|
|
2399
|
+
function ir(t) {
|
|
2401
2400
|
return function(t) {
|
|
2402
|
-
if (Array.isArray(t)) return
|
|
2401
|
+
if (Array.isArray(t)) return cr(t);
|
|
2403
2402
|
}(t) || function(t) {
|
|
2404
2403
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2405
|
-
}(t) ||
|
|
2404
|
+
}(t) || lr(t) || function() {
|
|
2406
2405
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2407
2406
|
}();
|
|
2408
2407
|
}
|
|
2409
|
-
function
|
|
2408
|
+
function ar(t, e) {
|
|
2410
2409
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2411
2410
|
if (!r) {
|
|
2412
|
-
if (Array.isArray(t) || (r =
|
|
2411
|
+
if (Array.isArray(t) || (r = lr(t)) || e && t && "number" == typeof t.length) {
|
|
2413
2412
|
r && (t = r);
|
|
2414
2413
|
var n = 0, o = function() {};
|
|
2415
2414
|
return {
|
|
@@ -2451,7 +2450,7 @@ var OHLCV_INDICATORS;
|
|
|
2451
2450
|
}
|
|
2452
2451
|
};
|
|
2453
2452
|
}
|
|
2454
|
-
function
|
|
2453
|
+
function ur(t, e) {
|
|
2455
2454
|
return function(t) {
|
|
2456
2455
|
if (Array.isArray(t)) return t;
|
|
2457
2456
|
}
|
|
@@ -2475,36 +2474,36 @@ var OHLCV_INDICATORS;
|
|
|
2475
2474
|
}
|
|
2476
2475
|
return u;
|
|
2477
2476
|
}
|
|
2478
|
-
}(t, e) ||
|
|
2477
|
+
}(t, e) || lr(t, e) || function() {
|
|
2479
2478
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2480
2479
|
}();
|
|
2481
2480
|
}
|
|
2482
|
-
function
|
|
2481
|
+
function lr(t, e) {
|
|
2483
2482
|
if (t) {
|
|
2484
|
-
if ("string" == typeof t) return
|
|
2483
|
+
if ("string" == typeof t) return cr(t, e);
|
|
2485
2484
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2486
|
-
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) ?
|
|
2485
|
+
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) ? cr(t, e) : void 0;
|
|
2487
2486
|
}
|
|
2488
2487
|
}
|
|
2489
|
-
function
|
|
2488
|
+
function cr(t, e) {
|
|
2490
2489
|
(null == e || e > t.length) && (e = t.length);
|
|
2491
2490
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2492
2491
|
return n;
|
|
2493
2492
|
}
|
|
2494
2493
|
// ./src/core-functions/mainLoop.js
|
|
2495
|
-
function
|
|
2494
|
+
function sr(t) {
|
|
2496
2495
|
return function(t) {
|
|
2497
|
-
if (Array.isArray(t)) return
|
|
2496
|
+
if (Array.isArray(t)) return pr(t);
|
|
2498
2497
|
}(t) || function(t) {
|
|
2499
2498
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2500
|
-
}(t) ||
|
|
2499
|
+
}(t) || hr(t) || function() {
|
|
2501
2500
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2502
2501
|
}();
|
|
2503
2502
|
}
|
|
2504
|
-
function
|
|
2503
|
+
function fr(t, e) {
|
|
2505
2504
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2506
2505
|
if (!r) {
|
|
2507
|
-
if (Array.isArray(t) || (r =
|
|
2506
|
+
if (Array.isArray(t) || (r = hr(t)) || e && t && "number" == typeof t.length) {
|
|
2508
2507
|
r && (t = r);
|
|
2509
2508
|
var n = 0, o = function() {};
|
|
2510
2509
|
return {
|
|
@@ -2546,7 +2545,7 @@ var OHLCV_INDICATORS;
|
|
|
2546
2545
|
}
|
|
2547
2546
|
};
|
|
2548
2547
|
}
|
|
2549
|
-
function
|
|
2548
|
+
function yr(t, e) {
|
|
2550
2549
|
return function(t) {
|
|
2551
2550
|
if (Array.isArray(t)) return t;
|
|
2552
2551
|
}
|
|
@@ -2571,23 +2570,23 @@ var OHLCV_INDICATORS;
|
|
|
2571
2570
|
}
|
|
2572
2571
|
return u;
|
|
2573
2572
|
}
|
|
2574
|
-
}(t, e) ||
|
|
2573
|
+
}(t, e) || hr(t, e) || function() {
|
|
2575
2574
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2576
2575
|
}();
|
|
2577
2576
|
}
|
|
2578
|
-
function
|
|
2577
|
+
function hr(t, e) {
|
|
2579
2578
|
if (t) {
|
|
2580
|
-
if ("string" == typeof t) return
|
|
2579
|
+
if ("string" == typeof t) return pr(t, e);
|
|
2581
2580
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2582
|
-
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) ?
|
|
2581
|
+
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) ? pr(t, e) : void 0;
|
|
2583
2582
|
}
|
|
2584
2583
|
}
|
|
2585
|
-
function
|
|
2584
|
+
function pr(t, e) {
|
|
2586
2585
|
(null == e || e > t.length) && (e = t.length);
|
|
2587
2586
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2588
2587
|
return n;
|
|
2589
2588
|
}
|
|
2590
|
-
var
|
|
2589
|
+
var vr = {
|
|
2591
2590
|
dateTime: function(t, e, r) {
|
|
2592
2591
|
var n = r.lag, o = t.instances, i = t.verticalOhlcv;
|
|
2593
2592
|
if (0 === e) {
|
|
@@ -2601,15 +2600,15 @@ var OHLCV_INDICATORS;
|
|
|
2601
2600
|
cachedDayInfo: i.date[0]
|
|
2602
2601
|
}
|
|
2603
2602
|
});
|
|
2604
|
-
for (var c = [ "day_of_the_week", "day_of_the_month", "week_of_the_month", "hour", "month", "year", "session_daily_index", "session_intraday_index" ], s = 0, f = c; s < f.length; s++) {
|
|
2603
|
+
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++) {
|
|
2605
2604
|
l[f[s]] = "Int32Array";
|
|
2606
2605
|
}
|
|
2607
2606
|
Object.assign(i, function(t) {
|
|
2608
2607
|
for (var e = 1; e < arguments.length; e++) {
|
|
2609
2608
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2610
|
-
e % 2 ?
|
|
2611
|
-
|
|
2612
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2609
|
+
e % 2 ? rr(Object(r), !0).forEach((function(e) {
|
|
2610
|
+
nr(t, e, r[e]);
|
|
2611
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : rr(Object(r)).forEach((function(e) {
|
|
2613
2612
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2614
2613
|
}));
|
|
2615
2614
|
}
|
|
@@ -2618,8 +2617,8 @@ var OHLCV_INDICATORS;
|
|
|
2618
2617
|
return [ t, new Int32Array(a).fill(NaN) ];
|
|
2619
2618
|
}))))), n > 0 && t.lag(c, n);
|
|
2620
2619
|
}
|
|
2621
|
-
var y = i.date[e], h =
|
|
2622
|
-
|
|
2620
|
+
var y = i.date[e], h = or(y), p = h.day_of_the_week, v = h.day_of_the_month, m = h.week_of_the_month, d = h.month, b = h.year, g = h.hour, w = h.minute, S = y;
|
|
2621
|
+
S !== o.dateTime.prevDateStr && (o.dateTime.prevDateStr = S, o.dateTime.sessionDailyIndexCount++,
|
|
2623
2622
|
o.dateTime.sessionIntradayIndexCount = 0), t.pushToMain({
|
|
2624
2623
|
index: e,
|
|
2625
2624
|
key: "session_daily_index",
|
|
@@ -2652,6 +2651,10 @@ var OHLCV_INDICATORS;
|
|
|
2652
2651
|
index: e,
|
|
2653
2652
|
key: "hour",
|
|
2654
2653
|
value: g
|
|
2654
|
+
}), t.pushToMain({
|
|
2655
|
+
index: e,
|
|
2656
|
+
key: "minute",
|
|
2657
|
+
value: w
|
|
2655
2658
|
}), o.dateTime.sessionIntradayIndexCount++;
|
|
2656
2659
|
},
|
|
2657
2660
|
rsi: function(t, e, r, n) {
|
|
@@ -2664,7 +2667,7 @@ var OHLCV_INDICATORS;
|
|
|
2664
2667
|
fast: c,
|
|
2665
2668
|
slow: s,
|
|
2666
2669
|
isDefault: !0
|
|
2667
|
-
}), Object.assign(u,
|
|
2670
|
+
}), Object.assign(u, se(se({}, c, new le(r)), s, new ft(r))), Object.assign(a, se(se({}, c, new Float64Array(y).fill(NaN)), s, new Float64Array(y).fill(NaN)));
|
|
2668
2671
|
var p = [ c, s ];
|
|
2669
2672
|
i > 0 && t.lag(p, i);
|
|
2670
2673
|
for (var v = 0, m = p; v < m.length; v++) {
|
|
@@ -2699,49 +2702,48 @@ var OHLCV_INDICATORS;
|
|
|
2699
2702
|
value: g
|
|
2700
2703
|
});
|
|
2701
2704
|
},
|
|
2702
|
-
ema:
|
|
2703
|
-
sma:
|
|
2705
|
+
ema: ye,
|
|
2706
|
+
sma: ye,
|
|
2704
2707
|
macd: function(t, e, r, n, o, i) {
|
|
2705
|
-
var a = i.target, u = i.lag, l =
|
|
2708
|
+
var a = i.target, u = i.lag, l = i.precomputed, c = t.verticalOhlcv, s = t.instances, f = l.instanceKey;
|
|
2706
2709
|
// Initialization on the first index.
|
|
2707
2710
|
if (0 === e) {
|
|
2708
|
-
var
|
|
2709
|
-
if (!
|
|
2710
|
-
var
|
|
2711
|
+
var y = t.inputParams, h = t.crossPairsList, p = t.priceBased, v = t.len, m = t.arrayTypes;
|
|
2712
|
+
if (!c.hasOwnProperty(a)) throw new Error("Target property ".concat(a, " not found in verticalOhlcv for macd."));
|
|
2713
|
+
var d, b = 0, g = me(y);
|
|
2711
2714
|
try {
|
|
2712
|
-
for (
|
|
2713
|
-
"macd" ===
|
|
2715
|
+
for (g.s(); !(d = g.n()).done; ) {
|
|
2716
|
+
"macd" === d.value.key && b++;
|
|
2714
2717
|
}
|
|
2715
2718
|
// Choose a display prefix based on the number of indicators.
|
|
2716
2719
|
} catch (t) {
|
|
2717
|
-
|
|
2720
|
+
g.e(t);
|
|
2718
2721
|
} finally {
|
|
2719
|
-
|
|
2722
|
+
g.f();
|
|
2720
2723
|
}
|
|
2721
|
-
var
|
|
2724
|
+
var w = b > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", S = a === be ? "".concat(w, "_diff") : "".concat(w, "_diff_").concat(a), O = a === be ? "".concat(w, "_dea") : "".concat(w, "_dea_").concat(a), j = a === be ? "".concat(w, "_histogram") : "".concat(w, "_histogram_").concat(a);
|
|
2722
2725
|
// Build the keys.
|
|
2723
|
-
|
|
2724
|
-
fast:
|
|
2726
|
+
h.push({
|
|
2727
|
+
fast: S,
|
|
2725
2728
|
slow: O,
|
|
2726
2729
|
isDefault: !0
|
|
2727
|
-
}),
|
|
2728
|
-
numberOfIndicators:
|
|
2730
|
+
}), s.hasOwnProperty("macd") || (s.macd = {
|
|
2731
|
+
numberOfIndicators: b,
|
|
2729
2732
|
settings: {}
|
|
2730
|
-
}),
|
|
2731
|
-
|
|
2732
|
-
h.add(t);
|
|
2733
|
+
}), s.macd.settings[f] = new Zt(new $t(r), new $t(n), new $t(o)), Object.assign(c, ve(ve(ve({}, S, new Float64Array(v).fill(NaN)), O, new Float64Array(v).fill(NaN)), j, new Float64Array(v).fill(NaN)))[j].forEach((function(t) {
|
|
2734
|
+
p.add(t);
|
|
2733
2735
|
}));
|
|
2734
|
-
var
|
|
2735
|
-
u > 0 && t.lag(
|
|
2736
|
-
for (var
|
|
2737
|
-
|
|
2736
|
+
var P = [ S, O, j ];
|
|
2737
|
+
u > 0 && t.lag(P, u);
|
|
2738
|
+
for (var _ = 0, N = P; _ < N.length; _++) {
|
|
2739
|
+
m[N[_]] = "Float64Array";
|
|
2738
2740
|
}
|
|
2739
2741
|
}
|
|
2740
|
-
var
|
|
2741
|
-
M.update(
|
|
2742
|
-
var
|
|
2742
|
+
var A = s.macd, T = A.numberOfIndicators, E = A.settings, k = T > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", x = a === be ? "".concat(k, "_diff") : "".concat(k, "_diff_").concat(a), I = a === be ? "".concat(k, "_dea") : "".concat(k, "_dea_").concat(a), D = a === be ? "".concat(k, "_histogram") : "".concat(k, "_histogram_").concat(a), M = E[f], R = c[a][e];
|
|
2743
|
+
M.update(R);
|
|
2744
|
+
var C = {};
|
|
2743
2745
|
try {
|
|
2744
|
-
|
|
2746
|
+
C = M.getResult();
|
|
2745
2747
|
} catch (t) {
|
|
2746
2748
|
// If the result is unavailable, macdResult remains NaN.
|
|
2747
2749
|
}
|
|
@@ -2749,15 +2751,15 @@ var OHLCV_INDICATORS;
|
|
|
2749
2751
|
return t.pushToMain({
|
|
2750
2752
|
index: e,
|
|
2751
2753
|
key: x,
|
|
2752
|
-
value:
|
|
2754
|
+
value: C ? C.macd : NaN
|
|
2753
2755
|
}), t.pushToMain({
|
|
2754
2756
|
index: e,
|
|
2755
|
-
key:
|
|
2756
|
-
value:
|
|
2757
|
+
key: I,
|
|
2758
|
+
value: C ? C.signal : NaN
|
|
2757
2759
|
}), t.pushToMain({
|
|
2758
2760
|
index: e,
|
|
2759
|
-
key:
|
|
2760
|
-
value:
|
|
2761
|
+
key: D,
|
|
2762
|
+
value: C ? C.histogram : NaN
|
|
2761
2763
|
}), !0;
|
|
2762
2764
|
},
|
|
2763
2765
|
relativeVolume: function(t, e, r, n) {
|
|
@@ -2765,7 +2767,7 @@ var OHLCV_INDICATORS;
|
|
|
2765
2767
|
if (0 === e) {
|
|
2766
2768
|
var l = t.len, c = t.arrayTypes;
|
|
2767
2769
|
a[i] = {
|
|
2768
|
-
instance: new
|
|
2770
|
+
instance: new ft(r),
|
|
2769
2771
|
prevRelativeVolumeSma: NaN
|
|
2770
2772
|
}, u[i] = new Float64Array(l).fill(NaN), o > 0 && t.lag([ i ], o), c[i] = "Float64Array";
|
|
2771
2773
|
}
|
|
@@ -2784,112 +2786,123 @@ var OHLCV_INDICATORS;
|
|
|
2784
2786
|
}), a[i].prevRelativeVolumeSma = y, !0;
|
|
2785
2787
|
},
|
|
2786
2788
|
donchianChannels: function(t, e, r, n, o) {
|
|
2787
|
-
var i =
|
|
2788
|
-
//
|
|
2789
|
+
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, h = o.range, p = o.decimals, v = "".concat(r, "_").concat(n);
|
|
2790
|
+
// ---- INIT (only at first bar) ----
|
|
2789
2791
|
if (0 === e) {
|
|
2790
|
-
|
|
2792
|
+
// how many donchianChannels calls in this session?
|
|
2793
|
+
var m = l.filter((function(t) {
|
|
2794
|
+
return "donchianChannels" === t.key;
|
|
2795
|
+
})).length, d = "donchian_channel", b = m > 1 ? "".concat(d, "_").concat(v) : d, g = [ "upper", "basis", "lower" ].map((function(t) {
|
|
2796
|
+
return "".concat(b, "_").concat(t);
|
|
2797
|
+
}));
|
|
2798
|
+
y && g.push("".concat(b, "_height"));
|
|
2799
|
+
var w, S = function(t, e) {
|
|
2800
|
+
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2801
|
+
if (!r) {
|
|
2802
|
+
if (Array.isArray(t) || (r = Pe(t)) || e && t && "number" == typeof t.length) {
|
|
2803
|
+
r && (t = r);
|
|
2804
|
+
var n = 0, o = function() {};
|
|
2805
|
+
return {
|
|
2806
|
+
s: o,
|
|
2807
|
+
n: function() {
|
|
2808
|
+
return n >= t.length ? {
|
|
2809
|
+
done: !0
|
|
2810
|
+
} : {
|
|
2811
|
+
done: !1,
|
|
2812
|
+
value: t[n++]
|
|
2813
|
+
};
|
|
2814
|
+
},
|
|
2815
|
+
e: function(t) {
|
|
2816
|
+
throw t;
|
|
2817
|
+
},
|
|
2818
|
+
f: o
|
|
2819
|
+
};
|
|
2820
|
+
}
|
|
2821
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2822
|
+
}
|
|
2823
|
+
var i, a = !0, u = !1;
|
|
2824
|
+
return {
|
|
2825
|
+
s: function() {
|
|
2826
|
+
r = r.call(t);
|
|
2827
|
+
},
|
|
2828
|
+
n: function() {
|
|
2829
|
+
var t = r.next();
|
|
2830
|
+
return a = t.done, t;
|
|
2831
|
+
},
|
|
2832
|
+
e: function(t) {
|
|
2833
|
+
u = !0, i = t;
|
|
2834
|
+
},
|
|
2835
|
+
f: function() {
|
|
2836
|
+
try {
|
|
2837
|
+
a || null == r.return || r.return();
|
|
2838
|
+
} finally {
|
|
2839
|
+
if (u) throw i;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2843
|
+
}(h);
|
|
2791
2844
|
try {
|
|
2792
|
-
for (
|
|
2793
|
-
|
|
2845
|
+
for (S.s(); !(w = S.n()).done; ) {
|
|
2846
|
+
var O = w.value;
|
|
2847
|
+
if (!(O in i) || !c.has(O)) throw new Error('Invalid range key "'.concat(O, '". Only price-based keys are allowed: ').concat(je(c)));
|
|
2848
|
+
g.push("".concat(b, "_range_").concat(O));
|
|
2794
2849
|
}
|
|
2795
|
-
|
|
2796
|
-
|
|
2850
|
+
// bootstrap instance
|
|
2851
|
+
} catch (t) {
|
|
2852
|
+
S.e(t);
|
|
2797
2853
|
} finally {
|
|
2798
|
-
|
|
2854
|
+
S.f();
|
|
2799
2855
|
}
|
|
2800
|
-
|
|
2801
|
-
i && g.push("".concat(b, "_height")), s.hasOwnProperty("donchian_channel") || (s.donchian_channel = {
|
|
2856
|
+
a.donchian_channel || (a.donchian_channel = {
|
|
2802
2857
|
numberOfIndicators: m,
|
|
2803
2858
|
settings: {}
|
|
2804
|
-
})
|
|
2805
|
-
// Set up additional arrays for each range property.
|
|
2806
|
-
var w, O = ge(a);
|
|
2807
|
-
try {
|
|
2808
|
-
for (O.s(); !(w = O.n()).done; ) {
|
|
2809
|
-
var S = w.value;
|
|
2810
|
-
if (!(S in c) || !p.has(S)) throw new Error('Invalid range item value "'.concat(S, '" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(p)));
|
|
2811
|
-
g.push("".concat(b, "_range_").concat(S));
|
|
2812
|
-
}
|
|
2813
|
-
} catch (t) {
|
|
2814
|
-
O.e(t);
|
|
2815
|
-
} finally {
|
|
2816
|
-
O.f();
|
|
2817
|
-
}
|
|
2818
|
-
var j = Object.fromEntries(g.map((function(t) {
|
|
2819
|
-
return [ t, new Float64Array(f).fill(NaN) ];
|
|
2820
|
-
})));
|
|
2821
|
-
Object.assign(c, function(t) {
|
|
2822
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
2823
|
-
var r = null != arguments[e] ? arguments[e] : {};
|
|
2824
|
-
e % 2 ? de(Object(r), !0).forEach((function(e) {
|
|
2825
|
-
be(t, e, r[e]);
|
|
2826
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach((function(e) {
|
|
2827
|
-
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2828
|
-
}));
|
|
2829
|
-
}
|
|
2830
|
-
return t;
|
|
2831
|
-
}({}, j)), u > 0 && t.lag(g, u), [ "".concat(b, "_upper"), "".concat(b, "_basis"), "".concat(b, "_lower") ].forEach((function(t) {
|
|
2832
|
-
p.add(t);
|
|
2833
|
-
})), s.donchian_channel.settings[l] = {
|
|
2859
|
+
}), a.donchian_channel.numberOfIndicators = m, a.donchian_channel.settings[v] = {
|
|
2834
2860
|
maxDeque: [],
|
|
2835
|
-
// will hold indices for highs in descending order
|
|
2836
2861
|
minDeque: []
|
|
2837
|
-
}
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2862
|
+
},
|
|
2863
|
+
// allocate & fill NaNs
|
|
2864
|
+
Object.assign(i, Object.fromEntries(g.map((function(t) {
|
|
2865
|
+
return [ t, new Float64Array(u).fill(NaN) ];
|
|
2866
|
+
})))),
|
|
2867
|
+
// apply lag if requested
|
|
2868
|
+
f > 0 && t.lag(g, f),
|
|
2869
|
+
// mark price-based outputs
|
|
2870
|
+
[ "upper", "basis", "lower" ].forEach((function(t) {
|
|
2871
|
+
return c.add("".concat(b, "_").concat(t));
|
|
2872
|
+
})), g.forEach((function(t) {
|
|
2873
|
+
return s[t] = "Float64Array";
|
|
2874
|
+
}));
|
|
2841
2875
|
}
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
value: NaN
|
|
2854
|
-
}), t.pushToMain({
|
|
2855
|
-
index: e,
|
|
2856
|
-
key: "".concat(N, "_lower"),
|
|
2857
|
-
value: NaN
|
|
2858
|
-
}), i && t.pushToMain({
|
|
2876
|
+
// ---- PER-BAR COMPUTATION ----
|
|
2877
|
+
var j = a.donchian_channel, P = j.numberOfIndicators, _ = j.settings, N = P > 1 ? "donchian_channel_".concat(v) : "donchian_channel", A = _[v], T = A.maxDeque, E = A.minDeque, k = e - n, x = k - r + 1, I = [ "upper", "basis", "lower" ].map((function(t) {
|
|
2878
|
+
return "".concat(N, "_").concat(t);
|
|
2879
|
+
}));
|
|
2880
|
+
y && I.push("".concat(N, "_height"));
|
|
2881
|
+
var D = h.map((function(t) {
|
|
2882
|
+
return "".concat(N, "_range_").concat(t);
|
|
2883
|
+
}));
|
|
2884
|
+
// not enough data → push NaNs
|
|
2885
|
+
if (x < 0 || k + 1 > u) return [].concat(je(I), je(D)).forEach((function(r) {
|
|
2886
|
+
return t.pushToMain({
|
|
2859
2887
|
index: e,
|
|
2860
|
-
key:
|
|
2888
|
+
key: r,
|
|
2861
2889
|
value: NaN
|
|
2862
2890
|
});
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
return !0;
|
|
2879
|
-
}
|
|
2880
|
-
// **Update the maximum deque:**
|
|
2881
|
-
for (var C = c.high, F = c.low; A.length && A[0] < I; ) A.shift();
|
|
2882
|
-
for (;A.length && C[A[A.length - 1]] <= C[x]; ) A.pop();
|
|
2883
|
-
// **Update the minimum deque:**
|
|
2884
|
-
for (A.push(x); E.length && E[0] < I; ) E.shift();
|
|
2885
|
-
for (;E.length && F[E[E.length - 1]] >= F[x]; ) E.pop();
|
|
2886
|
-
E.push(x);
|
|
2887
|
-
// Retrieve computed values with safety checks.
|
|
2888
|
-
var L = A.length ? C[A[0]] : NaN, B = E.length ? F[E[0]] : NaN, H = Number.isNaN(L) || Number.isNaN(B) ? NaN : (L + B) / 2;
|
|
2889
|
-
// Process height if enabled.
|
|
2890
|
-
if (
|
|
2891
|
-
// Always push the main indicator values.
|
|
2892
|
-
t.pushToMain({
|
|
2891
|
+
})), !0;
|
|
2892
|
+
var M = i.high, R = i.low, C = function(t, e, r) {
|
|
2893
|
+
for (;t.length && t[0] < x; ) t.shift();
|
|
2894
|
+
for (;t.length && r(e[t.at(-1)], e[k]); ) t.pop();
|
|
2895
|
+
t.push(k);
|
|
2896
|
+
};
|
|
2897
|
+
// tiny helper to keep deques up-to-date
|
|
2898
|
+
C(T, M, (function(t, e) {
|
|
2899
|
+
return t <= e;
|
|
2900
|
+
})), C(E, R, (function(t, e) {
|
|
2901
|
+
return t >= e;
|
|
2902
|
+
}));
|
|
2903
|
+
// single “bounds exist?” flag instead of repeated isNaN
|
|
2904
|
+
var F = T.length && E.length, L = F ? M[T[0]] : NaN, B = F ? R[E[0]] : NaN, H = F ? (L + B) / 2 : NaN;
|
|
2905
|
+
if (t.pushToMain({
|
|
2893
2906
|
index: e,
|
|
2894
2907
|
key: "".concat(N, "_upper"),
|
|
2895
2908
|
value: L
|
|
@@ -2901,158 +2914,150 @@ var OHLCV_INDICATORS;
|
|
|
2901
2914
|
index: e,
|
|
2902
2915
|
key: "".concat(N, "_lower"),
|
|
2903
2916
|
value: B
|
|
2904
|
-
}),
|
|
2905
|
-
|
|
2906
|
-
|
|
2917
|
+
}), y) {
|
|
2918
|
+
// avoid divide-by-zero
|
|
2919
|
+
var V = F && B ? (L - B) / B : NaN;
|
|
2920
|
+
t.pushToMain({
|
|
2907
2921
|
index: e,
|
|
2908
2922
|
key: "".concat(N, "_height"),
|
|
2909
|
-
value: V
|
|
2923
|
+
value: null === p ? V : Oe(V, p)
|
|
2910
2924
|
});
|
|
2911
2925
|
}
|
|
2912
|
-
//
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
value: z
|
|
2922
|
-
});
|
|
2923
|
-
}
|
|
2924
|
-
} catch (t) {
|
|
2925
|
-
$.e(t);
|
|
2926
|
-
} finally {
|
|
2927
|
-
$.f();
|
|
2926
|
+
// precompute spread once
|
|
2927
|
+
// for each extra range key, use price===price to skip NaNs
|
|
2928
|
+
for (var U = F ? L - B : NaN, $ = 0; $ < h.length; $++) {
|
|
2929
|
+
var q = i[h[$]][e], z = F && q == q && U ? (q - B) / U : NaN;
|
|
2930
|
+
t.pushToMain({
|
|
2931
|
+
index: e,
|
|
2932
|
+
key: D[$],
|
|
2933
|
+
value: null === p ? z : Oe(z, p)
|
|
2934
|
+
});
|
|
2928
2935
|
}
|
|
2929
2936
|
return !0;
|
|
2930
2937
|
},
|
|
2931
2938
|
bollingerBands: function(t, e, r, n, o) {
|
|
2932
|
-
var i, a, u, l, c, s, f, y = o.height, h = o.range, p = void 0 === h ? [] : h, v = o.target, m = o.lag, d = t.verticalOhlcv,
|
|
2939
|
+
var i, a, u, l, c, s, f, y = o.height, h = o.range, p = void 0 === h ? [] : h, v = o.target, m = o.lag, d = o.decimals, b = t.verticalOhlcv, g = t.instances, w = "close" === v ? "" : "_".concat(v), S = "".concat(r, "_").concat(n).concat(w);
|
|
2933
2940
|
// Initialization on the first call.
|
|
2934
2941
|
if (0 === e) {
|
|
2935
|
-
var O = t.priceBased,
|
|
2936
|
-
if (!(v in
|
|
2937
|
-
var
|
|
2942
|
+
var O = t.priceBased, j = t.inputParams, P = t.verticalOhlcv, _ = t.len, N = t.arrayTypes;
|
|
2943
|
+
if (!(v in P)) throw new Error('bollingerBands could not find target "'.concat(v, '"'));
|
|
2944
|
+
var A, T = 0, E = Ee(j);
|
|
2938
2945
|
try {
|
|
2939
|
-
for (
|
|
2940
|
-
"bollingerBands" ===
|
|
2946
|
+
for (E.s(); !(A = E.n()).done; ) {
|
|
2947
|
+
"bollingerBands" === A.value.key && T++;
|
|
2941
2948
|
}
|
|
2942
2949
|
} catch (t) {
|
|
2943
|
-
|
|
2950
|
+
E.e(t);
|
|
2944
2951
|
} finally {
|
|
2945
|
-
|
|
2952
|
+
E.f();
|
|
2946
2953
|
}
|
|
2947
|
-
f = T > 1 ? "bollinger_bands_".concat(
|
|
2954
|
+
f = T > 1 ? "bollinger_bands_".concat(S) : "bollinger_bands".concat(w),
|
|
2948
2955
|
// Only create the container if it doesn't already exist.
|
|
2949
|
-
|
|
2956
|
+
g.bollinger_bands || (g.bollinger_bands = {
|
|
2950
2957
|
numberOfIndicators: T,
|
|
2951
2958
|
settings: {}
|
|
2952
2959
|
}),
|
|
2953
2960
|
// Add (or override) the indicator instance keyed by indicatorKey.
|
|
2954
|
-
|
|
2955
|
-
var
|
|
2956
|
-
y &&
|
|
2961
|
+
g.bollinger_bands.settings[S] = new xt(r, n);
|
|
2962
|
+
var k = [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ];
|
|
2963
|
+
y && k.push("".concat(f, "_height"));
|
|
2957
2964
|
// Set up additional arrays for each range property.
|
|
2958
|
-
var x,
|
|
2965
|
+
var x, I = Ee(p);
|
|
2959
2966
|
try {
|
|
2960
|
-
for (
|
|
2961
|
-
var
|
|
2962
|
-
if (!(
|
|
2963
|
-
|
|
2967
|
+
for (I.s(); !(x = I.n()).done; ) {
|
|
2968
|
+
var D = x.value;
|
|
2969
|
+
if (!(D in P) || !O.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(O)));
|
|
2970
|
+
k.push("".concat(f, "_range_").concat(D));
|
|
2964
2971
|
}
|
|
2965
2972
|
} catch (t) {
|
|
2966
|
-
|
|
2973
|
+
I.e(t);
|
|
2967
2974
|
} finally {
|
|
2968
|
-
|
|
2975
|
+
I.f();
|
|
2969
2976
|
}
|
|
2970
|
-
var M = Object.fromEntries(
|
|
2971
|
-
return [ t, new Float64Array(
|
|
2977
|
+
var M = Object.fromEntries(k.map((function(t) {
|
|
2978
|
+
return [ t, new Float64Array(_).fill(NaN) ];
|
|
2972
2979
|
})));
|
|
2973
|
-
Object.assign(
|
|
2980
|
+
Object.assign(P, function(t) {
|
|
2974
2981
|
for (var e = 1; e < arguments.length; e++) {
|
|
2975
2982
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2976
|
-
e % 2 ?
|
|
2977
|
-
|
|
2978
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2983
|
+
e % 2 ? Ae(Object(r), !0).forEach((function(e) {
|
|
2984
|
+
Te(t, e, r[e]);
|
|
2985
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ae(Object(r)).forEach((function(e) {
|
|
2979
2986
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2980
2987
|
}));
|
|
2981
2988
|
}
|
|
2982
2989
|
return t;
|
|
2983
|
-
}({}, M)), m > 0 && t.lag(
|
|
2990
|
+
}({}, M)), m > 0 && t.lag(k, m), [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ].forEach((function(t) {
|
|
2984
2991
|
O.add(t);
|
|
2985
2992
|
}));
|
|
2986
|
-
for (var
|
|
2987
|
-
|
|
2993
|
+
for (var R = 0, C = k; R < C.length; R++) {
|
|
2994
|
+
N[C[R]] = "Float64Array";
|
|
2988
2995
|
}
|
|
2989
2996
|
}
|
|
2990
2997
|
// Derive prefix for subsequent calls if not set.
|
|
2991
|
-
f || (f =
|
|
2992
|
-
var
|
|
2998
|
+
f || (f = g.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(S) : "bollinger_bands".concat(w));
|
|
2999
|
+
var F = f, L = g.bollinger_bands.settings[S], B = b[v][e];
|
|
2993
3000
|
// Update the indicator with the current value.
|
|
2994
|
-
|
|
3001
|
+
L.update(B);
|
|
2995
3002
|
// Attempt to retrieve the result.
|
|
2996
|
-
var
|
|
3003
|
+
var H = {};
|
|
2997
3004
|
try {
|
|
2998
|
-
|
|
3005
|
+
H = L.getResult();
|
|
2999
3006
|
} catch (t) {
|
|
3000
3007
|
// If not available, result stays {}.
|
|
3001
3008
|
}
|
|
3002
3009
|
// Use NaN fallbacks for the primary values.
|
|
3003
|
-
var
|
|
3010
|
+
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;
|
|
3004
3011
|
// Process height if requested.
|
|
3005
3012
|
if (
|
|
3006
3013
|
// Always push the indicator outputs.
|
|
3007
3014
|
t.pushToMain({
|
|
3008
3015
|
index: e,
|
|
3009
|
-
key: "".concat(
|
|
3010
|
-
value: H
|
|
3011
|
-
}), t.pushToMain({
|
|
3012
|
-
index: e,
|
|
3013
|
-
key: "".concat(C, "_middle"),
|
|
3016
|
+
key: "".concat(F, "_upper"),
|
|
3014
3017
|
value: V
|
|
3015
3018
|
}), t.pushToMain({
|
|
3016
3019
|
index: e,
|
|
3017
|
-
key: "".concat(
|
|
3020
|
+
key: "".concat(F, "_middle"),
|
|
3018
3021
|
value: U
|
|
3022
|
+
}), t.pushToMain({
|
|
3023
|
+
index: e,
|
|
3024
|
+
key: "".concat(F, "_lower"),
|
|
3025
|
+
value: $
|
|
3019
3026
|
}), y) {
|
|
3020
|
-
var
|
|
3021
|
-
Number.isNaN(
|
|
3027
|
+
var q = NaN;
|
|
3028
|
+
Number.isNaN($) || Number.isNaN(V) || (q = (V - $) / $), t.pushToMain({
|
|
3022
3029
|
index: e,
|
|
3023
|
-
key: "".concat(
|
|
3024
|
-
value:
|
|
3030
|
+
key: "".concat(F, "_height"),
|
|
3031
|
+
value: null === d ? q : Oe(q, d)
|
|
3025
3032
|
});
|
|
3026
3033
|
}
|
|
3027
3034
|
// Process each range property.
|
|
3028
|
-
var
|
|
3035
|
+
var z, G = Ee(p);
|
|
3029
3036
|
try {
|
|
3030
|
-
for (
|
|
3031
|
-
var
|
|
3032
|
-
Number.isNaN(
|
|
3037
|
+
for (G.s(); !(z = G.n()).done; ) {
|
|
3038
|
+
var K = z.value, Y = NaN, J = b[K][e];
|
|
3039
|
+
Number.isNaN(J) || Number.isNaN($) || Number.isNaN(V) || (Y = (J - $) / (V - $)),
|
|
3033
3040
|
t.pushToMain({
|
|
3034
3041
|
index: e,
|
|
3035
|
-
key: "".concat(
|
|
3036
|
-
value: Y
|
|
3042
|
+
key: "".concat(F, "_range_").concat(K),
|
|
3043
|
+
value: null === d ? Y : Oe(Y, d)
|
|
3037
3044
|
});
|
|
3038
3045
|
}
|
|
3039
3046
|
} catch (t) {
|
|
3040
|
-
|
|
3047
|
+
G.e(t);
|
|
3041
3048
|
} finally {
|
|
3042
|
-
|
|
3049
|
+
G.f();
|
|
3043
3050
|
}
|
|
3044
3051
|
return !0;
|
|
3045
3052
|
},
|
|
3046
3053
|
volumeOscillator: function(t, e, r, n, o) {
|
|
3047
|
-
var i = o.lag, a = t.verticalOhlcv, u = t.instances, l = a.volume[e], c = "
|
|
3054
|
+
var i = o.lag, a = t.verticalOhlcv, u = t.instances, l = a.volume[e], c = "volume_oscillator_".concat(r, "_").concat(n);
|
|
3048
3055
|
if (0 === e) {
|
|
3049
3056
|
var s = t.crossPairsList, f = t.len, y = t.arrayTypes;
|
|
3050
|
-
Object.assign(u, {
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
}
|
|
3055
|
-
}), a[c] = new Float64Array(f).fill(NaN), s.push({
|
|
3057
|
+
Object.assign(u, Ie({}, c, {
|
|
3058
|
+
fastEMA: new $t(r),
|
|
3059
|
+
slowEMA: new $t(n)
|
|
3060
|
+
})), a[c] = new Float64Array(f).fill(NaN), s.push({
|
|
3056
3061
|
fast: c,
|
|
3057
3062
|
slow: 0,
|
|
3058
3063
|
isDefault: !0
|
|
@@ -3074,166 +3079,90 @@ var OHLCV_INDICATORS;
|
|
|
3074
3079
|
value: b
|
|
3075
3080
|
}), !0;
|
|
3076
3081
|
},
|
|
3077
|
-
scaler: function(t, e, r, n, o
|
|
3078
|
-
|
|
3079
|
-
u) {
|
|
3080
|
-
var l = t.verticalOhlcv, c = t.instances, s = t.arrayTypes, f = "".concat(o, "_").concat(r), y = "";
|
|
3082
|
+
scaler: function(t, e, r, n, o) {
|
|
3083
|
+
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, h = t.verticalOhlcv, p = t.instances, v = t.arrayTypes, m = "".concat(i, "_").concat(r);
|
|
3081
3084
|
if (0 === e) {
|
|
3082
|
-
var
|
|
3083
|
-
|
|
3084
|
-
y = "".concat(f, "_group_").concat(n.join("_")), c.scaler = {
|
|
3085
|
-
groupKeyLen: n.length,
|
|
3086
|
-
groupKey: y,
|
|
3085
|
+
var d = t.len;
|
|
3086
|
+
p.hasOwnProperty("scaler") || (p.scaler = {
|
|
3087
3087
|
windows: {}
|
|
3088
|
-
};
|
|
3089
|
-
var
|
|
3088
|
+
});
|
|
3089
|
+
var b, g = ar(n);
|
|
3090
3090
|
try {
|
|
3091
|
-
var
|
|
3092
|
-
var e =
|
|
3093
|
-
if (!
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
length: u
|
|
3091
|
+
var w = function() {
|
|
3092
|
+
var e = b.value;
|
|
3093
|
+
if (!h.hasOwnProperty(e)) throw new Error('Target property "'.concat(e, '" not found in verticalOhlcv'));
|
|
3094
|
+
var r = "".concat(m, "_").concat(e);
|
|
3095
|
+
h[r] = new Float64Array(d).fill(NaN), v[r] = "Float64Array";
|
|
3096
|
+
var n = a ? f : e;
|
|
3097
|
+
if (p.scaler.windows[n] = [], a && (t.scaledGroups[f] || (t.scaledGroups[f] = []),
|
|
3098
|
+
t.scaledGroups[f].push(r)), l > 0) {
|
|
3099
|
+
if (a) {
|
|
3100
|
+
var o, i = Array.from({
|
|
3101
|
+
length: l
|
|
3103
3102
|
}).map((function(t, e) {
|
|
3104
3103
|
return "".concat(r, "_lag_").concat(e + 1);
|
|
3105
3104
|
}));
|
|
3106
|
-
(o = t.scaledGroups[
|
|
3105
|
+
(o = t.scaledGroups[f]).push.apply(o, ir(i));
|
|
3107
3106
|
}
|
|
3108
|
-
t.lag([ r ],
|
|
3107
|
+
t.lag([ r ], l);
|
|
3109
3108
|
}
|
|
3110
3109
|
};
|
|
3111
|
-
for (
|
|
3110
|
+
for (g.s(); !(b = g.n()).done; ) w();
|
|
3112
3111
|
} catch (t) {
|
|
3113
|
-
|
|
3112
|
+
g.e(t);
|
|
3114
3113
|
} finally {
|
|
3115
|
-
|
|
3114
|
+
g.f();
|
|
3116
3115
|
}
|
|
3117
3116
|
}
|
|
3118
|
-
var
|
|
3119
|
-
y = c.scaler.groupKey;
|
|
3117
|
+
var S, O = p.scaler.windows, j = ar(n);
|
|
3120
3118
|
// update windows with current values
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
j.push(S), j.length > (i ? r * c.scaler.groupKeyLen : r) && j.shift();
|
|
3119
|
+
try {
|
|
3120
|
+
for (j.s(); !(S = j.n()).done; ) {
|
|
3121
|
+
var P = S.value, _ = h[P][e], N = O[a ? f : P];
|
|
3122
|
+
N.push(_), N.length > (a ? r * y : r) && N.shift();
|
|
3126
3123
|
}
|
|
3127
3124
|
} catch (t) {
|
|
3128
|
-
|
|
3125
|
+
j.e(t);
|
|
3129
3126
|
} finally {
|
|
3130
|
-
|
|
3127
|
+
j.f();
|
|
3131
3128
|
}
|
|
3132
|
-
var
|
|
3129
|
+
var A, T = e + 1 >= r, E = ar(n);
|
|
3133
3130
|
// scale values once enough data
|
|
3134
3131
|
try {
|
|
3135
|
-
var
|
|
3136
|
-
var r, n,
|
|
3137
|
-
if (
|
|
3138
|
-
var g =
|
|
3139
|
-
if ("minmax" ===
|
|
3140
|
-
var w = Math.min.apply(Math,
|
|
3141
|
-
r = v, n = w,
|
|
3132
|
+
var k = function() {
|
|
3133
|
+
var r, n, o, l, c, y, p = A.value, v = h[p][e], d = "".concat(m, "_").concat(p), b = null;
|
|
3134
|
+
if (T) {
|
|
3135
|
+
var g = O[a ? f : p];
|
|
3136
|
+
if ("minmax" === i) {
|
|
3137
|
+
var w = Math.min.apply(Math, ir(g)), S = Math.max.apply(Math, ir(g));
|
|
3138
|
+
r = v, n = w, o = S, l = ur(u, 2), c = l[0], y = l[1], b = (Math.min(Math.max(r, n), o) - n) / (o - n) * (y - c) + c;
|
|
3142
3139
|
} else {
|
|
3143
|
-
if ("zscore" !==
|
|
3144
|
-
var
|
|
3140
|
+
if ("zscore" !== i) throw new Error('Unknown scaler type "'.concat(i, '"'));
|
|
3141
|
+
var j = g.reduce((function(t, e) {
|
|
3145
3142
|
return t + e;
|
|
3146
|
-
}), 0) / g.length,
|
|
3147
|
-
return t + Math.pow(e -
|
|
3148
|
-
}), 0) / g.length,
|
|
3149
|
-
|
|
3143
|
+
}), 0) / g.length, P = g.reduce((function(t, e) {
|
|
3144
|
+
return t + Math.pow(e - j, 2);
|
|
3145
|
+
}), 0) / g.length, _ = Math.sqrt(P);
|
|
3146
|
+
b = function(t, e, r) {
|
|
3150
3147
|
return 0 === r ? 0 : (t - e) / r;
|
|
3151
|
-
}(v,
|
|
3148
|
+
}(v, j, _);
|
|
3152
3149
|
}
|
|
3153
3150
|
}
|
|
3154
3151
|
t.pushToMain({
|
|
3155
3152
|
index: e,
|
|
3156
|
-
key:
|
|
3157
|
-
value:
|
|
3153
|
+
key: d,
|
|
3154
|
+
value: null === s ? b : Oe(b, s)
|
|
3158
3155
|
});
|
|
3159
3156
|
};
|
|
3160
|
-
for (
|
|
3161
|
-
} catch (t) {
|
|
3162
|
-
N.e(t);
|
|
3163
|
-
} finally {
|
|
3164
|
-
N.f();
|
|
3165
|
-
}
|
|
3166
|
-
}
|
|
3167
|
-
}, fr = function(t, e) {
|
|
3168
|
-
var r = e.len, n = e.inputParams, i = e.priceBased, a = e.precisionMultiplier, u = e.arrayTypes, l = e.verticalOhlcv, c = e.verticalOhlcvKeyNames, s = e.inputTypes;
|
|
3169
|
-
!function(t, e) {
|
|
3170
|
-
if (!Array.isArray(t)) throw new Error('Property "inputParams" must be an "Array" or "Set".');
|
|
3171
|
-
var r, n = o(t);
|
|
3172
|
-
try {
|
|
3173
|
-
for (n.s(); !(r = n.n()).done; ) {
|
|
3174
|
-
var i, a = o(r.value.params);
|
|
3175
|
-
try {
|
|
3176
|
-
for (a.s(); !(i = a.n()).done; ) {
|
|
3177
|
-
var u = i.value;
|
|
3178
|
-
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.");
|
|
3179
|
-
}
|
|
3180
|
-
} catch (t) {
|
|
3181
|
-
a.e(t);
|
|
3182
|
-
} finally {
|
|
3183
|
-
a.f();
|
|
3184
|
-
}
|
|
3185
|
-
}
|
|
3157
|
+
for (E.s(); !(A = E.n()).done; ) k();
|
|
3186
3158
|
} catch (t) {
|
|
3187
|
-
|
|
3159
|
+
E.e(t);
|
|
3188
3160
|
} finally {
|
|
3189
|
-
|
|
3161
|
+
E.f();
|
|
3190
3162
|
}
|
|
3191
|
-
}(n, r);
|
|
3192
|
-
for (var f = 0, y = Object.keys(s); f < y.length; f++) {
|
|
3193
|
-
var h = y[f];
|
|
3194
|
-
l[h] = Re(u[h], r);
|
|
3195
3163
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
for (var v = t[p], m = 0, d = Object.entries(s); m < d.length; m++) {
|
|
3199
|
-
var b = ur(d[m], 2), g = b[0], w = b[1], O = v[g];
|
|
3200
|
-
if (Te.hasOwnProperty(w)) {
|
|
3201
|
-
var S = Te[w](O);
|
|
3202
|
-
a > 1 && i.has(g) && (S *= a), e.pushToMain({
|
|
3203
|
-
index: p,
|
|
3204
|
-
key: g,
|
|
3205
|
-
value: S
|
|
3206
|
-
});
|
|
3207
|
-
} else xe.hasOwnProperty(w) ? e.pushToMain({
|
|
3208
|
-
index: p,
|
|
3209
|
-
key: g,
|
|
3210
|
-
value: xe[w](O)
|
|
3211
|
-
}) : e.pushToMain({
|
|
3212
|
-
index: p,
|
|
3213
|
-
key: g,
|
|
3214
|
-
value: O
|
|
3215
|
-
});
|
|
3216
|
-
}
|
|
3217
|
-
// Run all indicator functions except for the ones processed later
|
|
3218
|
-
var j, P = ar(n);
|
|
3219
|
-
try {
|
|
3220
|
-
for (P.s(); !(j = P.n()).done; ) {
|
|
3221
|
-
var _ = j.value, N = _.key, T = _.params;
|
|
3222
|
-
"lag" !== N && "crossPairs" !== N &&
|
|
3223
|
-
// resolve fn on-demand, no per-item object allocation here
|
|
3224
|
-
sr[N].apply(sr, [ e, p ].concat(ir(T)));
|
|
3225
|
-
}
|
|
3226
|
-
// Process these indicators separately (ensuring their execution order)
|
|
3227
|
-
} catch (t) {
|
|
3228
|
-
P.e(t);
|
|
3229
|
-
} finally {
|
|
3230
|
-
P.f();
|
|
3231
|
-
}
|
|
3232
|
-
He(e, p), Je(e, p);
|
|
3233
|
-
}
|
|
3234
|
-
c.push.apply(c, ir(Object.keys(l)));
|
|
3235
|
-
}, yr = function(t, e) {
|
|
3236
|
-
for (var r = t.length, n = new ct(e), o = new Array(r), i = 0, a = 0, u = 0, l = 0; l < r; l++) if (n.update(t[l]),
|
|
3164
|
+
}, mr = function(t, e) {
|
|
3165
|
+
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]),
|
|
3237
3166
|
n.isStable) {
|
|
3238
3167
|
var c = n.getResult();
|
|
3239
3168
|
o[l] = c, i += c, a += c * c, u++;
|
|
@@ -3242,10 +3171,10 @@ var OHLCV_INDICATORS;
|
|
|
3242
3171
|
return o.map((function(t) {
|
|
3243
3172
|
return null !== t ? (t - s) / y : null;
|
|
3244
3173
|
}));
|
|
3245
|
-
},
|
|
3174
|
+
}, dr = function(t, e) {
|
|
3246
3175
|
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5;
|
|
3247
3176
|
if (t.length !== e.length) throw new Error("Both arrays must have the same length");
|
|
3248
|
-
for (var n =
|
|
3177
|
+
for (var n = mr(t, r), o = mr(e, r), i = t.length, a = [], u = 0, l = 0, c = 0, s = 0, f = 0, y = 0, h = -1, p = 0; p < i; p++) {
|
|
3249
3178
|
if (null !== n[p] && null !== o[p]) {
|
|
3250
3179
|
h = p;
|
|
3251
3180
|
break;
|
|
@@ -3268,7 +3197,7 @@ var OHLCV_INDICATORS;
|
|
|
3268
3197
|
return a;
|
|
3269
3198
|
};
|
|
3270
3199
|
// ./src/utilities/verticalToHorizontal.js
|
|
3271
|
-
function
|
|
3200
|
+
function br(t, e) {
|
|
3272
3201
|
return function(t) {
|
|
3273
3202
|
if (Array.isArray(t)) return t;
|
|
3274
3203
|
}(t) || function(t, e) {
|
|
@@ -3293,33 +3222,33 @@ var OHLCV_INDICATORS;
|
|
|
3293
3222
|
}
|
|
3294
3223
|
}(t, e) || function(t, e) {
|
|
3295
3224
|
if (t) {
|
|
3296
|
-
if ("string" == typeof t) return
|
|
3225
|
+
if ("string" == typeof t) return gr(t, e);
|
|
3297
3226
|
var r = {}.toString.call(t).slice(8, -1);
|
|
3298
|
-
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) ?
|
|
3227
|
+
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) ? gr(t, e) : void 0;
|
|
3299
3228
|
}
|
|
3300
3229
|
}(t, e) || function() {
|
|
3301
3230
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3302
3231
|
}();
|
|
3303
3232
|
}
|
|
3304
|
-
function
|
|
3233
|
+
function gr(t, e) {
|
|
3305
3234
|
(null == e || e > t.length) && (e = t.length);
|
|
3306
3235
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3307
3236
|
return n;
|
|
3308
3237
|
}
|
|
3309
|
-
var
|
|
3310
|
-
var t =
|
|
3311
|
-
if (0 ===
|
|
3312
|
-
for (var
|
|
3313
|
-
length:
|
|
3238
|
+
var wr = function(t) {
|
|
3239
|
+
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, h = e.verticalOhlcvKeyNames, p = e.verticalOhlcvTempCols;
|
|
3240
|
+
if (0 === h.length) return [];
|
|
3241
|
+
for (var v = n && f >= 0 ? f + 1 : 0, m = Math.max(v, i), d = y - m, b = Array.from({
|
|
3242
|
+
length: d
|
|
3314
3243
|
}, (function() {
|
|
3315
3244
|
return {};
|
|
3316
|
-
})),
|
|
3317
|
-
var
|
|
3318
|
-
if (!
|
|
3245
|
+
})), g = 0, w = Object.entries(s); g < w.length; g++) {
|
|
3246
|
+
var S = br(w[g], 2), O = S[0], j = S[1];
|
|
3247
|
+
if (!p.has(O)) for (var P = l.has(O) && c, _ = m; _ < y; _++) b[_ - m][O] = P ? j[_] / u : "date" === O ? Me[a](j[_]) : j[_];
|
|
3319
3248
|
}
|
|
3320
|
-
return
|
|
3249
|
+
return b;
|
|
3321
3250
|
};
|
|
3322
|
-
function
|
|
3251
|
+
function Sr(t, e) {
|
|
3323
3252
|
return function(t) {
|
|
3324
3253
|
if (Array.isArray(t)) return t;
|
|
3325
3254
|
}(t) || function(t, e) {
|
|
@@ -3342,30 +3271,30 @@ var OHLCV_INDICATORS;
|
|
|
3342
3271
|
}
|
|
3343
3272
|
return u;
|
|
3344
3273
|
}
|
|
3345
|
-
}(t, e) ||
|
|
3274
|
+
}(t, e) || Or(t, e) || function() {
|
|
3346
3275
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3347
3276
|
}();
|
|
3348
3277
|
}
|
|
3349
|
-
function
|
|
3278
|
+
function Or(t, e) {
|
|
3350
3279
|
if (t) {
|
|
3351
|
-
if ("string" == typeof t) return
|
|
3280
|
+
if ("string" == typeof t) return jr(t, e);
|
|
3352
3281
|
var r = {}.toString.call(t).slice(8, -1);
|
|
3353
|
-
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) ?
|
|
3282
|
+
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) ? jr(t, e) : void 0;
|
|
3354
3283
|
}
|
|
3355
3284
|
}
|
|
3356
|
-
function
|
|
3285
|
+
function jr(t, e) {
|
|
3357
3286
|
(null == e || e > t.length) && (e = t.length);
|
|
3358
3287
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3359
3288
|
return n;
|
|
3360
3289
|
}
|
|
3361
|
-
var
|
|
3290
|
+
var Pr = function(t, e) {
|
|
3362
3291
|
var r = t.precision, n = t.priceBased;
|
|
3363
3292
|
if (!1 === r) return 1;
|
|
3364
3293
|
var o, i = 1, a = // ./src/utilities/precisionMultiplier.js
|
|
3365
3294
|
function(t, e) {
|
|
3366
3295
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3367
3296
|
if (!r) {
|
|
3368
|
-
if (Array.isArray(t) || (r =
|
|
3297
|
+
if (Array.isArray(t) || (r = Or(t)) || e && t && "number" == typeof t.length) {
|
|
3369
3298
|
r && (t = r);
|
|
3370
3299
|
var n = 0, o = function() {};
|
|
3371
3300
|
return {
|
|
@@ -3407,17 +3336,17 @@ var OHLCV_INDICATORS;
|
|
|
3407
3336
|
}
|
|
3408
3337
|
};
|
|
3409
3338
|
}(Object.entries(e).filter((function(t) {
|
|
3410
|
-
var e =
|
|
3339
|
+
var e = Sr(t, 2), r = e[0];
|
|
3411
3340
|
e[1];
|
|
3412
3341
|
return n.has(r);
|
|
3413
3342
|
})).map((function(t) {
|
|
3414
|
-
var e =
|
|
3343
|
+
var e = Sr(t, 2);
|
|
3415
3344
|
e[0];
|
|
3416
3345
|
return e[1];
|
|
3417
3346
|
})));
|
|
3418
3347
|
try {
|
|
3419
3348
|
for (a.s(); !(o = a.n()).done; ) {
|
|
3420
|
-
var u = o.value, l =
|
|
3349
|
+
var u = o.value, l = Sr(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;
|
|
3421
3350
|
f > i && (i = f);
|
|
3422
3351
|
}
|
|
3423
3352
|
} catch (t) {
|
|
@@ -3428,23 +3357,23 @@ var OHLCV_INDICATORS;
|
|
|
3428
3357
|
return i;
|
|
3429
3358
|
};
|
|
3430
3359
|
// ./index.js
|
|
3431
|
-
function
|
|
3432
|
-
return
|
|
3360
|
+
function _r(t) {
|
|
3361
|
+
return _r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
3433
3362
|
return typeof t;
|
|
3434
3363
|
} : function(t) {
|
|
3435
3364
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
3436
|
-
},
|
|
3365
|
+
}, _r(t);
|
|
3437
3366
|
}
|
|
3438
|
-
function
|
|
3367
|
+
function Nr(t) {
|
|
3439
3368
|
return function(t) {
|
|
3440
|
-
if (Array.isArray(t)) return
|
|
3369
|
+
if (Array.isArray(t)) return Er(t);
|
|
3441
3370
|
}(t) || function(t) {
|
|
3442
3371
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
3443
|
-
}(t) ||
|
|
3372
|
+
}(t) || Tr(t) || function() {
|
|
3444
3373
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3445
3374
|
}();
|
|
3446
3375
|
}
|
|
3447
|
-
function
|
|
3376
|
+
function Ar(t, e) {
|
|
3448
3377
|
return function(t) {
|
|
3449
3378
|
if (Array.isArray(t)) return t;
|
|
3450
3379
|
}(t) || function(t, e) {
|
|
@@ -3467,40 +3396,41 @@ var OHLCV_INDICATORS;
|
|
|
3467
3396
|
}
|
|
3468
3397
|
return u;
|
|
3469
3398
|
}
|
|
3470
|
-
}(t, e) ||
|
|
3399
|
+
}(t, e) || Tr(t, e) || function() {
|
|
3471
3400
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3472
3401
|
}();
|
|
3473
3402
|
}
|
|
3474
|
-
function
|
|
3403
|
+
function Tr(t, e) {
|
|
3475
3404
|
if (t) {
|
|
3476
|
-
if ("string" == typeof t) return
|
|
3405
|
+
if ("string" == typeof t) return Er(t, e);
|
|
3477
3406
|
var r = {}.toString.call(t).slice(8, -1);
|
|
3478
|
-
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) ?
|
|
3407
|
+
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) ? Er(t, e) : void 0;
|
|
3479
3408
|
}
|
|
3480
3409
|
}
|
|
3481
|
-
function
|
|
3410
|
+
function Er(t, e) {
|
|
3482
3411
|
(null == e || e > t.length) && (e = t.length);
|
|
3483
3412
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3484
3413
|
return n;
|
|
3485
3414
|
}
|
|
3486
|
-
function
|
|
3415
|
+
function kr(t, e) {
|
|
3487
3416
|
for (var r = 0; r < e.length; r++) {
|
|
3488
3417
|
var n = e[r];
|
|
3489
3418
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
3490
|
-
Object.defineProperty(t,
|
|
3419
|
+
Object.defineProperty(t, xr(n.key), n);
|
|
3491
3420
|
}
|
|
3492
3421
|
}
|
|
3493
|
-
function
|
|
3422
|
+
function xr(t) {
|
|
3494
3423
|
var e = function(t, e) {
|
|
3495
|
-
if ("object" !=
|
|
3424
|
+
if ("object" != _r(t) || !t) return t;
|
|
3496
3425
|
var r = t[Symbol.toPrimitive];
|
|
3497
3426
|
if (void 0 !== r) {
|
|
3498
3427
|
var n = r.call(t, e || "default");
|
|
3499
|
-
if ("object" !=
|
|
3428
|
+
if ("object" != _r(n)) return n;
|
|
3500
3429
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3501
3430
|
}
|
|
3502
3431
|
return ("string" === e ? String : Number)(t);
|
|
3503
3432
|
}
|
|
3433
|
+
//precomputed
|
|
3504
3434
|
/**
|
|
3505
3435
|
* Class OHLCV_INDICATORS
|
|
3506
3436
|
*
|
|
@@ -3509,22 +3439,26 @@ var OHLCV_INDICATORS;
|
|
|
3509
3439
|
* to parallel compute various technical indicators in 1 single loop.
|
|
3510
3440
|
* OHLCV datasets.
|
|
3511
3441
|
*/ (t, "string");
|
|
3512
|
-
return "symbol" ==
|
|
3442
|
+
return "symbol" == _r(e) ? e : e + "";
|
|
3513
3443
|
}
|
|
3514
|
-
var
|
|
3444
|
+
var Ir = function() {
|
|
3515
3445
|
return t = function t(e) {
|
|
3516
|
-
var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, a = e.precision,
|
|
3446
|
+
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, p = e.chunkProcess, v = void 0 === p ? 2e3 : p;
|
|
3517
3447
|
if (function(t, e) {
|
|
3518
3448
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
3519
|
-
}(this, t),
|
|
3449
|
+
}(this, t), c(n, "input", null !== i ? "contructor ".concat(i) : "constuctor"),
|
|
3520
3450
|
0 === n.length) throw Error("input OHLCV must not be empty: " + i);
|
|
3521
|
-
|
|
3522
|
-
|
|
3451
|
+
y(l, "precision", "constructor"), h(v, {
|
|
3452
|
+
min: 100,
|
|
3453
|
+
max: 5e4,
|
|
3454
|
+
allowDecimals: !1
|
|
3455
|
+
}, "chunkProcess", "constructor"), this.chunkProcess = v, this.firstRow = n[0];
|
|
3456
|
+
var m = function(t) {
|
|
3523
3457
|
for (var e = {}, r = {}, n = 0, o = Object.entries(t); n < o.length; n++) {
|
|
3524
|
-
var i =
|
|
3525
|
-
if ("date" === a) e[a] =
|
|
3526
|
-
r[a] = "Int32Array"; else if (
|
|
3527
|
-
var l =
|
|
3458
|
+
var i = Fe(o[n], 2), a = i[0], u = i[1];
|
|
3459
|
+
if ("date" === a) e[a] = Ce(u), r[a] = "Array"; else if ("volume" === a) e[a] = Se(u, !0),
|
|
3460
|
+
r[a] = "Int32Array"; else if (Be.has(a)) e[a] = Se(u, !0), r[a] = "Float64Array"; else {
|
|
3461
|
+
var l = Se(u, !1);
|
|
3528
3462
|
e[a] = l, r[a] = "number" === l ? "Float64Array" : "Array";
|
|
3529
3463
|
}
|
|
3530
3464
|
}
|
|
@@ -3532,16 +3466,15 @@ var OHLCV_INDICATORS;
|
|
|
3532
3466
|
inputTypes: e,
|
|
3533
3467
|
arrayTypes: r
|
|
3534
3468
|
};
|
|
3535
|
-
}(this.firstRow),
|
|
3536
|
-
if (this.inputTypes =
|
|
3469
|
+
}(this.firstRow), d = m.inputTypes, b = m.arrayTypes;
|
|
3470
|
+
if (this.inputTypes = d, this.arrayTypes = b, !this.firstRow.hasOwnProperty("close")) throw Error('input OHLCV array objects require at least "close" property: '.concat(i));
|
|
3537
3471
|
return this.dateType = this.inputTypes.date ? this.inputTypes.date : null, this.isComputed = !1,
|
|
3538
3472
|
this.input = n, this.priceBased = new Set([ "open", "high", "low", "close" ]), this.len = n.length,
|
|
3539
3473
|
this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {}, this.verticalOhlcvKeyNames = [],
|
|
3540
3474
|
this.verticalOhlcvTempCols = new Set, this.utilities = {
|
|
3541
|
-
correlation:
|
|
3542
|
-
}, this.invalidValueIndex = -1, this.precision =
|
|
3543
|
-
this.scaledGroups = {},
|
|
3544
|
-
this.compute()), this.inputParams = [], this.pushToMain = function(t) {
|
|
3475
|
+
correlation: dr
|
|
3476
|
+
}, this.invalidValueIndex = -1, this.precision = l, this.precisionMultiplier = Pr(this, this.firstRow),
|
|
3477
|
+
this.scaledGroups = {}, this.pushToMain = function(t) {
|
|
3545
3478
|
var e = t.index, n = t.key, o = t.value;
|
|
3546
3479
|
return function(t) {
|
|
3547
3480
|
var e = t.main, r = t.index, n = t.key, o = t.value, i = e.verticalOhlcv;
|
|
@@ -3553,33 +3486,52 @@ var OHLCV_INDICATORS;
|
|
|
3553
3486
|
key: n,
|
|
3554
3487
|
value: o
|
|
3555
3488
|
});
|
|
3556
|
-
}, this
|
|
3489
|
+
}, null !== f && (u(f, this.len), this.inputParams = f, this.compute()), this.inputParams = [],
|
|
3490
|
+
this;
|
|
3557
3491
|
}, e = [ {
|
|
3558
3492
|
key: "getDataAsCols",
|
|
3559
3493
|
value: function() {
|
|
3560
|
-
var t =
|
|
3494
|
+
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
3561
3495
|
this.compute();
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3496
|
+
var e = t.skipNull, r = void 0 === e || e, n = t.dateFormat, o = void 0 === n ? "string" : n;
|
|
3497
|
+
f(Object.keys(Me), o, "dateFormat", "getDataAsCols"), s(t, "options", "getDataAsCols");
|
|
3498
|
+
for (var i = this.precisionMultiplier, a = this.precision, u = this.invalidValueIndex, l = this.len, c = this.verticalOhlcv, y = this.priceBased, h = this.arrayTypes, p = this.verticalOhlcvTempCols, v = {}, m = r ? u + 1 : 0, d = l - m, b = 0, g = Object.entries(c); b < g.length; b++) {
|
|
3499
|
+
var w = Ar(g[b], 2), S = w[0], O = w[1];
|
|
3500
|
+
if (!p.has(S)) {
|
|
3501
|
+
var j = y.has(S) && a;
|
|
3502
|
+
v[S] = He(h[S], d);
|
|
3503
|
+
for (var P = m; P < l; P++) v[S][P] = j ? O[P] / i : "date" === S ? Me[o](O[P]) : O[P];
|
|
3568
3504
|
}
|
|
3569
3505
|
}
|
|
3570
|
-
return
|
|
3506
|
+
return v;
|
|
3571
3507
|
}
|
|
3572
3508
|
}, {
|
|
3573
3509
|
key: "getData",
|
|
3574
3510
|
value: function() {
|
|
3575
|
-
var t =
|
|
3511
|
+
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
3576
3512
|
//getData method returns the last object (row) of the new OHLCV with indicators: {open, high, low, close, rsi_14, bollinger_bands_upper}
|
|
3577
|
-
|
|
3513
|
+
this.compute();
|
|
3514
|
+
var e = t.skipNull, r = void 0 === e || e, n = t.dateFormat, o = void 0 === n ? "string" : n;
|
|
3515
|
+
return f(Object.keys(Me), o, "dateFormat", "getData"), s(t, "options", "getData"),
|
|
3516
|
+
wr({
|
|
3517
|
+
main: this,
|
|
3518
|
+
skipNull: r,
|
|
3519
|
+
startIndex: 0,
|
|
3520
|
+
dateFormat: o
|
|
3521
|
+
});
|
|
3578
3522
|
}
|
|
3579
3523
|
}, {
|
|
3580
3524
|
key: "getLastValues",
|
|
3581
3525
|
value: function() {
|
|
3582
|
-
|
|
3526
|
+
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
3527
|
+
this.compute();
|
|
3528
|
+
var e = t.dateFormat, r = void 0 === e ? "string" : e;
|
|
3529
|
+
return f(Object.keys(Me), r, "dateFormat", "getData"), wr({
|
|
3530
|
+
skipNull: !1,
|
|
3531
|
+
main: this,
|
|
3532
|
+
startIndex: this.len - 1,
|
|
3533
|
+
dateFormat: r
|
|
3534
|
+
})[0];
|
|
3583
3535
|
}
|
|
3584
3536
|
}, {
|
|
3585
3537
|
key: "compute",
|
|
@@ -3591,7 +3543,53 @@ var OHLCV_INDICATORS;
|
|
|
3591
3543
|
// Figure out whether there’s a date field in the inputs
|
|
3592
3544
|
// Only run the full loop once (or when new data appears later,
|
|
3593
3545
|
// if you extend this to reset isComputed elsewhere)
|
|
3594
|
-
this.len > 0 && (
|
|
3546
|
+
this.len > 0 && (function(t, e) {
|
|
3547
|
+
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;
|
|
3548
|
+
u(n, r);
|
|
3549
|
+
for (var y = 0, h = Object.keys(s); y < h.length; y++) {
|
|
3550
|
+
var p = h[y];
|
|
3551
|
+
l[p] = He(a[p], r);
|
|
3552
|
+
}
|
|
3553
|
+
// Process each row in the input
|
|
3554
|
+
for (var v = 0; v < r; v += f) for (var m = Math.min(v + f, r), d = v; d < m; d++) {
|
|
3555
|
+
for (var b = t[d], g = 0, w = Object.entries(s); g < w.length; g++) {
|
|
3556
|
+
var S = yr(w[g], 2), O = S[0], j = S[1], P = b[O];
|
|
3557
|
+
if (we.hasOwnProperty(j)) {
|
|
3558
|
+
var _ = we[j](P);
|
|
3559
|
+
i > 1 && o.has(O) && (_ *= i), e.pushToMain({
|
|
3560
|
+
index: d,
|
|
3561
|
+
key: O,
|
|
3562
|
+
value: _
|
|
3563
|
+
});
|
|
3564
|
+
} else Re.hasOwnProperty(j) ? e.pushToMain({
|
|
3565
|
+
index: d,
|
|
3566
|
+
key: O,
|
|
3567
|
+
value: Re[j](P)
|
|
3568
|
+
}) : e.pushToMain({
|
|
3569
|
+
index: d,
|
|
3570
|
+
key: O,
|
|
3571
|
+
value: P
|
|
3572
|
+
});
|
|
3573
|
+
}
|
|
3574
|
+
// Run all indicator functions except for the ones processed later
|
|
3575
|
+
var N, A = fr(n);
|
|
3576
|
+
try {
|
|
3577
|
+
for (A.s(); !(N = A.n()).done; ) {
|
|
3578
|
+
var T = N.value, E = T.key, k = T.params;
|
|
3579
|
+
"lag" !== E && "crossPairs" !== E &&
|
|
3580
|
+
// resolve fn on-demand, no per-item object allocation here
|
|
3581
|
+
vr[E].apply(vr, [ e, d ].concat(sr(k)));
|
|
3582
|
+
}
|
|
3583
|
+
// Process these indicators separately (ensuring their execution order)
|
|
3584
|
+
} catch (t) {
|
|
3585
|
+
A.e(t);
|
|
3586
|
+
} finally {
|
|
3587
|
+
A.f();
|
|
3588
|
+
}
|
|
3589
|
+
ze(e, d), tr(e, d), t[d] = null;
|
|
3590
|
+
}
|
|
3591
|
+
c.push.apply(c, sr(Object.keys(l)));
|
|
3592
|
+
}(this.input, this), this.isComputed = !0,
|
|
3595
3593
|
//flushing after mainLoop
|
|
3596
3594
|
this.input = [], this.instances = {}, this.firstRow = [])), this;
|
|
3597
3595
|
}
|
|
@@ -3599,7 +3597,7 @@ var OHLCV_INDICATORS;
|
|
|
3599
3597
|
key: "crossPairs",
|
|
3600
3598
|
value: function() {
|
|
3601
3599
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = "crossPairs";
|
|
3602
|
-
return
|
|
3600
|
+
return l(this), c(t, "arr", e), this.crossPairsList = [].concat(Nr(this.crossPairsList), Nr(t)),
|
|
3603
3601
|
this.inputParams.push({
|
|
3604
3602
|
key: e,
|
|
3605
3603
|
params: [ this.crossPairsList ]
|
|
@@ -3609,7 +3607,7 @@ var OHLCV_INDICATORS;
|
|
|
3609
3607
|
key: "lag",
|
|
3610
3608
|
value: function() {
|
|
3611
3609
|
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";
|
|
3612
|
-
|
|
3610
|
+
l(this), c(t, "colKeys", r), h(e, {
|
|
3613
3611
|
min: 1,
|
|
3614
3612
|
max: this.len,
|
|
3615
3613
|
allowDecimals: !1
|
|
@@ -3620,7 +3618,7 @@ var OHLCV_INDICATORS;
|
|
|
3620
3618
|
var n, o = function(t, e) {
|
|
3621
3619
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3622
3620
|
if (!r) {
|
|
3623
|
-
if (Array.isArray(t) || (r =
|
|
3621
|
+
if (Array.isArray(t) || (r = Tr(t)) || e && t && "number" == typeof t.length) {
|
|
3624
3622
|
r && (t = r);
|
|
3625
3623
|
var n = 0, o = function() {};
|
|
3626
3624
|
return {
|
|
@@ -3679,13 +3677,13 @@ var OHLCV_INDICATORS;
|
|
|
3679
3677
|
value: function() {
|
|
3680
3678
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 10, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "relativeVolume";
|
|
3681
3679
|
if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
|
|
3682
|
-
|
|
3680
|
+
l(this), h(t, {
|
|
3683
3681
|
min: 1,
|
|
3684
3682
|
max: this.len,
|
|
3685
3683
|
allowDecimals: !1
|
|
3686
|
-
}, "size", r),
|
|
3684
|
+
}, "size", r), s(e, "options", r);
|
|
3687
3685
|
var n = e.lag, o = void 0 === n ? 0 : n;
|
|
3688
|
-
return
|
|
3686
|
+
return h(o, {
|
|
3689
3687
|
min: 0,
|
|
3690
3688
|
max: this.len,
|
|
3691
3689
|
allowDecimals: !1
|
|
@@ -3700,21 +3698,30 @@ var OHLCV_INDICATORS;
|
|
|
3700
3698
|
key: "ema",
|
|
3701
3699
|
value: function() {
|
|
3702
3700
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "ema";
|
|
3703
|
-
|
|
3701
|
+
l(this), h(t, {
|
|
3704
3702
|
min: 1,
|
|
3705
3703
|
max: this.len,
|
|
3706
3704
|
allowDecimals: !1
|
|
3707
|
-
}, "size", r),
|
|
3705
|
+
}, "size", r), s(e, "options", r);
|
|
3708
3706
|
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
|
|
3709
|
-
|
|
3707
|
+
h(a, {
|
|
3710
3708
|
min: 0,
|
|
3711
3709
|
max: this.len,
|
|
3712
3710
|
allowDecimals: !1
|
|
3713
|
-
}, "options.lag", r)
|
|
3711
|
+
}, "options.lag", r);
|
|
3712
|
+
var u = he({
|
|
3713
|
+
main: this,
|
|
3714
|
+
size: t,
|
|
3715
|
+
target: o,
|
|
3716
|
+
lag: a,
|
|
3717
|
+
methodName: r
|
|
3718
|
+
});
|
|
3719
|
+
return this.inputParams.push({
|
|
3714
3720
|
key: r,
|
|
3715
3721
|
params: [ r, t, {
|
|
3716
3722
|
target: o,
|
|
3717
|
-
lag: a
|
|
3723
|
+
lag: a,
|
|
3724
|
+
precomputed: u
|
|
3718
3725
|
} ]
|
|
3719
3726
|
}), this;
|
|
3720
3727
|
}
|
|
@@ -3722,21 +3729,30 @@ var OHLCV_INDICATORS;
|
|
|
3722
3729
|
key: "sma",
|
|
3723
3730
|
value: function() {
|
|
3724
3731
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "sma";
|
|
3725
|
-
|
|
3732
|
+
l(this), h(t, {
|
|
3726
3733
|
min: 1,
|
|
3727
3734
|
max: this.len,
|
|
3728
3735
|
allowDecimals: !1
|
|
3729
|
-
}, "size", r),
|
|
3736
|
+
}, "size", r), s(e, "options", r);
|
|
3730
3737
|
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
|
|
3731
|
-
|
|
3738
|
+
h(a, {
|
|
3732
3739
|
min: 0,
|
|
3733
3740
|
max: this.len,
|
|
3734
3741
|
allowDecimals: !1
|
|
3735
|
-
}, "options.lag", r)
|
|
3742
|
+
}, "options.lag", r);
|
|
3743
|
+
var u = he({
|
|
3744
|
+
main: this,
|
|
3745
|
+
size: t,
|
|
3746
|
+
target: o,
|
|
3747
|
+
lag: a,
|
|
3748
|
+
methodName: r
|
|
3749
|
+
});
|
|
3750
|
+
return this.inputParams.push({
|
|
3736
3751
|
key: r,
|
|
3737
3752
|
params: [ r, t, {
|
|
3738
3753
|
target: o,
|
|
3739
|
-
lag: a
|
|
3754
|
+
lag: a,
|
|
3755
|
+
precomputed: u
|
|
3740
3756
|
} ]
|
|
3741
3757
|
}), this;
|
|
3742
3758
|
}
|
|
@@ -3744,29 +3760,34 @@ var OHLCV_INDICATORS;
|
|
|
3744
3760
|
key: "macd",
|
|
3745
3761
|
value: function() {
|
|
3746
3762
|
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";
|
|
3747
|
-
|
|
3763
|
+
l(this), h(t, {
|
|
3748
3764
|
min: 1,
|
|
3749
3765
|
max: this.len,
|
|
3750
3766
|
allowDecimals: !1
|
|
3751
|
-
}, "fast", o),
|
|
3767
|
+
}, "fast", o), h(e, {
|
|
3752
3768
|
min: 1,
|
|
3753
3769
|
max: this.len,
|
|
3754
3770
|
allowDecimals: !1
|
|
3755
|
-
}, "slow", o),
|
|
3771
|
+
}, "slow", o), h(r, {
|
|
3756
3772
|
min: 1,
|
|
3757
3773
|
max: this.len,
|
|
3758
3774
|
allowDecimals: !1
|
|
3759
|
-
}, "signal", o),
|
|
3760
|
-
var i = n.target, a = void 0 === i ? "close" : i,
|
|
3761
|
-
|
|
3775
|
+
}, "signal", o), s(n, "options", o);
|
|
3776
|
+
var i = n.target, a = void 0 === i ? "close" : i, u = n.lag, c = void 0 === u ? 0 : u;
|
|
3777
|
+
h(c, {
|
|
3762
3778
|
min: 0,
|
|
3763
3779
|
max: this.len,
|
|
3764
3780
|
allowDecimals: !1
|
|
3765
|
-
}, "options.lag", o)
|
|
3781
|
+
}, "options.lag", o);
|
|
3782
|
+
var f = {
|
|
3783
|
+
instanceKey: "".concat(t, "_").concat(e, "_").concat(r).concat("close" === a ? "" : "_".concat(a))
|
|
3784
|
+
};
|
|
3785
|
+
return this.inputParams.push({
|
|
3766
3786
|
key: o,
|
|
3767
3787
|
params: [ t, e, r, {
|
|
3768
3788
|
target: a,
|
|
3769
|
-
lag:
|
|
3789
|
+
lag: c,
|
|
3790
|
+
precomputed: f
|
|
3770
3791
|
} ]
|
|
3771
3792
|
}), this;
|
|
3772
3793
|
}
|
|
@@ -3774,27 +3795,32 @@ var OHLCV_INDICATORS;
|
|
|
3774
3795
|
key: "bollingerBands",
|
|
3775
3796
|
value: function() {
|
|
3776
3797
|
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";
|
|
3777
|
-
|
|
3798
|
+
l(this), h(t, {
|
|
3778
3799
|
min: 1,
|
|
3779
3800
|
max: this.len,
|
|
3780
3801
|
allowDecimals: !1
|
|
3781
|
-
}, "size", n),
|
|
3802
|
+
}, "size", n), h(e, {
|
|
3782
3803
|
min: .01,
|
|
3783
3804
|
max: 50,
|
|
3784
3805
|
allowDecimals: !0
|
|
3785
|
-
}, "stdDev", n),
|
|
3786
|
-
var o = r.target, i = void 0 === o ? "close" : o, a = r.height,
|
|
3787
|
-
return
|
|
3806
|
+
}, "stdDev", n), s(r, "options", n);
|
|
3807
|
+
var o = r.target, i = void 0 === o ? "close" : o, a = r.height, u = void 0 !== a && a, f = r.range, p = void 0 === f ? [] : f, v = r.lag, m = void 0 === v ? 0 : v, d = r.decimals, b = void 0 === d ? null : d;
|
|
3808
|
+
return c(p, "options.range", n), h(m, {
|
|
3788
3809
|
min: 0,
|
|
3789
3810
|
max: this.len,
|
|
3790
3811
|
allowDecimals: !1
|
|
3791
|
-
}, "options.lag", n),
|
|
3812
|
+
}, "options.lag", n), y(u, "options.height", n), null !== b && h(b, {
|
|
3813
|
+
min: 1,
|
|
3814
|
+
max: 15,
|
|
3815
|
+
allowDecimals: !1
|
|
3816
|
+
}, "decimals", n), this.inputParams.push({
|
|
3792
3817
|
key: n,
|
|
3793
3818
|
params: [ t, e, {
|
|
3794
3819
|
target: i,
|
|
3795
|
-
height:
|
|
3820
|
+
height: u,
|
|
3796
3821
|
range: p,
|
|
3797
|
-
lag: m
|
|
3822
|
+
lag: m,
|
|
3823
|
+
decimals: b
|
|
3798
3824
|
} ]
|
|
3799
3825
|
}), this;
|
|
3800
3826
|
}
|
|
@@ -3802,13 +3828,13 @@ var OHLCV_INDICATORS;
|
|
|
3802
3828
|
key: "rsi",
|
|
3803
3829
|
value: function() {
|
|
3804
3830
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 14, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "rsi";
|
|
3805
|
-
|
|
3831
|
+
l(this), h(t, {
|
|
3806
3832
|
min: 1,
|
|
3807
3833
|
max: this.len,
|
|
3808
3834
|
allowDecimals: !1
|
|
3809
|
-
}, "size", r),
|
|
3835
|
+
}, "size", r), s(e, "options", r);
|
|
3810
3836
|
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
|
|
3811
|
-
return
|
|
3837
|
+
return h(a, {
|
|
3812
3838
|
min: 0,
|
|
3813
3839
|
max: this.len,
|
|
3814
3840
|
allowDecimals: !1
|
|
@@ -3824,26 +3850,31 @@ var OHLCV_INDICATORS;
|
|
|
3824
3850
|
key: "donchianChannels",
|
|
3825
3851
|
value: function() {
|
|
3826
3852
|
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";
|
|
3827
|
-
|
|
3853
|
+
l(this), h(t, {
|
|
3828
3854
|
min: 1,
|
|
3829
3855
|
max: this.len,
|
|
3830
3856
|
allowDecimals: !1
|
|
3831
|
-
}, "size", n),
|
|
3857
|
+
}, "size", n), h(e, {
|
|
3832
3858
|
min: 0,
|
|
3833
3859
|
max: this.len,
|
|
3834
3860
|
allowDecimals: !1
|
|
3835
|
-
}, "offset", n),
|
|
3836
|
-
var o = r.height, i = void 0 !== o && o, a = r.range,
|
|
3837
|
-
return
|
|
3861
|
+
}, "offset", n), s(r, "options", n);
|
|
3862
|
+
var o = r.height, i = void 0 !== o && o, a = r.range, u = void 0 === a ? [] : a, f = r.lag, p = void 0 === f ? 0 : f, v = r.decimals, m = void 0 === v ? null : v;
|
|
3863
|
+
return c(u, "options.range", n), h(p, {
|
|
3838
3864
|
min: 0,
|
|
3839
3865
|
max: this.len,
|
|
3840
3866
|
allowDecimals: !1
|
|
3841
|
-
}, "options.lag", n),
|
|
3867
|
+
}, "options.lag", n), y(i, "options.height", n), null !== m && h(m, {
|
|
3868
|
+
min: 1,
|
|
3869
|
+
max: 15,
|
|
3870
|
+
allowDecimals: !1
|
|
3871
|
+
}, "decimals", n), this.inputParams.push({
|
|
3842
3872
|
key: n,
|
|
3843
3873
|
params: [ t, e, {
|
|
3844
3874
|
height: i,
|
|
3845
|
-
range:
|
|
3846
|
-
lag: p
|
|
3875
|
+
range: u,
|
|
3876
|
+
lag: p,
|
|
3877
|
+
decimals: m
|
|
3847
3878
|
} ]
|
|
3848
3879
|
}), this;
|
|
3849
3880
|
}
|
|
@@ -3852,17 +3883,17 @@ var OHLCV_INDICATORS;
|
|
|
3852
3883
|
value: function() {
|
|
3853
3884
|
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";
|
|
3854
3885
|
if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');
|
|
3855
|
-
|
|
3886
|
+
l(this), h(t, {
|
|
3856
3887
|
min: 1,
|
|
3857
3888
|
max: this.len,
|
|
3858
3889
|
allowDecimals: !1
|
|
3859
|
-
}, "fastSize", n),
|
|
3890
|
+
}, "fastSize", n), h(e, {
|
|
3860
3891
|
min: t,
|
|
3861
3892
|
max: this.len,
|
|
3862
3893
|
allowDecimals: !1
|
|
3863
|
-
}, "slowSize", n),
|
|
3894
|
+
}, "slowSize", n), s(r, "options", n);
|
|
3864
3895
|
var o = r.lag, i = void 0 === o ? 0 : o;
|
|
3865
|
-
return
|
|
3896
|
+
return h(i, {
|
|
3866
3897
|
min: 0,
|
|
3867
3898
|
max: this.len,
|
|
3868
3899
|
allowDecimals: !1
|
|
@@ -3877,9 +3908,9 @@ var OHLCV_INDICATORS;
|
|
|
3877
3908
|
key: "dateTime",
|
|
3878
3909
|
value: function() {
|
|
3879
3910
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = "dateTime";
|
|
3880
|
-
|
|
3911
|
+
l(this), s(t, "options", e);
|
|
3881
3912
|
var r = t.lag, n = void 0 === r ? 0 : r;
|
|
3882
|
-
return
|
|
3913
|
+
return h(n, {
|
|
3883
3914
|
min: 0,
|
|
3884
3915
|
max: this.len,
|
|
3885
3916
|
allowDecimals: !1
|
|
@@ -3892,35 +3923,48 @@ var OHLCV_INDICATORS;
|
|
|
3892
3923
|
}
|
|
3893
3924
|
}, {
|
|
3894
3925
|
key: "scaler",
|
|
3895
|
-
value: function(t
|
|
3896
|
-
var o = "scaler";
|
|
3897
|
-
|
|
3926
|
+
value: function(t) {
|
|
3927
|
+
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, o = "scaler";
|
|
3928
|
+
l(this), h(t, {
|
|
3898
3929
|
min: 1,
|
|
3899
3930
|
max: this.len,
|
|
3900
3931
|
allowDecimals: !1
|
|
3901
|
-
}, "size", o),
|
|
3902
|
-
var i = n.group, a = void 0 !== i && i,
|
|
3903
|
-
|
|
3904
|
-
if (
|
|
3932
|
+
}, "size", o), c(e, "colKeys", o);
|
|
3933
|
+
var i = n.group, a = void 0 !== i && i, u = n.range, s = void 0 === u ? [ 0, 1 ] : u, p = n.lag, v = void 0 === p ? 0 : p, m = n.type, d = void 0 === m ? "minmax" : m, b = n.decimals, g = void 0 === b ? null : b;
|
|
3934
|
+
y(a, "options.group", o), function(t, e, n) {
|
|
3935
|
+
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, '".'));
|
|
3905
3936
|
var o = r(t, 2), i = o[0], a = o[1];
|
|
3906
|
-
if (
|
|
3937
|
+
if (h(i, {
|
|
3907
3938
|
min: -100,
|
|
3908
3939
|
max: a,
|
|
3909
3940
|
allowDecimals: !1
|
|
3910
|
-
}, "min", n),
|
|
3941
|
+
}, "min", n), h(a, {
|
|
3911
3942
|
min: i,
|
|
3912
3943
|
max: 100,
|
|
3913
3944
|
allowDecimals: !1
|
|
3914
3945
|
}, "max", n), i === a) throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(n, ".").concat(e, '".'));
|
|
3915
|
-
}(
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3946
|
+
}(s, "options.range", o), f([ "minmax", "zscore" ], d, "options.type", o), null !== g && h(g, {
|
|
3947
|
+
min: 1,
|
|
3948
|
+
max: 15,
|
|
3949
|
+
allowDecimals: !1
|
|
3950
|
+
}, "decimals", o);
|
|
3951
|
+
var w = {
|
|
3952
|
+
groupKey: a ? "".concat(d, "_").concat(t, "_group_").concat(e.join("_")) : "",
|
|
3953
|
+
groupKeyLen: e.length
|
|
3954
|
+
};
|
|
3955
|
+
return this.inputParams.push({
|
|
3919
3956
|
key: o,
|
|
3920
|
-
params: [ t, e,
|
|
3957
|
+
params: [ t, e, {
|
|
3958
|
+
type: d,
|
|
3959
|
+
group: a,
|
|
3960
|
+
range: s,
|
|
3961
|
+
lag: v,
|
|
3962
|
+
precomputed: w,
|
|
3963
|
+
decimals: g
|
|
3964
|
+
} ]
|
|
3921
3965
|
}), this;
|
|
3922
3966
|
}
|
|
3923
|
-
} ], e &&
|
|
3967
|
+
} ], e && kr(t.prototype, e), n && kr(t, n), Object.defineProperty(t, "prototype", {
|
|
3924
3968
|
writable: !1
|
|
3925
3969
|
}), t;
|
|
3926
3970
|
var t, e, n;
|