ohlcv-indicators 3.3.4 → 3.3.5
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 +1105 -1188
- package/index.js +16 -33
- package/package.json +1 -1
- package/src/core-functions/mainLoop.js +26 -41
- package/src/moving-averages/bollingerBands.js +4 -2
- package/src/moving-averages/donchianChannel.js +5 -2
- package/src/moving-averages/macd.js +3 -1
- package/src/moving-averages/movingAverages.js +2 -1
- package/src/studies/lag.js +2 -2
- package/src/studies/scaler.js +1 -1
- package/src/utilities/assignTypes.js +2 -2
- package/src/utilities/numberUtilities.js +1 -1
- package/src/utilities/precisionMultiplier.js +1 -1
- package/src/utilities/validators.js +1 -3
- package/src/utilities/verticalToHorizontal.js +16 -18
|
@@ -72,7 +72,7 @@ var OHLCV_INDICATORS;
|
|
|
72
72
|
}
|
|
73
73
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
74
74
|
}
|
|
75
|
-
var a, u = !0,
|
|
75
|
+
var a, u = !0, c = !1;
|
|
76
76
|
return {
|
|
77
77
|
s: function() {
|
|
78
78
|
r = r.call(t);
|
|
@@ -82,13 +82,13 @@ var OHLCV_INDICATORS;
|
|
|
82
82
|
return u = t.done, t;
|
|
83
83
|
},
|
|
84
84
|
e: function(t) {
|
|
85
|
-
|
|
85
|
+
c = !0, a = t;
|
|
86
86
|
},
|
|
87
87
|
f: function() {
|
|
88
88
|
try {
|
|
89
89
|
u || null == r.return || r.return();
|
|
90
90
|
} finally {
|
|
91
|
-
if (
|
|
91
|
+
if (c) throw a;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -102,39 +102,37 @@ var OHLCV_INDICATORS;
|
|
|
102
102
|
t.r(e),
|
|
103
103
|
// EXPORTS
|
|
104
104
|
t.d(e, {
|
|
105
|
-
default: () => /* binding */
|
|
105
|
+
default: () => /* binding */ jr
|
|
106
106
|
});
|
|
107
107
|
var i = function(t) {
|
|
108
|
-
|
|
109
|
-
}, a = function(t) {
|
|
110
|
-
if (0 !== t.lastComputedIndex) throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.');
|
|
111
|
-
}, u = function(t, e, r) {
|
|
108
|
+
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.');
|
|
109
|
+
}, a = function(t, e, r) {
|
|
112
110
|
if (!Array.isArray(t)) throw new Error('Param "'.concat(e, '" must be an array in "').concat(r, '".'));
|
|
113
111
|
return !0;
|
|
114
|
-
},
|
|
112
|
+
}, u = function(t, e, n) {
|
|
115
113
|
if (!Boolean(t) || "object" == !r(t)) throw new Error('Param "'.concat(e, '" must be an object in "').concat(n, '".'));
|
|
116
114
|
return !0;
|
|
117
115
|
}, c = function(t, e, r) {
|
|
118
116
|
if ("boolean" != typeof t) throw new Error('Param "'.concat(e, '" must be an boolean in "').concat(r, '".'));
|
|
119
117
|
return !0;
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
var o = e.allowDecimals, i = void 0 !== o && o, a = e.min,
|
|
118
|
+
}, l = function(t, e, r, n) {
|
|
119
|
+
u(e, "options", "".concat(n, ".").concat(r, ".validateNumber"));
|
|
120
|
+
var o = e.allowDecimals, i = void 0 !== o && o, a = e.min, c = e.max, l = i ? "number" : "integer";
|
|
123
121
|
if ("number" != typeof t || !1 === i && !Number.isInteger(t)) throw new Error('Param "'.concat(r, '" must be an integer in "').concat(n, '".'));
|
|
124
|
-
if ("number" != typeof a || "number" != typeof
|
|
125
|
-
if (t < a) throw new Error('Param "'.concat(r, '" must be an ').concat(
|
|
126
|
-
if (t >
|
|
122
|
+
if ("number" != typeof a || "number" != typeof c || a >= c) throw new Error('Param "min" must be a valid '.concat(l, ' lower than "max" "').concat(n, ".").concat(r, '.validateNumber".'));
|
|
123
|
+
if (t < a) throw new Error('Param "'.concat(r, '" must be an ').concat(l, " greater than or equal to ").concat(a, ' in "').concat(n, '".'));
|
|
124
|
+
if (t > c) throw new Error('Param "'.concat(r, '" must be an ').concat(l, " lower than or equal to ").concat(c, ' in "').concat(n, '".'));
|
|
127
125
|
return !0;
|
|
128
126
|
}, // 0, 1, 2 or 3
|
|
129
127
|
// The maximum value of DP and Big.DP.
|
|
130
|
-
|
|
128
|
+
s = 1e6, // 0 to 1000000
|
|
131
129
|
// The maximum magnitude of the exponent argument to the pow method.
|
|
132
|
-
|
|
130
|
+
f = 1e6, // true or false
|
|
133
131
|
/**************************************************************************************************/
|
|
134
132
|
// Error messages.
|
|
135
|
-
|
|
133
|
+
y = "[big.js] ", h = y + "Invalid ", p = h + "decimal places", v = h + "rounding mode", m = y + "Division by zero",
|
|
136
134
|
// The shared prototype object.
|
|
137
|
-
|
|
135
|
+
d = {}, b = void 0, g = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
138
136
|
/*
|
|
139
137
|
* Round Big x to a maximum of sd significant digits using rounding mode rm.
|
|
140
138
|
*
|
|
@@ -143,10 +141,10 @@ var OHLCV_INDICATORS;
|
|
|
143
141
|
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
144
142
|
* [more] {boolean} Whether the result of division was truncated.
|
|
145
143
|
*/
|
|
146
|
-
function
|
|
144
|
+
function w(t, e, r, n) {
|
|
147
145
|
var o = t.c;
|
|
148
|
-
if (r ===
|
|
149
|
-
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] !==
|
|
146
|
+
if (r === b && (r = t.constructor.RM), 0 !== r && 1 !== r && 2 !== r && 3 !== r) throw Error(v);
|
|
147
|
+
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] !== b))),
|
|
150
148
|
o.length = 1, n ? (
|
|
151
149
|
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
|
152
150
|
t.e = t.e - e + 1, o[0] = 1) :
|
|
@@ -155,7 +153,7 @@ var OHLCV_INDICATORS;
|
|
|
155
153
|
// Round up?
|
|
156
154
|
if (
|
|
157
155
|
// xc[sd] is the digit after the digit that may be rounded up.
|
|
158
|
-
n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !==
|
|
156
|
+
n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !== b || 1 & o[e - 1])) || 3 === r && (n || !!o[0]),
|
|
159
157
|
// Remove any digits after the required precision.
|
|
160
158
|
o.length = e, n)
|
|
161
159
|
// Rounding up may mean the previous digit has to be rounded up.
|
|
@@ -171,7 +169,7 @@ var OHLCV_INDICATORS;
|
|
|
171
169
|
/*
|
|
172
170
|
* Return a string representing the value of Big x in normal or exponential notation.
|
|
173
171
|
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
174
|
-
*/ function
|
|
172
|
+
*/ function O(t, e, r) {
|
|
175
173
|
var n = t.e, o = t.c.join(""), i = o.length;
|
|
176
174
|
// Exponential notation?
|
|
177
175
|
if (e) o = o.charAt(0) + (i > 1 ? "." + o.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
|
|
@@ -185,7 +183,7 @@ var OHLCV_INDICATORS;
|
|
|
185
183
|
// Prototype/instance methods
|
|
186
184
|
/*
|
|
187
185
|
* Return a new Big whose value is the absolute value of this Big.
|
|
188
|
-
*/
|
|
186
|
+
*/ d.abs = function() {
|
|
189
187
|
var t = new this.constructor(this);
|
|
190
188
|
return t.s = 1, t;
|
|
191
189
|
},
|
|
@@ -194,125 +192,125 @@ var OHLCV_INDICATORS;
|
|
|
194
192
|
* -1 if the value of this Big is less than the value of Big y, or
|
|
195
193
|
* 0 if they have the same value.
|
|
196
194
|
*/
|
|
197
|
-
|
|
198
|
-
var e, r = this, n = r.c, o = (t = new r.constructor(t)).c, i = r.s, a = t.s, u = r.e,
|
|
195
|
+
d.cmp = function(t) {
|
|
196
|
+
var e, r = this, n = r.c, o = (t = new r.constructor(t)).c, i = r.s, a = t.s, u = r.e, c = t.e;
|
|
199
197
|
// Either zero?
|
|
200
198
|
if (!n[0] || !o[0]) return n[0] ? i : o[0] ? -a : 0;
|
|
201
199
|
// Signs differ?
|
|
202
200
|
if (i != a) return i;
|
|
203
201
|
// Compare exponents.
|
|
204
|
-
if (e = i < 0, u !=
|
|
202
|
+
if (e = i < 0, u != c) return u > c ^ e ? 1 : -1;
|
|
205
203
|
// Compare digit by digit.
|
|
206
|
-
for (a = (u = n.length) < (
|
|
204
|
+
for (a = (u = n.length) < (c = o.length) ? u : c, i = -1; ++i < a; ) if (n[i] != o[i]) return n[i] > o[i] ^ e ? 1 : -1;
|
|
207
205
|
// Compare lengths.
|
|
208
|
-
return u ==
|
|
206
|
+
return u == c ? 0 : u > c ^ e ? 1 : -1;
|
|
209
207
|
},
|
|
210
208
|
/*
|
|
211
209
|
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
|
|
212
210
|
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
213
211
|
*/
|
|
214
|
-
|
|
212
|
+
d.div = function(t) {
|
|
215
213
|
var e = this, r = e.constructor, n = e.c, // dividend
|
|
216
214
|
o = (t = new r(t)).c, // divisor
|
|
217
215
|
i = e.s == t.s ? 1 : -1, a = r.DP;
|
|
218
|
-
if (a !== ~~a || a < 0 || a >
|
|
216
|
+
if (a !== ~~a || a < 0 || a > s) throw Error(p);
|
|
219
217
|
// Divisor is zero?
|
|
220
218
|
if (!o[0]) throw Error(m);
|
|
221
219
|
// Dividend is 0? Return +-0.
|
|
222
220
|
if (!n[0]) return t.s = i, t.c = [ t.e = 0 ], t;
|
|
223
|
-
var u, l,
|
|
224
|
-
|
|
221
|
+
var u, c, l, f, y, h = o.slice(), v = u = o.length, d = n.length, g = n.slice(0, u), // remainder
|
|
222
|
+
O = g.length, S = t, // quotient
|
|
225
223
|
j = S.c = [], P = 0, _ = a + (S.e = e.e - t.e) + 1;
|
|
226
224
|
// precision of the result
|
|
227
225
|
// Add zeros to make remainder as long as divisor.
|
|
228
226
|
for (S.s = i, i = _ < 0 ? 0 : _,
|
|
229
227
|
// Create version of divisor with leading zero.
|
|
230
|
-
|
|
228
|
+
h.unshift(0); O++ < u; ) g.push(0);
|
|
231
229
|
do {
|
|
232
230
|
// n is how many times the divisor goes into current remainder.
|
|
233
|
-
for (
|
|
231
|
+
for (l = 0; l < 10; l++) {
|
|
234
232
|
// Compare divisor and remainder.
|
|
235
|
-
if (u != (
|
|
236
|
-
|
|
233
|
+
if (u != (O = g.length)) f = u > O ? 1 : -1; else for (y = -1, f = 0; ++y < u; ) if (o[y] != g[y]) {
|
|
234
|
+
f = o[y] > g[y] ? 1 : -1;
|
|
237
235
|
break;
|
|
238
236
|
}
|
|
239
237
|
// If divisor < remainder, subtract divisor from remainder.
|
|
240
|
-
if (!(
|
|
238
|
+
if (!(f < 0)) break;
|
|
241
239
|
// Remainder can't be more than 1 digit longer than divisor.
|
|
242
240
|
// Equalise lengths using divisor with extra leading zero?
|
|
243
|
-
for (
|
|
244
|
-
if (
|
|
245
|
-
for (
|
|
246
|
-
--
|
|
241
|
+
for (c = O == u ? o : h; O; ) {
|
|
242
|
+
if (g[--O] < c[O]) {
|
|
243
|
+
for (y = O; y && !g[--y]; ) g[y] = 9;
|
|
244
|
+
--g[y], g[O] += 10;
|
|
247
245
|
}
|
|
248
|
-
|
|
246
|
+
g[O] -= c[O];
|
|
249
247
|
}
|
|
250
|
-
for (;!
|
|
248
|
+
for (;!g[0]; ) g.shift();
|
|
251
249
|
}
|
|
252
250
|
// Add the digit n to the result array.
|
|
253
|
-
j[P++] =
|
|
251
|
+
j[P++] = f ? l : ++l,
|
|
254
252
|
// Update the remainder.
|
|
255
|
-
|
|
256
|
-
} while ((
|
|
253
|
+
g[0] && f ? g[O] = n[v] || 0 : g = [ n[v] ];
|
|
254
|
+
} while ((v++ < d || g[0] !== b) && i--);
|
|
257
255
|
// Leading zero? Do not remove if result is simply zero (qi == 1).
|
|
258
256
|
return j[0] || 1 == P || (
|
|
259
257
|
// There can't be more than one zero.
|
|
260
258
|
j.shift(), S.e--, _--),
|
|
261
259
|
// Round?
|
|
262
|
-
P > _ &&
|
|
260
|
+
P > _ && w(S, _, r.RM, g[0] !== b), S;
|
|
263
261
|
},
|
|
264
262
|
/*
|
|
265
263
|
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
266
264
|
*/
|
|
267
|
-
|
|
265
|
+
d.eq = function(t) {
|
|
268
266
|
return 0 === this.cmp(t);
|
|
269
267
|
},
|
|
270
268
|
/*
|
|
271
269
|
* Return true if the value of this Big is greater than the value of Big y, otherwise return
|
|
272
270
|
* false.
|
|
273
271
|
*/
|
|
274
|
-
|
|
272
|
+
d.gt = function(t) {
|
|
275
273
|
return this.cmp(t) > 0;
|
|
276
274
|
},
|
|
277
275
|
/*
|
|
278
276
|
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
|
|
279
277
|
* return false.
|
|
280
278
|
*/
|
|
281
|
-
|
|
279
|
+
d.gte = function(t) {
|
|
282
280
|
return this.cmp(t) > -1;
|
|
283
281
|
},
|
|
284
282
|
/*
|
|
285
283
|
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
|
|
286
284
|
*/
|
|
287
|
-
|
|
285
|
+
d.lt = function(t) {
|
|
288
286
|
return this.cmp(t) < 0;
|
|
289
287
|
},
|
|
290
288
|
/*
|
|
291
289
|
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
|
|
292
290
|
* return false.
|
|
293
291
|
*/
|
|
294
|
-
|
|
292
|
+
d.lte = function(t) {
|
|
295
293
|
return this.cmp(t) < 1;
|
|
296
294
|
},
|
|
297
295
|
/*
|
|
298
296
|
* Return a new Big whose value is the value of this Big minus the value of Big y.
|
|
299
297
|
*/
|
|
300
|
-
|
|
301
|
-
var e, r, n, o, i = this, a = i.constructor, u = i.s,
|
|
298
|
+
d.minus = d.sub = function(t) {
|
|
299
|
+
var e, r, n, o, i = this, a = i.constructor, u = i.s, c = (t = new a(t)).s;
|
|
302
300
|
// Signs differ?
|
|
303
|
-
if (u !=
|
|
304
|
-
var
|
|
301
|
+
if (u != c) return t.s = -c, i.plus(t);
|
|
302
|
+
var l = i.c.slice(), s = i.e, f = t.c, y = t.e;
|
|
305
303
|
// Either zero?
|
|
306
|
-
if (!
|
|
304
|
+
if (!l[0] || !f[0]) return f[0] ? t.s = -c : l[0] ? t = new a(i) : t.s = 1,
|
|
307
305
|
t;
|
|
308
306
|
// Determine which is the bigger number. Prepend zeros to equalise exponents.
|
|
309
|
-
if (u = s -
|
|
310
|
-
for ((o = u < 0) ? (u = -u, n =
|
|
307
|
+
if (u = s - y) {
|
|
308
|
+
for ((o = u < 0) ? (u = -u, n = l) : (y = s, n = f), n.reverse(), c = u; c--; ) n.push(0);
|
|
311
309
|
n.reverse();
|
|
312
310
|
} else for (
|
|
313
311
|
// Exponents equal. Check digit by digit.
|
|
314
|
-
r = ((o =
|
|
315
|
-
o = c
|
|
312
|
+
r = ((o = l.length < f.length) ? l : f).length, u = c = 0; c < r; c++) if (l[c] != f[c]) {
|
|
313
|
+
o = l[c] < f[c];
|
|
316
314
|
break;
|
|
317
315
|
}
|
|
318
316
|
// x < y? Point xc to the array of the bigger number.
|
|
@@ -320,29 +318,29 @@ var OHLCV_INDICATORS;
|
|
|
320
318
|
* Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
|
|
321
319
|
* needs to start at yc.length.
|
|
322
320
|
*/
|
|
323
|
-
if (o && (n =
|
|
321
|
+
if (o && (n = l, l = f, f = n, t.s = -t.s), (c = (r = f.length) - (e = l.length)) > 0) for (;c--; ) l[e++] = 0;
|
|
324
322
|
// Subtract yc from xc.
|
|
325
|
-
for (
|
|
326
|
-
if (
|
|
327
|
-
for (e = r; e && !
|
|
328
|
-
--
|
|
323
|
+
for (c = e; r > u; ) {
|
|
324
|
+
if (l[--r] < f[r]) {
|
|
325
|
+
for (e = r; e && !l[--e]; ) l[e] = 9;
|
|
326
|
+
--l[e], l[r] += 10;
|
|
329
327
|
}
|
|
330
|
-
|
|
328
|
+
l[r] -= f[r];
|
|
331
329
|
}
|
|
332
330
|
// Remove trailing zeros.
|
|
333
|
-
for (;0 ===
|
|
331
|
+
for (;0 === l[--c]; ) l.pop();
|
|
334
332
|
// Remove leading zeros and adjust exponent accordingly.
|
|
335
|
-
for (;0 ===
|
|
336
|
-
return
|
|
333
|
+
for (;0 === l[0]; ) l.shift(), --y;
|
|
334
|
+
return l[0] || (
|
|
337
335
|
// n - n = +0
|
|
338
336
|
t.s = 1,
|
|
339
337
|
// Result must be zero.
|
|
340
|
-
|
|
338
|
+
l = [ y = 0 ]), t.c = l, t.e = y, t;
|
|
341
339
|
},
|
|
342
340
|
/*
|
|
343
341
|
* Return a new Big whose value is the value of this Big modulo the value of Big y.
|
|
344
342
|
*/
|
|
345
|
-
|
|
343
|
+
d.mod = function(t) {
|
|
346
344
|
var e, r = this, n = r.constructor, o = r.s, i = (t = new n(t)).s;
|
|
347
345
|
if (!t.c[0]) throw Error(m);
|
|
348
346
|
return r.s = t.s = 1, e = 1 == t.cmp(r), r.s = o, t.s = i, e ? new n(r) : (o = n.DP,
|
|
@@ -351,34 +349,34 @@ var OHLCV_INDICATORS;
|
|
|
351
349
|
/*
|
|
352
350
|
* Return a new Big whose value is the value of this Big negated.
|
|
353
351
|
*/
|
|
354
|
-
|
|
352
|
+
d.neg = function() {
|
|
355
353
|
var t = new this.constructor(this);
|
|
356
354
|
return t.s = -t.s, t;
|
|
357
355
|
},
|
|
358
356
|
/*
|
|
359
357
|
* Return a new Big whose value is the value of this Big plus the value of Big y.
|
|
360
358
|
*/
|
|
361
|
-
|
|
359
|
+
d.plus = d.add = function(t) {
|
|
362
360
|
var e, r, n, o = this, i = o.constructor;
|
|
363
361
|
// Signs differ?
|
|
364
362
|
if (t = new i(t), o.s != t.s) return t.s = -t.s, o.minus(t);
|
|
365
|
-
var a = o.e, u = o.c,
|
|
363
|
+
var a = o.e, u = o.c, c = t.e, l = t.c;
|
|
366
364
|
// Either zero?
|
|
367
|
-
if (!u[0] || !
|
|
365
|
+
if (!u[0] || !l[0]) return l[0] || (u[0] ? t = new i(o) : t.s = o.s),
|
|
368
366
|
t;
|
|
369
367
|
// Prepend zeros to equalise exponents.
|
|
370
368
|
// Note: reverse faster than unshifts.
|
|
371
|
-
if (u = u.slice(), e = a -
|
|
372
|
-
for (e > 0 ? (
|
|
369
|
+
if (u = u.slice(), e = a - c) {
|
|
370
|
+
for (e > 0 ? (c = a, n = l) : (e = -e, n = u), n.reverse(); e--; ) n.push(0);
|
|
373
371
|
n.reverse();
|
|
374
372
|
}
|
|
375
373
|
// Point xc to the longer array.
|
|
376
374
|
// Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
|
|
377
|
-
for (u.length -
|
|
375
|
+
for (u.length - l.length < 0 && (n = l, l = u, u = n), e = l.length, r = 0; e; u[e] %= 10) r = (u[--e] = u[e] + l[e] + r) / 10 | 0;
|
|
378
376
|
// No need to check for zero, as +x + +y != 0 && -x + -y != 0
|
|
379
377
|
// Remove trailing zeros.
|
|
380
|
-
for (r && (u.unshift(r), ++
|
|
381
|
-
return t.c = u, t.e =
|
|
378
|
+
for (r && (u.unshift(r), ++c), e = u.length; 0 === u[--e]; ) u.pop();
|
|
379
|
+
return t.c = u, t.e = c, t;
|
|
382
380
|
},
|
|
383
381
|
/*
|
|
384
382
|
* Return a Big whose value is the value of this Big raised to the power n.
|
|
@@ -387,9 +385,9 @@ var OHLCV_INDICATORS;
|
|
|
387
385
|
*
|
|
388
386
|
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
|
|
389
387
|
*/
|
|
390
|
-
|
|
388
|
+
d.pow = function(t) {
|
|
391
389
|
var e = this, r = new e.constructor("1"), n = r, o = t < 0;
|
|
392
|
-
if (t !== ~~t || t < -1e6 || t >
|
|
390
|
+
if (t !== ~~t || t < -1e6 || t > f) throw Error(h + "exponent");
|
|
393
391
|
for (o && (t = -t); 1 & t && (n = n.times(e)), t >>= 1; ) e = e.times(e);
|
|
394
392
|
return o ? r.div(n) : n;
|
|
395
393
|
},
|
|
@@ -400,9 +398,9 @@ var OHLCV_INDICATORS;
|
|
|
400
398
|
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
401
399
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
402
400
|
*/
|
|
403
|
-
|
|
404
|
-
if (t !== ~~t || t < 1 || t >
|
|
405
|
-
return
|
|
401
|
+
d.prec = function(t, e) {
|
|
402
|
+
if (t !== ~~t || t < 1 || t > s) throw Error(h + "precision");
|
|
403
|
+
return w(new this.constructor(this), t, e);
|
|
406
404
|
},
|
|
407
405
|
/*
|
|
408
406
|
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
@@ -413,20 +411,20 @@ var OHLCV_INDICATORS;
|
|
|
413
411
|
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
|
|
414
412
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
415
413
|
*/
|
|
416
|
-
|
|
417
|
-
if (t ===
|
|
418
|
-
return
|
|
414
|
+
d.round = function(t, e) {
|
|
415
|
+
if (t === b) t = 0; else if (t !== ~~t || t < -s || t > s) throw Error(p);
|
|
416
|
+
return w(new this.constructor(this), t + this.e + 1, e);
|
|
419
417
|
},
|
|
420
418
|
/*
|
|
421
419
|
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
422
420
|
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
423
421
|
*/
|
|
424
|
-
|
|
422
|
+
d.sqrt = function() {
|
|
425
423
|
var t, e, r, n = this, o = n.constructor, i = n.s, a = n.e, u = new o("0.5");
|
|
426
424
|
// Zero?
|
|
427
425
|
if (!n.c[0]) return new o(n);
|
|
428
426
|
// Negative?
|
|
429
|
-
if (i < 0) throw Error(
|
|
427
|
+
if (i < 0) throw Error(y + "No square root");
|
|
430
428
|
// Estimate.
|
|
431
429
|
// Math.sqrt underflow/overflow?
|
|
432
430
|
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
|
|
@@ -437,35 +435,35 @@ var OHLCV_INDICATORS;
|
|
|
437
435
|
do {
|
|
438
436
|
r = t, t = u.times(r.plus(n.div(r)));
|
|
439
437
|
} while (r.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
|
|
440
|
-
return
|
|
438
|
+
return w(t, (o.DP -= 4) + t.e + 1, o.RM);
|
|
441
439
|
},
|
|
442
440
|
/*
|
|
443
441
|
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
444
442
|
*/
|
|
445
|
-
|
|
446
|
-
var e, r = this, n = r.constructor, o = r.c, i = (t = new n(t)).c, a = o.length, u = i.length,
|
|
443
|
+
d.times = d.mul = function(t) {
|
|
444
|
+
var e, r = this, n = r.constructor, o = r.c, i = (t = new n(t)).c, a = o.length, u = i.length, c = r.e, l = t.e;
|
|
447
445
|
// Determine sign of result.
|
|
448
446
|
// Return signed 0 if either 0.
|
|
449
447
|
if (t.s = r.s == t.s ? 1 : -1, !o[0] || !i[0]) return t.c = [ t.e = 0 ], t;
|
|
450
448
|
// Initialise exponent of result as x.e + y.e.
|
|
451
449
|
// Initialise coefficient array of result with zeros.
|
|
452
|
-
for (t.e =
|
|
450
|
+
for (t.e = c + l,
|
|
453
451
|
// If array xc has fewer digits than yc, swap xc and yc, and lengths.
|
|
454
|
-
a < u && (e = o, o = i, i = e,
|
|
452
|
+
a < u && (e = o, o = i, i = e, l = a, a = u, u = l), e = new Array(l = a + u); l--; ) e[l] = 0;
|
|
455
453
|
// Multiply.
|
|
456
454
|
// i is initially xc.length.
|
|
457
|
-
for (
|
|
455
|
+
for (c = u; c--; ) {
|
|
458
456
|
// a is yc.length.
|
|
459
|
-
for (u = 0,
|
|
457
|
+
for (u = 0, l = a + c; l > c; )
|
|
460
458
|
// Current sum of products at this digit position, plus carry.
|
|
461
|
-
u = e[
|
|
459
|
+
u = e[l] + i[c] * o[l - c - 1] + u, e[l--] = u % 10,
|
|
462
460
|
// carry
|
|
463
461
|
u = u / 10 | 0;
|
|
464
|
-
e[
|
|
462
|
+
e[l] = u;
|
|
465
463
|
}
|
|
466
464
|
// Increment result exponent if there is a final carry, otherwise remove leading zero.
|
|
467
465
|
// Remove trailing zeros.
|
|
468
|
-
for (u ? ++t.e : e.shift(),
|
|
466
|
+
for (u ? ++t.e : e.shift(), c = e.length; !e[--c]; ) e.pop();
|
|
469
467
|
return t.c = e, t;
|
|
470
468
|
},
|
|
471
469
|
/*
|
|
@@ -475,13 +473,13 @@ var OHLCV_INDICATORS;
|
|
|
475
473
|
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
476
474
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
477
475
|
*/
|
|
478
|
-
|
|
476
|
+
d.toExponential = function(t, e) {
|
|
479
477
|
var r = this, n = r.c[0];
|
|
480
|
-
if (t !==
|
|
481
|
-
if (t !== ~~t || t < 0 || t >
|
|
482
|
-
for (r =
|
|
478
|
+
if (t !== b) {
|
|
479
|
+
if (t !== ~~t || t < 0 || t > s) throw Error(p);
|
|
480
|
+
for (r = w(new r.constructor(r), ++t, e); r.c.length < t; ) r.c.push(0);
|
|
483
481
|
}
|
|
484
|
-
return
|
|
482
|
+
return O(r, !0, !!n);
|
|
485
483
|
},
|
|
486
484
|
/*
|
|
487
485
|
* Return a string representing the value of this Big in normal notation rounded to dp fixed
|
|
@@ -493,14 +491,14 @@ var OHLCV_INDICATORS;
|
|
|
493
491
|
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
|
|
494
492
|
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
|
|
495
493
|
*/
|
|
496
|
-
|
|
494
|
+
d.toFixed = function(t, e) {
|
|
497
495
|
var r = this, n = r.c[0];
|
|
498
|
-
if (t !==
|
|
499
|
-
if (t !== ~~t || t < 0 || t >
|
|
496
|
+
if (t !== b) {
|
|
497
|
+
if (t !== ~~t || t < 0 || t > s) throw Error(p);
|
|
500
498
|
// x.e may have changed if the value is rounded up.
|
|
501
|
-
for (t = t + (r =
|
|
499
|
+
for (t = t + (r = w(new r.constructor(r), t + r.e + 1, e)).e + 1; r.c.length < t; ) r.c.push(0);
|
|
502
500
|
}
|
|
503
|
-
return
|
|
501
|
+
return O(r, !1, !!n);
|
|
504
502
|
},
|
|
505
503
|
/*
|
|
506
504
|
* Return a string representing the value of this Big.
|
|
@@ -508,16 +506,16 @@ var OHLCV_INDICATORS;
|
|
|
508
506
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
509
507
|
* Omit the sign for negative zero.
|
|
510
508
|
*/
|
|
511
|
-
|
|
509
|
+
d[Symbol.for("nodejs.util.inspect.custom")] = d.toJSON = d.toString = function() {
|
|
512
510
|
var t = this, e = t.constructor;
|
|
513
|
-
return
|
|
511
|
+
return O(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
|
|
514
512
|
},
|
|
515
513
|
/*
|
|
516
514
|
* Return the value of this Big as a primitve number.
|
|
517
515
|
*/
|
|
518
|
-
|
|
519
|
-
var t = Number(
|
|
520
|
-
if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(
|
|
516
|
+
d.toNumber = function() {
|
|
517
|
+
var t = Number(O(this, !0, !0));
|
|
518
|
+
if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(y + "Imprecise conversion");
|
|
521
519
|
return t;
|
|
522
520
|
},
|
|
523
521
|
/*
|
|
@@ -529,13 +527,13 @@ var OHLCV_INDICATORS;
|
|
|
529
527
|
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
530
528
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
531
529
|
*/
|
|
532
|
-
|
|
530
|
+
d.toPrecision = function(t, e) {
|
|
533
531
|
var r = this, n = r.constructor, o = r.c[0];
|
|
534
|
-
if (t !==
|
|
535
|
-
if (t !== ~~t || t < 1 || t >
|
|
536
|
-
for (r =
|
|
532
|
+
if (t !== b) {
|
|
533
|
+
if (t !== ~~t || t < 1 || t > s) throw Error(h + "precision");
|
|
534
|
+
for (r = w(new n(r), t, e); r.c.length < t; ) r.c.push(0);
|
|
537
535
|
}
|
|
538
|
-
return
|
|
536
|
+
return O(r, t <= r.e || r.e <= n.NE || r.e >= n.PE, !!o);
|
|
539
537
|
},
|
|
540
538
|
/*
|
|
541
539
|
* Return a string representing the value of this Big.
|
|
@@ -543,10 +541,10 @@ var OHLCV_INDICATORS;
|
|
|
543
541
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
544
542
|
* Include the sign for negative zero.
|
|
545
543
|
*/
|
|
546
|
-
|
|
544
|
+
d.valueOf = function() {
|
|
547
545
|
var t = this, e = t.constructor;
|
|
548
|
-
if (!0 === e.strict) throw Error(
|
|
549
|
-
return
|
|
546
|
+
if (!0 === e.strict) throw Error(y + "valueOf disallowed");
|
|
547
|
+
return O(t, t.e <= e.NE || t.e >= e.PE, !0);
|
|
550
548
|
};
|
|
551
549
|
// Export
|
|
552
550
|
(
|
|
@@ -563,11 +561,11 @@ var OHLCV_INDICATORS;
|
|
|
563
561
|
function e(r) {
|
|
564
562
|
var n = this;
|
|
565
563
|
// Enable constructor usage without new.
|
|
566
|
-
if (!(n instanceof e)) return r ===
|
|
564
|
+
if (!(n instanceof e)) return r === b ? t() : new e(r);
|
|
567
565
|
// Duplicate.
|
|
568
566
|
if (r instanceof e) n.s = r.s, n.e = r.e, n.c = r.c.slice(); else {
|
|
569
567
|
if ("string" != typeof r) {
|
|
570
|
-
if (!0 === e.strict && "bigint" != typeof r) throw TypeError(
|
|
568
|
+
if (!0 === e.strict && "bigint" != typeof r) throw TypeError(h + "value");
|
|
571
569
|
// Minus zero?
|
|
572
570
|
r = 0 === r && 1 / r < 0 ? "-0" : String(r);
|
|
573
571
|
}
|
|
@@ -580,7 +578,7 @@ var OHLCV_INDICATORS;
|
|
|
580
578
|
*/
|
|
581
579
|
function(t, e) {
|
|
582
580
|
var r, n, o;
|
|
583
|
-
if (!
|
|
581
|
+
if (!g.test(e)) throw Error(h + "number");
|
|
584
582
|
// Determine sign.
|
|
585
583
|
// Decimal point?
|
|
586
584
|
t.s = "-" == e.charAt(0) ? (e = e.slice(1), -1) : 1, (r = e.indexOf(".")) > -1 && (e = e.replace(".", ""));
|
|
@@ -606,51 +604,51 @@ var OHLCV_INDICATORS;
|
|
|
606
604
|
// Shadow Big.prototype.constructor which points to Object.
|
|
607
605
|
n.constructor = e;
|
|
608
606
|
}
|
|
609
|
-
return e.prototype =
|
|
607
|
+
return e.prototype = d, e.DP = 20, e.RM = 1, e.NE = -7, e.PE = 21, e.strict = false,
|
|
610
608
|
e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e;
|
|
611
609
|
})();
|
|
612
610
|
/// <reference types="https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/big.js/index.d.ts" />
|
|
613
611
|
/* harmony default export */ // ./node_modules/trading-signals/dist/error/NotEnoughDataError.js
|
|
614
|
-
function
|
|
615
|
-
return
|
|
612
|
+
function S(t) {
|
|
613
|
+
return S = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
616
614
|
return typeof t;
|
|
617
615
|
} : function(t) {
|
|
618
616
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
619
|
-
},
|
|
617
|
+
}, S(t);
|
|
620
618
|
}
|
|
621
|
-
function
|
|
619
|
+
function j(t, e) {
|
|
622
620
|
for (var r = 0; r < e.length; r++) {
|
|
623
621
|
var n = e[r];
|
|
624
622
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
625
|
-
Object.defineProperty(t,
|
|
623
|
+
Object.defineProperty(t, P(n.key), n);
|
|
626
624
|
}
|
|
627
625
|
}
|
|
628
|
-
function
|
|
626
|
+
function P(t) {
|
|
629
627
|
var e = function(t, e) {
|
|
630
|
-
if ("object" !=
|
|
628
|
+
if ("object" != S(t) || !t) return t;
|
|
631
629
|
var r = t[Symbol.toPrimitive];
|
|
632
630
|
if (void 0 !== r) {
|
|
633
631
|
var n = r.call(t, e || "default");
|
|
634
|
-
if ("object" !=
|
|
632
|
+
if ("object" != S(n)) return n;
|
|
635
633
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
636
634
|
}
|
|
637
635
|
return ("string" === e ? String : Number)(t);
|
|
638
636
|
}(t, "string");
|
|
639
|
-
return "symbol" ==
|
|
637
|
+
return "symbol" == S(e) ? e : e + "";
|
|
640
638
|
}
|
|
641
|
-
function
|
|
642
|
-
return e =
|
|
643
|
-
if (e && ("object" ==
|
|
639
|
+
function _(t, e, r) {
|
|
640
|
+
return e = E(e), function(t, e) {
|
|
641
|
+
if (e && ("object" == S(e) || "function" == typeof e)) return e;
|
|
644
642
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
645
643
|
return function(t) {
|
|
646
644
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
647
645
|
return t;
|
|
648
646
|
}(t);
|
|
649
|
-
}(t,
|
|
647
|
+
}(t, T() ? Reflect.construct(e, r || [], E(t).constructor) : e.apply(t, r));
|
|
650
648
|
}
|
|
651
|
-
function
|
|
649
|
+
function N(t) {
|
|
652
650
|
var e = "function" == typeof Map ? new Map : void 0;
|
|
653
|
-
return
|
|
651
|
+
return N = function(t) {
|
|
654
652
|
if (null === t || !function(t) {
|
|
655
653
|
try {
|
|
656
654
|
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
@@ -665,12 +663,12 @@ var OHLCV_INDICATORS;
|
|
|
665
663
|
}
|
|
666
664
|
function r() {
|
|
667
665
|
return function(t, e, r) {
|
|
668
|
-
if (
|
|
666
|
+
if (T()) return Reflect.construct.apply(null, arguments);
|
|
669
667
|
var n = [ null ];
|
|
670
668
|
n.push.apply(n, e);
|
|
671
669
|
var o = new (t.bind.apply(t, n));
|
|
672
|
-
return r &&
|
|
673
|
-
}(t, arguments,
|
|
670
|
+
return r && A(o, r.prototype), o;
|
|
671
|
+
}(t, arguments, E(this).constructor);
|
|
674
672
|
}
|
|
675
673
|
return r.prototype = Object.create(t.prototype, {
|
|
676
674
|
constructor: {
|
|
@@ -679,33 +677,33 @@ var OHLCV_INDICATORS;
|
|
|
679
677
|
writable: !0,
|
|
680
678
|
configurable: !0
|
|
681
679
|
}
|
|
682
|
-
}),
|
|
683
|
-
},
|
|
680
|
+
}), A(r, t);
|
|
681
|
+
}, N(t);
|
|
684
682
|
}
|
|
685
|
-
function
|
|
683
|
+
function T() {
|
|
686
684
|
try {
|
|
687
685
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
688
686
|
} catch (t) {}
|
|
689
|
-
return (
|
|
687
|
+
return (T = function() {
|
|
690
688
|
return !!t;
|
|
691
689
|
})();
|
|
692
690
|
}
|
|
693
|
-
function
|
|
694
|
-
return
|
|
691
|
+
function A(t, e) {
|
|
692
|
+
return A = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
695
693
|
return t.__proto__ = e, t;
|
|
696
|
-
},
|
|
694
|
+
}, A(t, e);
|
|
697
695
|
}
|
|
698
|
-
function
|
|
699
|
-
return
|
|
696
|
+
function E(t) {
|
|
697
|
+
return E = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
700
698
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
701
|
-
},
|
|
699
|
+
}, E(t);
|
|
702
700
|
}
|
|
703
701
|
var k = function(t) {
|
|
704
702
|
function e() {
|
|
705
703
|
var t, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "Not enough data";
|
|
706
704
|
return function(t, e) {
|
|
707
705
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
708
|
-
}(this, e), t =
|
|
706
|
+
}(this, e), t = _(this, e, [ r ]), Object.setPrototypeOf(t, (this instanceof e ? this.constructor : void 0).prototype),
|
|
709
707
|
t.name = "NotEnoughDataError", t;
|
|
710
708
|
}
|
|
711
709
|
return function(t, e) {
|
|
@@ -718,58 +716,58 @@ var OHLCV_INDICATORS;
|
|
|
718
716
|
}
|
|
719
717
|
}), Object.defineProperty(t, "prototype", {
|
|
720
718
|
writable: !1
|
|
721
|
-
}), e &&
|
|
722
|
-
}(e, t), r = e, n &&
|
|
719
|
+
}), e && A(t, e);
|
|
720
|
+
}(e, t), r = e, n && j(r.prototype, n), o && j(r, o), Object.defineProperty(r, "prototype", {
|
|
723
721
|
writable: !1
|
|
724
722
|
}), r;
|
|
725
723
|
var r, n, o;
|
|
726
|
-
}(
|
|
724
|
+
}( N(Error));
|
|
727
725
|
// ./node_modules/trading-signals/dist/Indicator.js
|
|
728
|
-
function
|
|
729
|
-
return
|
|
726
|
+
function x(t) {
|
|
727
|
+
return x = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
730
728
|
return typeof t;
|
|
731
729
|
} : function(t) {
|
|
732
730
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
733
|
-
},
|
|
731
|
+
}, x(t);
|
|
734
732
|
}
|
|
735
733
|
function M(t, e) {
|
|
736
734
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
737
735
|
}
|
|
738
|
-
function
|
|
736
|
+
function I(t, e) {
|
|
739
737
|
for (var r = 0; r < e.length; r++) {
|
|
740
738
|
var n = e[r];
|
|
741
739
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
742
|
-
Object.defineProperty(t,
|
|
740
|
+
Object.defineProperty(t, C(n.key), n);
|
|
743
741
|
}
|
|
744
742
|
}
|
|
745
|
-
function
|
|
746
|
-
return e &&
|
|
743
|
+
function D(t, e, r) {
|
|
744
|
+
return e && I(t.prototype, e), r && I(t, r), Object.defineProperty(t, "prototype", {
|
|
747
745
|
writable: !1
|
|
748
746
|
}), t;
|
|
749
747
|
}
|
|
750
748
|
function R(t, e, r) {
|
|
751
|
-
return (e =
|
|
749
|
+
return (e = C(e)) in t ? Object.defineProperty(t, e, {
|
|
752
750
|
value: r,
|
|
753
751
|
enumerable: !0,
|
|
754
752
|
configurable: !0,
|
|
755
753
|
writable: !0
|
|
756
754
|
}) : t[e] = r, t;
|
|
757
755
|
}
|
|
758
|
-
function
|
|
756
|
+
function C(t) {
|
|
759
757
|
var e = function(t, e) {
|
|
760
|
-
if ("object" !=
|
|
758
|
+
if ("object" != x(t) || !t) return t;
|
|
761
759
|
var r = t[Symbol.toPrimitive];
|
|
762
760
|
if (void 0 !== r) {
|
|
763
761
|
var n = r.call(t, e || "default");
|
|
764
|
-
if ("object" !=
|
|
762
|
+
if ("object" != x(n)) return n;
|
|
765
763
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
766
764
|
}
|
|
767
765
|
return ("string" === e ? String : Number)(t);
|
|
768
766
|
}(t, "string");
|
|
769
|
-
return "symbol" ==
|
|
767
|
+
return "symbol" == x(e) ? e : e + "";
|
|
770
768
|
}
|
|
771
|
-
var
|
|
772
|
-
return
|
|
769
|
+
var F = function() {
|
|
770
|
+
return D((function t() {
|
|
773
771
|
M(this, t), R(this, "previousHighest", void 0), R(this, "highest", void 0), R(this, "previousLowest", void 0),
|
|
774
772
|
R(this, "lowest", void 0), R(this, "previousResult", void 0), R(this, "result", void 0);
|
|
775
773
|
}), [ {
|
|
@@ -800,37 +798,37 @@ var OHLCV_INDICATORS;
|
|
|
800
798
|
} ]);
|
|
801
799
|
}();
|
|
802
800
|
// ./node_modules/trading-signals/dist/MA/MovingAverage.js
|
|
803
|
-
function
|
|
804
|
-
return
|
|
801
|
+
function L(t) {
|
|
802
|
+
return L = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
805
803
|
return typeof t;
|
|
806
804
|
} : function(t) {
|
|
807
805
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
808
|
-
},
|
|
806
|
+
}, L(t);
|
|
809
807
|
}
|
|
810
|
-
function
|
|
808
|
+
function B(t, e) {
|
|
811
809
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
812
810
|
}
|
|
813
811
|
function H(t, e) {
|
|
814
812
|
for (var r = 0; r < e.length; r++) {
|
|
815
813
|
var n = e[r];
|
|
816
814
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
817
|
-
Object.defineProperty(t,
|
|
815
|
+
Object.defineProperty(t, K(n.key), n);
|
|
818
816
|
}
|
|
819
817
|
}
|
|
820
|
-
function
|
|
818
|
+
function V(t, e, r) {
|
|
821
819
|
return e && H(t.prototype, e), r && H(t, r), Object.defineProperty(t, "prototype", {
|
|
822
820
|
writable: !1
|
|
823
821
|
}), t;
|
|
824
822
|
}
|
|
825
|
-
function
|
|
826
|
-
return e =
|
|
827
|
-
if (e && ("object" ==
|
|
823
|
+
function U(t, e, r) {
|
|
824
|
+
return e = $(e), function(t, e) {
|
|
825
|
+
if (e && ("object" == L(e) || "function" == typeof e)) return e;
|
|
828
826
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
829
827
|
return function(t) {
|
|
830
828
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
831
829
|
return t;
|
|
832
830
|
}(t);
|
|
833
|
-
}(t, q() ? Reflect.construct(e, r || [],
|
|
831
|
+
}(t, q() ? Reflect.construct(e, r || [], $(t).constructor) : e.apply(t, r));
|
|
834
832
|
}
|
|
835
833
|
function q() {
|
|
836
834
|
try {
|
|
@@ -840,12 +838,12 @@ var OHLCV_INDICATORS;
|
|
|
840
838
|
return !!t;
|
|
841
839
|
})();
|
|
842
840
|
}
|
|
843
|
-
function
|
|
844
|
-
return
|
|
841
|
+
function $(t) {
|
|
842
|
+
return $ = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
845
843
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
846
|
-
},
|
|
844
|
+
}, $(t);
|
|
847
845
|
}
|
|
848
|
-
function
|
|
846
|
+
function z(t, e) {
|
|
849
847
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
850
848
|
t.prototype = Object.create(e && e.prototype, {
|
|
851
849
|
constructor: {
|
|
@@ -855,40 +853,40 @@ var OHLCV_INDICATORS;
|
|
|
855
853
|
}
|
|
856
854
|
}), Object.defineProperty(t, "prototype", {
|
|
857
855
|
writable: !1
|
|
858
|
-
}), e &&
|
|
856
|
+
}), e && G(t, e);
|
|
859
857
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
858
|
+
function G(t, e) {
|
|
859
|
+
return G = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
862
860
|
return t.__proto__ = e, t;
|
|
863
|
-
},
|
|
861
|
+
}, G(t, e);
|
|
864
862
|
}
|
|
865
|
-
function
|
|
866
|
-
return (e =
|
|
863
|
+
function Y(t, e, r) {
|
|
864
|
+
return (e = K(e)) in t ? Object.defineProperty(t, e, {
|
|
867
865
|
value: r,
|
|
868
866
|
enumerable: !0,
|
|
869
867
|
configurable: !0,
|
|
870
868
|
writable: !0
|
|
871
869
|
}) : t[e] = r, t;
|
|
872
870
|
}
|
|
873
|
-
function
|
|
871
|
+
function K(t) {
|
|
874
872
|
var e = function(t, e) {
|
|
875
|
-
if ("object" !=
|
|
873
|
+
if ("object" != L(t) || !t) return t;
|
|
876
874
|
var r = t[Symbol.toPrimitive];
|
|
877
875
|
if (void 0 !== r) {
|
|
878
876
|
var n = r.call(t, e || "default");
|
|
879
|
-
if ("object" !=
|
|
877
|
+
if ("object" != L(n)) return n;
|
|
880
878
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
881
879
|
}
|
|
882
880
|
return ("string" === e ? String : Number)(t);
|
|
883
881
|
}(t, "string");
|
|
884
|
-
return "symbol" ==
|
|
882
|
+
return "symbol" == L(e) ? e : e + "";
|
|
885
883
|
}
|
|
886
|
-
var
|
|
884
|
+
var J = function(t) {
|
|
887
885
|
function e(t) {
|
|
888
886
|
var r;
|
|
889
|
-
return
|
|
887
|
+
return B(this, e), Y(r = U(this, e), "interval", void 0), r.interval = t, r;
|
|
890
888
|
}
|
|
891
|
-
return
|
|
889
|
+
return z(e, t), V(e, [ {
|
|
892
890
|
key: "updates",
|
|
893
891
|
value: function(t) {
|
|
894
892
|
var e = this;
|
|
@@ -902,54 +900,54 @@ var OHLCV_INDICATORS;
|
|
|
902
900
|
return this.update(t, !0);
|
|
903
901
|
}
|
|
904
902
|
} ]);
|
|
905
|
-
}(
|
|
903
|
+
}(F);
|
|
906
904
|
// ./node_modules/trading-signals/dist/SMA/SMA.js
|
|
907
|
-
function
|
|
908
|
-
return
|
|
905
|
+
function Z(t) {
|
|
906
|
+
return Z = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
909
907
|
return typeof t;
|
|
910
908
|
} : function(t) {
|
|
911
909
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
912
|
-
},
|
|
910
|
+
}, Z(t);
|
|
913
911
|
}
|
|
914
|
-
function
|
|
912
|
+
function Q(t, e) {
|
|
915
913
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
916
914
|
}
|
|
917
|
-
function
|
|
915
|
+
function W(t, e) {
|
|
918
916
|
for (var r = 0; r < e.length; r++) {
|
|
919
917
|
var n = e[r];
|
|
920
918
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
921
|
-
Object.defineProperty(t,
|
|
919
|
+
Object.defineProperty(t, at(n.key), n);
|
|
922
920
|
}
|
|
923
921
|
}
|
|
924
|
-
function
|
|
925
|
-
return e &&
|
|
922
|
+
function X(t, e, r) {
|
|
923
|
+
return e && W(t.prototype, e), r && W(t, r), Object.defineProperty(t, "prototype", {
|
|
926
924
|
writable: !1
|
|
927
925
|
}), t;
|
|
928
926
|
}
|
|
929
|
-
function
|
|
930
|
-
return e =
|
|
931
|
-
if (e && ("object" ==
|
|
927
|
+
function tt(t, e, r) {
|
|
928
|
+
return e = rt(e), function(t, e) {
|
|
929
|
+
if (e && ("object" == Z(e) || "function" == typeof e)) return e;
|
|
932
930
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
933
931
|
return function(t) {
|
|
934
932
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
935
933
|
return t;
|
|
936
934
|
}(t);
|
|
937
|
-
}(t,
|
|
935
|
+
}(t, et() ? Reflect.construct(e, r || [], rt(t).constructor) : e.apply(t, r));
|
|
938
936
|
}
|
|
939
|
-
function
|
|
937
|
+
function et() {
|
|
940
938
|
try {
|
|
941
939
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
942
940
|
} catch (t) {}
|
|
943
|
-
return (
|
|
941
|
+
return (et = function() {
|
|
944
942
|
return !!t;
|
|
945
943
|
})();
|
|
946
944
|
}
|
|
947
|
-
function
|
|
948
|
-
return
|
|
945
|
+
function rt(t) {
|
|
946
|
+
return rt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
949
947
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
950
|
-
},
|
|
948
|
+
}, rt(t);
|
|
951
949
|
}
|
|
952
|
-
function
|
|
950
|
+
function nt(t, e) {
|
|
953
951
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
954
952
|
t.prototype = Object.create(e && e.prototype, {
|
|
955
953
|
constructor: {
|
|
@@ -959,42 +957,42 @@ var OHLCV_INDICATORS;
|
|
|
959
957
|
}
|
|
960
958
|
}), Object.defineProperty(t, "prototype", {
|
|
961
959
|
writable: !1
|
|
962
|
-
}), e &&
|
|
960
|
+
}), e && ot(t, e);
|
|
963
961
|
}
|
|
964
|
-
function
|
|
965
|
-
return
|
|
962
|
+
function ot(t, e) {
|
|
963
|
+
return ot = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
966
964
|
return t.__proto__ = e, t;
|
|
967
|
-
},
|
|
965
|
+
}, ot(t, e);
|
|
968
966
|
}
|
|
969
|
-
function
|
|
970
|
-
return (e =
|
|
967
|
+
function it(t, e, r) {
|
|
968
|
+
return (e = at(e)) in t ? Object.defineProperty(t, e, {
|
|
971
969
|
value: r,
|
|
972
970
|
enumerable: !0,
|
|
973
971
|
configurable: !0,
|
|
974
972
|
writable: !0
|
|
975
973
|
}) : t[e] = r, t;
|
|
976
974
|
}
|
|
977
|
-
function
|
|
975
|
+
function at(t) {
|
|
978
976
|
var e = function(t, e) {
|
|
979
|
-
if ("object" !=
|
|
977
|
+
if ("object" != Z(t) || !t) return t;
|
|
980
978
|
var r = t[Symbol.toPrimitive];
|
|
981
979
|
if (void 0 !== r) {
|
|
982
980
|
var n = r.call(t, e || "default");
|
|
983
|
-
if ("object" !=
|
|
981
|
+
if ("object" != Z(n)) return n;
|
|
984
982
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
985
983
|
}
|
|
986
984
|
return ("string" === e ? String : Number)(t);
|
|
987
985
|
}(t, "string");
|
|
988
|
-
return "symbol" ==
|
|
986
|
+
return "symbol" == Z(e) ? e : e + "";
|
|
989
987
|
}
|
|
990
|
-
var
|
|
988
|
+
var ut = function(t) {
|
|
991
989
|
function e() {
|
|
992
990
|
var t;
|
|
993
|
-
|
|
991
|
+
Q(this, e);
|
|
994
992
|
for (var r = arguments.length, n = new Array(r), o = 0; o < r; o++) n[o] = arguments[o];
|
|
995
|
-
return
|
|
993
|
+
return it(t = tt(this, e, [].concat(n)), "prices", []), t;
|
|
996
994
|
}
|
|
997
|
-
return
|
|
995
|
+
return nt(e, t), X(e, [ {
|
|
998
996
|
key: "update",
|
|
999
997
|
value: function(t) {
|
|
1000
998
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1007,7 +1005,7 @@ var OHLCV_INDICATORS;
|
|
|
1007
1005
|
}
|
|
1008
1006
|
}
|
|
1009
1007
|
} ]);
|
|
1010
|
-
}(
|
|
1008
|
+
}(J);
|
|
1011
1009
|
// ./node_modules/trading-signals/dist/WSMA/WSMA.js
|
|
1012
1010
|
function ct(t) {
|
|
1013
1011
|
return ct = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
@@ -1016,45 +1014,45 @@ var OHLCV_INDICATORS;
|
|
|
1016
1014
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1017
1015
|
}, ct(t);
|
|
1018
1016
|
}
|
|
1019
|
-
function
|
|
1017
|
+
function lt(t, e) {
|
|
1020
1018
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1021
1019
|
}
|
|
1022
|
-
function
|
|
1020
|
+
function st(t, e) {
|
|
1023
1021
|
for (var r = 0; r < e.length; r++) {
|
|
1024
1022
|
var n = e[r];
|
|
1025
1023
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1026
|
-
Object.defineProperty(t,
|
|
1024
|
+
Object.defineProperty(t, bt(n.key), n);
|
|
1027
1025
|
}
|
|
1028
1026
|
}
|
|
1029
|
-
function
|
|
1030
|
-
return e &&
|
|
1027
|
+
function ft(t, e, r) {
|
|
1028
|
+
return e && st(t.prototype, e), r && st(t, r), Object.defineProperty(t, "prototype", {
|
|
1031
1029
|
writable: !1
|
|
1032
1030
|
}), t;
|
|
1033
1031
|
}
|
|
1034
|
-
function
|
|
1035
|
-
return e =
|
|
1032
|
+
function yt(t, e, r) {
|
|
1033
|
+
return e = pt(e), function(t, e) {
|
|
1036
1034
|
if (e && ("object" == ct(e) || "function" == typeof e)) return e;
|
|
1037
1035
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1038
1036
|
return function(t) {
|
|
1039
1037
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1040
1038
|
return t;
|
|
1041
1039
|
}(t);
|
|
1042
|
-
}(t,
|
|
1040
|
+
}(t, ht() ? Reflect.construct(e, r || [], pt(t).constructor) : e.apply(t, r));
|
|
1043
1041
|
}
|
|
1044
|
-
function
|
|
1042
|
+
function ht() {
|
|
1045
1043
|
try {
|
|
1046
1044
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1047
1045
|
} catch (t) {}
|
|
1048
|
-
return (
|
|
1046
|
+
return (ht = function() {
|
|
1049
1047
|
return !!t;
|
|
1050
1048
|
})();
|
|
1051
1049
|
}
|
|
1052
|
-
function
|
|
1053
|
-
return
|
|
1050
|
+
function pt(t) {
|
|
1051
|
+
return pt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1054
1052
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1055
|
-
},
|
|
1053
|
+
}, pt(t);
|
|
1056
1054
|
}
|
|
1057
|
-
function
|
|
1055
|
+
function vt(t, e) {
|
|
1058
1056
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1059
1057
|
t.prototype = Object.create(e && e.prototype, {
|
|
1060
1058
|
constructor: {
|
|
@@ -1071,15 +1069,15 @@ var OHLCV_INDICATORS;
|
|
|
1071
1069
|
return t.__proto__ = e, t;
|
|
1072
1070
|
}, mt(t, e);
|
|
1073
1071
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return (e =
|
|
1072
|
+
function dt(t, e, r) {
|
|
1073
|
+
return (e = bt(e)) in t ? Object.defineProperty(t, e, {
|
|
1076
1074
|
value: r,
|
|
1077
1075
|
enumerable: !0,
|
|
1078
1076
|
configurable: !0,
|
|
1079
1077
|
writable: !0
|
|
1080
1078
|
}) : t[e] = r, t;
|
|
1081
1079
|
}
|
|
1082
|
-
function
|
|
1080
|
+
function bt(t) {
|
|
1083
1081
|
var e = function(t, e) {
|
|
1084
1082
|
if ("object" != ct(t) || !t) return t;
|
|
1085
1083
|
var r = t[Symbol.toPrimitive];
|
|
@@ -1092,14 +1090,14 @@ var OHLCV_INDICATORS;
|
|
|
1092
1090
|
}(t, "string");
|
|
1093
1091
|
return "symbol" == ct(e) ? e : e + "";
|
|
1094
1092
|
}
|
|
1095
|
-
var
|
|
1093
|
+
var gt = function(t) {
|
|
1096
1094
|
function e(t) {
|
|
1097
1095
|
var r;
|
|
1098
|
-
return
|
|
1099
|
-
|
|
1096
|
+
return lt(this, e), dt(r = yt(this, e), "interval", void 0), dt(r, "indicator", void 0),
|
|
1097
|
+
dt(r, "smoothingFactor", void 0), r.interval = t, r.indicator = new ut(t), r.smoothingFactor = 1 / r.interval,
|
|
1100
1098
|
r;
|
|
1101
1099
|
}
|
|
1102
|
-
return
|
|
1100
|
+
return vt(e, t), ft(e, [ {
|
|
1103
1101
|
key: "updates",
|
|
1104
1102
|
value: function(t) {
|
|
1105
1103
|
var e = this;
|
|
@@ -1122,68 +1120,68 @@ var OHLCV_INDICATORS;
|
|
|
1122
1120
|
if (void 0 === this.result && void 0 !== r) return this.setResult(r, e);
|
|
1123
1121
|
}
|
|
1124
1122
|
} ]);
|
|
1125
|
-
}(
|
|
1126
|
-
function
|
|
1123
|
+
}(F);
|
|
1124
|
+
function wt(t) {
|
|
1127
1125
|
return t.length ? t.reduce((function(t, e) {
|
|
1128
1126
|
return t + e;
|
|
1129
1127
|
}), 0) / t.length : 0;
|
|
1130
1128
|
}
|
|
1131
1129
|
// ./node_modules/trading-signals/dist/BBANDS/BollingerBands.js
|
|
1132
|
-
function
|
|
1133
|
-
return
|
|
1130
|
+
function Ot(t) {
|
|
1131
|
+
return Ot = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1134
1132
|
return typeof t;
|
|
1135
1133
|
} : function(t) {
|
|
1136
1134
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1137
|
-
},
|
|
1135
|
+
}, Ot(t);
|
|
1138
1136
|
}
|
|
1139
|
-
function
|
|
1137
|
+
function St(t, e) {
|
|
1140
1138
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1141
1139
|
}
|
|
1142
|
-
function
|
|
1140
|
+
function jt(t, e) {
|
|
1143
1141
|
for (var r = 0; r < e.length; r++) {
|
|
1144
1142
|
var n = e[r];
|
|
1145
1143
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1146
|
-
Object.defineProperty(t,
|
|
1144
|
+
Object.defineProperty(t, Nt(n.key), n);
|
|
1147
1145
|
}
|
|
1148
1146
|
}
|
|
1149
|
-
function
|
|
1150
|
-
return e &&
|
|
1147
|
+
function Pt(t, e, r) {
|
|
1148
|
+
return e && jt(t.prototype, e), r && jt(t, r), Object.defineProperty(t, "prototype", {
|
|
1151
1149
|
writable: !1
|
|
1152
1150
|
}), t;
|
|
1153
1151
|
}
|
|
1154
|
-
function
|
|
1155
|
-
return (e =
|
|
1152
|
+
function _t(t, e, r) {
|
|
1153
|
+
return (e = Nt(e)) in t ? Object.defineProperty(t, e, {
|
|
1156
1154
|
value: r,
|
|
1157
1155
|
enumerable: !0,
|
|
1158
1156
|
configurable: !0,
|
|
1159
1157
|
writable: !0
|
|
1160
1158
|
}) : t[e] = r, t;
|
|
1161
1159
|
}
|
|
1162
|
-
function
|
|
1160
|
+
function Nt(t) {
|
|
1163
1161
|
var e = function(t, e) {
|
|
1164
|
-
if ("object" !=
|
|
1162
|
+
if ("object" != Ot(t) || !t) return t;
|
|
1165
1163
|
var r = t[Symbol.toPrimitive];
|
|
1166
1164
|
if (void 0 !== r) {
|
|
1167
1165
|
var n = r.call(t, e || "default");
|
|
1168
|
-
if ("object" !=
|
|
1166
|
+
if ("object" != Ot(n)) return n;
|
|
1169
1167
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1170
1168
|
}
|
|
1171
1169
|
return ("string" === e ? String : Number)(t);
|
|
1172
1170
|
}(t, "string");
|
|
1173
|
-
return "symbol" ==
|
|
1171
|
+
return "symbol" == Ot(e) ? e : e + "";
|
|
1174
1172
|
}
|
|
1175
|
-
var
|
|
1176
|
-
return
|
|
1173
|
+
var Tt = function() {
|
|
1174
|
+
return Pt((function t(e) {
|
|
1177
1175
|
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2;
|
|
1178
|
-
|
|
1179
|
-
|
|
1176
|
+
St(this, t), _t(this, "interval", void 0), _t(this, "deviationMultiplier", void 0),
|
|
1177
|
+
_t(this, "prices", []), _t(this, "result", void 0), this.interval = e, this.deviationMultiplier = r;
|
|
1180
1178
|
}), [ {
|
|
1181
1179
|
key: "update",
|
|
1182
1180
|
value: function(t) {
|
|
1183
1181
|
if (this.prices.push(t), this.prices.length > this.interval) {
|
|
1184
1182
|
this.prices.shift();
|
|
1185
|
-
var e =
|
|
1186
|
-
var r = e ||
|
|
1183
|
+
var e = wt(this.prices), r = function(t, e) {
|
|
1184
|
+
var r = e || wt(t), n = wt(t.map((function(t) {
|
|
1187
1185
|
return t - r;
|
|
1188
1186
|
})).map((function(t) {
|
|
1189
1187
|
return t * t;
|
|
@@ -1211,50 +1209,50 @@ var OHLCV_INDICATORS;
|
|
|
1211
1209
|
} ]);
|
|
1212
1210
|
}();
|
|
1213
1211
|
// ./node_modules/trading-signals/dist/EMA/EMA.js
|
|
1214
|
-
function
|
|
1215
|
-
return
|
|
1212
|
+
function At(t) {
|
|
1213
|
+
return At = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1216
1214
|
return typeof t;
|
|
1217
1215
|
} : function(t) {
|
|
1218
1216
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1219
|
-
},
|
|
1217
|
+
}, At(t);
|
|
1220
1218
|
}
|
|
1221
|
-
function
|
|
1219
|
+
function Et(t, e) {
|
|
1222
1220
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1223
1221
|
}
|
|
1224
1222
|
function kt(t, e) {
|
|
1225
1223
|
for (var r = 0; r < e.length; r++) {
|
|
1226
1224
|
var n = e[r];
|
|
1227
1225
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1228
|
-
Object.defineProperty(t,
|
|
1226
|
+
Object.defineProperty(t, Lt(n.key), n);
|
|
1229
1227
|
}
|
|
1230
1228
|
}
|
|
1231
|
-
function
|
|
1229
|
+
function xt(t, e, r) {
|
|
1232
1230
|
return e && kt(t.prototype, e), r && kt(t, r), Object.defineProperty(t, "prototype", {
|
|
1233
1231
|
writable: !1
|
|
1234
1232
|
}), t;
|
|
1235
1233
|
}
|
|
1236
1234
|
function Mt(t, e, r) {
|
|
1237
|
-
return e =
|
|
1238
|
-
if (e && ("object" ==
|
|
1235
|
+
return e = Dt(e), function(t, e) {
|
|
1236
|
+
if (e && ("object" == At(e) || "function" == typeof e)) return e;
|
|
1239
1237
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1240
1238
|
return function(t) {
|
|
1241
1239
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1242
1240
|
return t;
|
|
1243
1241
|
}(t);
|
|
1244
|
-
}(t,
|
|
1242
|
+
}(t, It() ? Reflect.construct(e, r || [], Dt(t).constructor) : e.apply(t, r));
|
|
1245
1243
|
}
|
|
1246
|
-
function
|
|
1244
|
+
function It() {
|
|
1247
1245
|
try {
|
|
1248
1246
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1249
1247
|
} catch (t) {}
|
|
1250
|
-
return (
|
|
1248
|
+
return (It = function() {
|
|
1251
1249
|
return !!t;
|
|
1252
1250
|
})();
|
|
1253
1251
|
}
|
|
1254
|
-
function
|
|
1255
|
-
return
|
|
1252
|
+
function Dt(t) {
|
|
1253
|
+
return Dt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1256
1254
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1257
|
-
},
|
|
1255
|
+
}, Dt(t);
|
|
1258
1256
|
}
|
|
1259
1257
|
function Rt(t, e) {
|
|
1260
1258
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -1266,42 +1264,42 @@ var OHLCV_INDICATORS;
|
|
|
1266
1264
|
}
|
|
1267
1265
|
}), Object.defineProperty(t, "prototype", {
|
|
1268
1266
|
writable: !1
|
|
1269
|
-
}), e &&
|
|
1267
|
+
}), e && Ct(t, e);
|
|
1270
1268
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return
|
|
1269
|
+
function Ct(t, e) {
|
|
1270
|
+
return Ct = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1273
1271
|
return t.__proto__ = e, t;
|
|
1274
|
-
},
|
|
1272
|
+
}, Ct(t, e);
|
|
1275
1273
|
}
|
|
1276
|
-
function
|
|
1277
|
-
return (e =
|
|
1274
|
+
function Ft(t, e, r) {
|
|
1275
|
+
return (e = Lt(e)) in t ? Object.defineProperty(t, e, {
|
|
1278
1276
|
value: r,
|
|
1279
1277
|
enumerable: !0,
|
|
1280
1278
|
configurable: !0,
|
|
1281
1279
|
writable: !0
|
|
1282
1280
|
}) : t[e] = r, t;
|
|
1283
1281
|
}
|
|
1284
|
-
function
|
|
1282
|
+
function Lt(t) {
|
|
1285
1283
|
var e = function(t, e) {
|
|
1286
|
-
if ("object" !=
|
|
1284
|
+
if ("object" != At(t) || !t) return t;
|
|
1287
1285
|
var r = t[Symbol.toPrimitive];
|
|
1288
1286
|
if (void 0 !== r) {
|
|
1289
1287
|
var n = r.call(t, e || "default");
|
|
1290
|
-
if ("object" !=
|
|
1288
|
+
if ("object" != At(n)) return n;
|
|
1291
1289
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1292
1290
|
}
|
|
1293
1291
|
return ("string" === e ? String : Number)(t);
|
|
1294
1292
|
}(t, "string");
|
|
1295
|
-
return "symbol" ==
|
|
1293
|
+
return "symbol" == At(e) ? e : e + "";
|
|
1296
1294
|
}
|
|
1297
|
-
var
|
|
1295
|
+
var Bt = function(t) {
|
|
1298
1296
|
function e(t) {
|
|
1299
1297
|
var r;
|
|
1300
|
-
return
|
|
1301
|
-
|
|
1298
|
+
return Et(this, e), Ft(r = Mt(this, e, [ t ]), "interval", void 0), Ft(r, "pricesCounter", 0),
|
|
1299
|
+
Ft(r, "weightFactor", void 0), r.interval = t, r.weightFactor = 2 / (r.interval + 1),
|
|
1302
1300
|
r;
|
|
1303
1301
|
}
|
|
1304
|
-
return Rt(e, t),
|
|
1302
|
+
return Rt(e, t), xt(e, [ {
|
|
1305
1303
|
key: "update",
|
|
1306
1304
|
value: function(t) {
|
|
1307
1305
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1324,7 +1322,7 @@ var OHLCV_INDICATORS;
|
|
|
1324
1322
|
}
|
|
1325
1323
|
}
|
|
1326
1324
|
} ]);
|
|
1327
|
-
}(
|
|
1325
|
+
}(J);
|
|
1328
1326
|
// ./node_modules/trading-signals/dist/MACD/MACD.js
|
|
1329
1327
|
function Ht(t) {
|
|
1330
1328
|
return Ht = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
@@ -1333,30 +1331,30 @@ var OHLCV_INDICATORS;
|
|
|
1333
1331
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1334
1332
|
}, Ht(t);
|
|
1335
1333
|
}
|
|
1336
|
-
function
|
|
1334
|
+
function Vt(t, e) {
|
|
1337
1335
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1338
1336
|
}
|
|
1339
|
-
function
|
|
1337
|
+
function Ut(t, e) {
|
|
1340
1338
|
for (var r = 0; r < e.length; r++) {
|
|
1341
1339
|
var n = e[r];
|
|
1342
1340
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1343
|
-
Object.defineProperty(t,
|
|
1341
|
+
Object.defineProperty(t, zt(n.key), n);
|
|
1344
1342
|
}
|
|
1345
1343
|
}
|
|
1346
1344
|
function qt(t, e, r) {
|
|
1347
|
-
return e &&
|
|
1345
|
+
return e && Ut(t.prototype, e), r && Ut(t, r), Object.defineProperty(t, "prototype", {
|
|
1348
1346
|
writable: !1
|
|
1349
1347
|
}), t;
|
|
1350
1348
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return (e =
|
|
1349
|
+
function $t(t, e, r) {
|
|
1350
|
+
return (e = zt(e)) in t ? Object.defineProperty(t, e, {
|
|
1353
1351
|
value: r,
|
|
1354
1352
|
enumerable: !0,
|
|
1355
1353
|
configurable: !0,
|
|
1356
1354
|
writable: !0
|
|
1357
1355
|
}) : t[e] = r, t;
|
|
1358
1356
|
}
|
|
1359
|
-
function
|
|
1357
|
+
function zt(t) {
|
|
1360
1358
|
var e = function(t, e) {
|
|
1361
1359
|
if ("object" != Ht(t) || !t) return t;
|
|
1362
1360
|
var r = t[Symbol.toPrimitive];
|
|
@@ -1369,10 +1367,10 @@ var OHLCV_INDICATORS;
|
|
|
1369
1367
|
}(t, "string");
|
|
1370
1368
|
return "symbol" == Ht(e) ? e : e + "";
|
|
1371
1369
|
}
|
|
1372
|
-
var
|
|
1370
|
+
var Gt = function() {
|
|
1373
1371
|
return qt((function t(e, r, n) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1372
|
+
Vt(this, t), $t(this, "short", void 0), $t(this, "long", void 0), $t(this, "signal", void 0),
|
|
1373
|
+
$t(this, "prices", []), $t(this, "result", void 0), this.short = e, this.long = r,
|
|
1376
1374
|
this.signal = n;
|
|
1377
1375
|
}), [ {
|
|
1378
1376
|
key: "getResult",
|
|
@@ -1403,52 +1401,52 @@ var OHLCV_INDICATORS;
|
|
|
1403
1401
|
} ]);
|
|
1404
1402
|
}();
|
|
1405
1403
|
// ./node_modules/trading-signals/dist/RSI/RSI.js
|
|
1406
|
-
function
|
|
1407
|
-
return
|
|
1404
|
+
function Yt(t) {
|
|
1405
|
+
return Yt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1408
1406
|
return typeof t;
|
|
1409
1407
|
} : function(t) {
|
|
1410
1408
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1411
|
-
},
|
|
1409
|
+
}, Yt(t);
|
|
1412
1410
|
}
|
|
1413
|
-
function
|
|
1411
|
+
function Kt(t, e) {
|
|
1414
1412
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1415
1413
|
}
|
|
1416
|
-
function
|
|
1414
|
+
function Jt(t, e) {
|
|
1417
1415
|
for (var r = 0; r < e.length; r++) {
|
|
1418
1416
|
var n = e[r];
|
|
1419
1417
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1420
|
-
Object.defineProperty(t,
|
|
1418
|
+
Object.defineProperty(t, ne(n.key), n);
|
|
1421
1419
|
}
|
|
1422
1420
|
}
|
|
1423
|
-
function
|
|
1424
|
-
return e &&
|
|
1421
|
+
function Zt(t, e, r) {
|
|
1422
|
+
return e && Jt(t.prototype, e), r && Jt(t, r), Object.defineProperty(t, "prototype", {
|
|
1425
1423
|
writable: !1
|
|
1426
1424
|
}), t;
|
|
1427
1425
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return e =
|
|
1430
|
-
if (e && ("object" ==
|
|
1426
|
+
function Qt(t, e, r) {
|
|
1427
|
+
return e = Xt(e), function(t, e) {
|
|
1428
|
+
if (e && ("object" == Yt(e) || "function" == typeof e)) return e;
|
|
1431
1429
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1432
1430
|
return function(t) {
|
|
1433
1431
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1434
1432
|
return t;
|
|
1435
1433
|
}(t);
|
|
1436
|
-
}(t,
|
|
1434
|
+
}(t, Wt() ? Reflect.construct(e, r || [], Xt(t).constructor) : e.apply(t, r));
|
|
1437
1435
|
}
|
|
1438
|
-
function
|
|
1436
|
+
function Wt() {
|
|
1439
1437
|
try {
|
|
1440
1438
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1441
1439
|
} catch (t) {}
|
|
1442
|
-
return (
|
|
1440
|
+
return (Wt = function() {
|
|
1443
1441
|
return !!t;
|
|
1444
1442
|
})();
|
|
1445
1443
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return
|
|
1444
|
+
function Xt(t) {
|
|
1445
|
+
return Xt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1448
1446
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1449
|
-
},
|
|
1447
|
+
}, Xt(t);
|
|
1450
1448
|
}
|
|
1451
|
-
function
|
|
1449
|
+
function te(t, e) {
|
|
1452
1450
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1453
1451
|
t.prototype = Object.create(e && e.prototype, {
|
|
1454
1452
|
constructor: {
|
|
@@ -1458,42 +1456,42 @@ var OHLCV_INDICATORS;
|
|
|
1458
1456
|
}
|
|
1459
1457
|
}), Object.defineProperty(t, "prototype", {
|
|
1460
1458
|
writable: !1
|
|
1461
|
-
}), e &&
|
|
1459
|
+
}), e && ee(t, e);
|
|
1462
1460
|
}
|
|
1463
|
-
function
|
|
1464
|
-
return
|
|
1461
|
+
function ee(t, e) {
|
|
1462
|
+
return ee = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1465
1463
|
return t.__proto__ = e, t;
|
|
1466
|
-
},
|
|
1464
|
+
}, ee(t, e);
|
|
1467
1465
|
}
|
|
1468
|
-
function
|
|
1469
|
-
return (e =
|
|
1466
|
+
function re(t, e, r) {
|
|
1467
|
+
return (e = ne(e)) in t ? Object.defineProperty(t, e, {
|
|
1470
1468
|
value: r,
|
|
1471
1469
|
enumerable: !0,
|
|
1472
1470
|
configurable: !0,
|
|
1473
1471
|
writable: !0
|
|
1474
1472
|
}) : t[e] = r, t;
|
|
1475
1473
|
}
|
|
1476
|
-
function
|
|
1474
|
+
function ne(t) {
|
|
1477
1475
|
var e = function(t, e) {
|
|
1478
|
-
if ("object" !=
|
|
1476
|
+
if ("object" != Yt(t) || !t) return t;
|
|
1479
1477
|
var r = t[Symbol.toPrimitive];
|
|
1480
1478
|
if (void 0 !== r) {
|
|
1481
1479
|
var n = r.call(t, e || "default");
|
|
1482
|
-
if ("object" !=
|
|
1480
|
+
if ("object" != Yt(n)) return n;
|
|
1483
1481
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1484
1482
|
}
|
|
1485
1483
|
return ("string" === e ? String : Number)(t);
|
|
1486
1484
|
}(t, "string");
|
|
1487
|
-
return "symbol" ==
|
|
1485
|
+
return "symbol" == Yt(e) ? e : e + "";
|
|
1488
1486
|
}
|
|
1489
|
-
var
|
|
1487
|
+
var oe = function(t) {
|
|
1490
1488
|
function e(t) {
|
|
1491
|
-
var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] :
|
|
1492
|
-
return
|
|
1493
|
-
|
|
1489
|
+
var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : gt;
|
|
1490
|
+
return Kt(this, e), re(r = Qt(this, e), "interval", void 0), re(r, "previousPrices", []),
|
|
1491
|
+
re(r, "avgGain", void 0), re(r, "avgLoss", void 0), re(r, "maxValue", 100), r.interval = t,
|
|
1494
1492
|
r.avgGain = new n(r.interval), r.avgLoss = new n(r.interval), r;
|
|
1495
1493
|
}
|
|
1496
|
-
return
|
|
1494
|
+
return te(e, t), Zt(e, [ {
|
|
1497
1495
|
key: "update",
|
|
1498
1496
|
value: function(t) {
|
|
1499
1497
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1510,28 +1508,28 @@ var OHLCV_INDICATORS;
|
|
|
1510
1508
|
}
|
|
1511
1509
|
}
|
|
1512
1510
|
} ]);
|
|
1513
|
-
}(
|
|
1511
|
+
}(F);
|
|
1514
1512
|
// ./src/oscillators/rsi.js
|
|
1515
|
-
function
|
|
1516
|
-
return
|
|
1513
|
+
function ie(t) {
|
|
1514
|
+
return ie = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1517
1515
|
return typeof t;
|
|
1518
1516
|
} : function(t) {
|
|
1519
1517
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1520
|
-
},
|
|
1518
|
+
}, ie(t);
|
|
1521
1519
|
}
|
|
1522
|
-
function
|
|
1520
|
+
function ae(t, e, r) {
|
|
1523
1521
|
return (e = function(t) {
|
|
1524
1522
|
var e = function(t, e) {
|
|
1525
|
-
if ("object" !=
|
|
1523
|
+
if ("object" != ie(t) || !t) return t;
|
|
1526
1524
|
var r = t[Symbol.toPrimitive];
|
|
1527
1525
|
if (void 0 !== r) {
|
|
1528
1526
|
var n = r.call(t, e || "default");
|
|
1529
|
-
if ("object" !=
|
|
1527
|
+
if ("object" != ie(n)) return n;
|
|
1530
1528
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1531
1529
|
}
|
|
1532
1530
|
return ("string" === e ? String : Number)(t);
|
|
1533
1531
|
}(t, "string");
|
|
1534
|
-
return "symbol" ==
|
|
1532
|
+
return "symbol" == ie(e) ? e : e + "";
|
|
1535
1533
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1536
1534
|
value: r,
|
|
1537
1535
|
enumerable: !0,
|
|
@@ -1539,57 +1537,57 @@ var OHLCV_INDICATORS;
|
|
|
1539
1537
|
writable: !0
|
|
1540
1538
|
}) : t[e] = r, t;
|
|
1541
1539
|
}
|
|
1542
|
-
var
|
|
1543
|
-
ema:
|
|
1544
|
-
sma:
|
|
1540
|
+
var ue = {
|
|
1541
|
+
ema: Bt,
|
|
1542
|
+
sma: ut
|
|
1545
1543
|
}, ce = function(t, e, r, n, o) {
|
|
1546
|
-
var i = o.target, a = o.lag, u = t.verticalOhlcv,
|
|
1544
|
+
var i = o.target, a = o.lag, u = t.verticalOhlcv, c = t.instances, l = t.priceBased, s = "string" == typeof i && u.hasOwnProperty(i) && "close" !== i ? "_".concat(i) : "", f = "".concat(r, "_").concat(n).concat(s);
|
|
1547
1545
|
if (0 === e) {
|
|
1548
|
-
var
|
|
1546
|
+
var y = t.len, h = t.arrayTypes;
|
|
1549
1547
|
if (!u.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for ").concat(r, "."));
|
|
1550
1548
|
// Create the main moving average instance.
|
|
1551
|
-
|
|
1552
|
-
maInstance: new
|
|
1553
|
-
}, u[
|
|
1549
|
+
c[f] = {
|
|
1550
|
+
maInstance: new ue[r](n)
|
|
1551
|
+
}, u[f] = new Float64Array(y).fill(NaN), l.add(f), a > 0 && t.lag([ f ], a), h[f] = "Float64Array";
|
|
1554
1552
|
}
|
|
1555
1553
|
// Retrieve the current price value.
|
|
1556
|
-
var
|
|
1554
|
+
var p = u[i][e], v = c[f].maInstance;
|
|
1557
1555
|
// Update the moving average instance.
|
|
1558
|
-
v.update(
|
|
1559
|
-
var
|
|
1556
|
+
v.update(p);
|
|
1557
|
+
var m = NaN;
|
|
1560
1558
|
try {
|
|
1561
|
-
|
|
1559
|
+
m = v.getResult();
|
|
1562
1560
|
} catch (t) {
|
|
1563
|
-
|
|
1561
|
+
m = NaN;
|
|
1564
1562
|
}
|
|
1565
1563
|
// Always push the MA value (even if NaN).
|
|
1566
1564
|
return t.pushToMain({
|
|
1567
1565
|
index: e,
|
|
1568
|
-
key:
|
|
1569
|
-
value:
|
|
1566
|
+
key: f,
|
|
1567
|
+
value: m
|
|
1570
1568
|
}), !0;
|
|
1571
1569
|
};
|
|
1572
1570
|
// ./src/moving-averages/macd.js
|
|
1573
|
-
function
|
|
1574
|
-
return
|
|
1571
|
+
function le(t) {
|
|
1572
|
+
return le = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1575
1573
|
return typeof t;
|
|
1576
1574
|
} : function(t) {
|
|
1577
1575
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1578
|
-
},
|
|
1576
|
+
}, le(t);
|
|
1579
1577
|
}
|
|
1580
|
-
function
|
|
1578
|
+
function se(t, e, r) {
|
|
1581
1579
|
return (e = function(t) {
|
|
1582
1580
|
var e = function(t, e) {
|
|
1583
|
-
if ("object" !=
|
|
1581
|
+
if ("object" != le(t) || !t) return t;
|
|
1584
1582
|
var r = t[Symbol.toPrimitive];
|
|
1585
1583
|
if (void 0 !== r) {
|
|
1586
1584
|
var n = r.call(t, e || "default");
|
|
1587
|
-
if ("object" !=
|
|
1585
|
+
if ("object" != le(n)) return n;
|
|
1588
1586
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1589
1587
|
}
|
|
1590
1588
|
return ("string" === e ? String : Number)(t);
|
|
1591
1589
|
}(t, "string");
|
|
1592
|
-
return "symbol" ==
|
|
1590
|
+
return "symbol" == le(e) ? e : e + "";
|
|
1593
1591
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1594
1592
|
value: r,
|
|
1595
1593
|
enumerable: !0,
|
|
@@ -1597,16 +1595,16 @@ var OHLCV_INDICATORS;
|
|
|
1597
1595
|
writable: !0
|
|
1598
1596
|
}) : t[e] = r, t;
|
|
1599
1597
|
}
|
|
1600
|
-
var
|
|
1598
|
+
var fe = "close";
|
|
1601
1599
|
// ./src/moving-averages/donchianChannel.js
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1600
|
+
function ye(t) {
|
|
1601
|
+
return ye = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1604
1602
|
return typeof t;
|
|
1605
1603
|
} : function(t) {
|
|
1606
1604
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1607
|
-
},
|
|
1605
|
+
}, ye(t);
|
|
1608
1606
|
}
|
|
1609
|
-
function
|
|
1607
|
+
function he(t, e) {
|
|
1610
1608
|
var r = Object.keys(t);
|
|
1611
1609
|
if (Object.getOwnPropertySymbols) {
|
|
1612
1610
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -1616,19 +1614,19 @@ var OHLCV_INDICATORS;
|
|
|
1616
1614
|
}
|
|
1617
1615
|
return r;
|
|
1618
1616
|
}
|
|
1619
|
-
function
|
|
1617
|
+
function pe(t, e, r) {
|
|
1620
1618
|
return (e = function(t) {
|
|
1621
1619
|
var e = function(t, e) {
|
|
1622
|
-
if ("object" !=
|
|
1620
|
+
if ("object" != ye(t) || !t) return t;
|
|
1623
1621
|
var r = t[Symbol.toPrimitive];
|
|
1624
1622
|
if (void 0 !== r) {
|
|
1625
1623
|
var n = r.call(t, e || "default");
|
|
1626
|
-
if ("object" !=
|
|
1624
|
+
if ("object" != ye(n)) return n;
|
|
1627
1625
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1628
1626
|
}
|
|
1629
1627
|
return ("string" === e ? String : Number)(t);
|
|
1630
1628
|
}(t, "string");
|
|
1631
|
-
return "symbol" ==
|
|
1629
|
+
return "symbol" == ye(e) ? e : e + "";
|
|
1632
1630
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1633
1631
|
value: r,
|
|
1634
1632
|
enumerable: !0,
|
|
@@ -1636,7 +1634,7 @@ var OHLCV_INDICATORS;
|
|
|
1636
1634
|
writable: !0
|
|
1637
1635
|
}) : t[e] = r, t;
|
|
1638
1636
|
}
|
|
1639
|
-
function
|
|
1637
|
+
function ve(t, e) {
|
|
1640
1638
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1641
1639
|
if (!r) {
|
|
1642
1640
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
@@ -1693,14 +1691,14 @@ var OHLCV_INDICATORS;
|
|
|
1693
1691
|
return n;
|
|
1694
1692
|
}
|
|
1695
1693
|
// ./src/moving-averages/bollingerBands.js
|
|
1696
|
-
function
|
|
1697
|
-
return
|
|
1694
|
+
function de(t) {
|
|
1695
|
+
return de = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1698
1696
|
return typeof t;
|
|
1699
1697
|
} : function(t) {
|
|
1700
1698
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1701
|
-
},
|
|
1699
|
+
}, de(t);
|
|
1702
1700
|
}
|
|
1703
|
-
function
|
|
1701
|
+
function be(t, e) {
|
|
1704
1702
|
var r = Object.keys(t);
|
|
1705
1703
|
if (Object.getOwnPropertySymbols) {
|
|
1706
1704
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -1710,19 +1708,19 @@ var OHLCV_INDICATORS;
|
|
|
1710
1708
|
}
|
|
1711
1709
|
return r;
|
|
1712
1710
|
}
|
|
1713
|
-
function
|
|
1711
|
+
function ge(t, e, r) {
|
|
1714
1712
|
return (e = function(t) {
|
|
1715
1713
|
var e = function(t, e) {
|
|
1716
|
-
if ("object" !=
|
|
1714
|
+
if ("object" != de(t) || !t) return t;
|
|
1717
1715
|
var r = t[Symbol.toPrimitive];
|
|
1718
1716
|
if (void 0 !== r) {
|
|
1719
1717
|
var n = r.call(t, e || "default");
|
|
1720
|
-
if ("object" !=
|
|
1718
|
+
if ("object" != de(n)) return n;
|
|
1721
1719
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1722
1720
|
}
|
|
1723
1721
|
return ("string" === e ? String : Number)(t);
|
|
1724
1722
|
}(t, "string");
|
|
1725
|
-
return "symbol" ==
|
|
1723
|
+
return "symbol" == de(e) ? e : e + "";
|
|
1726
1724
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1727
1725
|
value: r,
|
|
1728
1726
|
enumerable: !0,
|
|
@@ -1730,14 +1728,14 @@ var OHLCV_INDICATORS;
|
|
|
1730
1728
|
writable: !0
|
|
1731
1729
|
}) : t[e] = r, t;
|
|
1732
1730
|
}
|
|
1733
|
-
function
|
|
1731
|
+
function we(t, e) {
|
|
1734
1732
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1735
1733
|
if (!r) {
|
|
1736
1734
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
1737
1735
|
if (t) {
|
|
1738
|
-
if ("string" == typeof t) return
|
|
1736
|
+
if ("string" == typeof t) return Oe(t, e);
|
|
1739
1737
|
var r = {}.toString.call(t).slice(8, -1);
|
|
1740
|
-
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) ?
|
|
1738
|
+
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) ? Oe(t, e) : void 0;
|
|
1741
1739
|
}
|
|
1742
1740
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
1743
1741
|
r && (t = r);
|
|
@@ -1781,60 +1779,21 @@ var OHLCV_INDICATORS;
|
|
|
1781
1779
|
}
|
|
1782
1780
|
};
|
|
1783
1781
|
}
|
|
1784
|
-
function
|
|
1782
|
+
function Oe(t, e) {
|
|
1785
1783
|
(null == e || e > t.length) && (e = t.length);
|
|
1786
1784
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1787
1785
|
return n;
|
|
1788
1786
|
}
|
|
1789
1787
|
// ./src/utilities/numberUtilities.js
|
|
1790
|
-
function
|
|
1791
|
-
return
|
|
1788
|
+
function Se(t) {
|
|
1789
|
+
return Se = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1792
1790
|
return typeof t;
|
|
1793
1791
|
} : function(t) {
|
|
1794
1792
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1795
|
-
},
|
|
1793
|
+
}, Se(t);
|
|
1796
1794
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
if (Array.isArray(t)) return t;
|
|
1800
|
-
}
|
|
1801
|
-
// Helper to clean non-numeric characters (except "-" at the start and decimal point)
|
|
1802
|
-
(t) || function(t, e) {
|
|
1803
|
-
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1804
|
-
if (null != r) {
|
|
1805
|
-
var n, o, i, a, u = [], l = !0, c = !1;
|
|
1806
|
-
try {
|
|
1807
|
-
if (i = (r = r.call(t)).next, 0 === e) {
|
|
1808
|
-
if (Object(r) !== r) return;
|
|
1809
|
-
l = !1;
|
|
1810
|
-
} else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
|
|
1811
|
-
} catch (t) {
|
|
1812
|
-
c = !0, o = t;
|
|
1813
|
-
} finally {
|
|
1814
|
-
try {
|
|
1815
|
-
if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
1816
|
-
} finally {
|
|
1817
|
-
if (c) throw o;
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
return u;
|
|
1821
|
-
}
|
|
1822
|
-
}(t, e) || function(t, e) {
|
|
1823
|
-
if (t) {
|
|
1824
|
-
if ("string" == typeof t) return _e(t, e);
|
|
1825
|
-
var r = {}.toString.call(t).slice(8, -1);
|
|
1826
|
-
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;
|
|
1827
|
-
}
|
|
1828
|
-
}(t, e) || function() {
|
|
1829
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1830
|
-
}();
|
|
1831
|
-
}
|
|
1832
|
-
function _e(t, e) {
|
|
1833
|
-
(null == e || e > t.length) && (e = t.length);
|
|
1834
|
-
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1835
|
-
return n;
|
|
1836
|
-
}
|
|
1837
|
-
var Ne = {
|
|
1795
|
+
// Helper to clean non-numeric characters (except "-" at the start and decimal point)
|
|
1796
|
+
var je = {
|
|
1838
1797
|
number: function(t) {
|
|
1839
1798
|
return t;
|
|
1840
1799
|
},
|
|
@@ -1844,7 +1803,7 @@ var OHLCV_INDICATORS;
|
|
|
1844
1803
|
numberDirtyString: function(t) {
|
|
1845
1804
|
return Number(t.replace(/(?!^-)[^0-9.]/g, ""));
|
|
1846
1805
|
}
|
|
1847
|
-
},
|
|
1806
|
+
}, Pe = function(t) {
|
|
1848
1807
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
1849
1808
|
// 1) true numbers
|
|
1850
1809
|
if ("number" == typeof t && !Number.isNaN(t)) return "number";
|
|
@@ -1859,17 +1818,17 @@ var OHLCV_INDICATORS;
|
|
|
1859
1818
|
if (o && n.test(o)) return "numberDirtyString";
|
|
1860
1819
|
}
|
|
1861
1820
|
if (e) throw new TypeError("Invalid input: expected a number or numeric string");
|
|
1862
|
-
return
|
|
1821
|
+
return Se(t);
|
|
1863
1822
|
};
|
|
1864
1823
|
// ./src/utilities/dateUtilities.js
|
|
1865
|
-
function
|
|
1866
|
-
return
|
|
1824
|
+
function _e(t) {
|
|
1825
|
+
return _e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1867
1826
|
return typeof t;
|
|
1868
1827
|
} : function(t) {
|
|
1869
1828
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1870
|
-
},
|
|
1829
|
+
}, _e(t);
|
|
1871
1830
|
}
|
|
1872
|
-
var
|
|
1831
|
+
var Ne = {
|
|
1873
1832
|
dateObject: function(t) {
|
|
1874
1833
|
return t;
|
|
1875
1834
|
},
|
|
@@ -1885,122 +1844,103 @@ var OHLCV_INDICATORS;
|
|
|
1885
1844
|
dateCompleteDateString: function(t) {
|
|
1886
1845
|
return new Date(t);
|
|
1887
1846
|
}
|
|
1847
|
+
}, Te = function(t) {
|
|
1848
|
+
// Regex for a UTC Time Format where the string ends with "Z".
|
|
1849
|
+
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() {
|
|
1850
|
+
throw new Error('Invalid "'.concat(_e(t), '" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")));
|
|
1851
|
+
};
|
|
1852
|
+
// Regex for a Timezone Offset Format,
|
|
1853
|
+
// which includes a plus or minus sign followed by HH:MM at the end.
|
|
1854
|
+
if ("object" === _e(t)) {
|
|
1855
|
+
if (t instanceof Date && !isNaN(t.valueOf())) return "dateObject";
|
|
1856
|
+
r();
|
|
1857
|
+
} else {
|
|
1858
|
+
if ("number" == typeof t)
|
|
1859
|
+
// Use a numeric threshold based on the absolute value: typically,
|
|
1860
|
+
// if the absolute value is below 1e11, then it's a seconds timestamp.
|
|
1861
|
+
// Otherwise, it's a milliseconds timestamp.
|
|
1862
|
+
return Math.abs(t) < 1e11 ? "dateSeconds" : "dateMillseconds";
|
|
1863
|
+
if ("string" == typeof t) {
|
|
1864
|
+
if (/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t) || /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t) || /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t) && t.length > 10 || /^\d{4}\/\d{2}\/\d{2}$/.test(t)) return "dateCompleteDateString";
|
|
1865
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) return "dateIncompleteDayString";
|
|
1866
|
+
r();
|
|
1867
|
+
} else r();
|
|
1868
|
+
}
|
|
1888
1869
|
};
|
|
1889
1870
|
// ./src/utilities/assignTypes.js
|
|
1890
|
-
function
|
|
1871
|
+
function Ae(t, e) {
|
|
1891
1872
|
return function(t) {
|
|
1892
1873
|
if (Array.isArray(t)) return t;
|
|
1893
1874
|
}(t) || function(t, e) {
|
|
1894
1875
|
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1895
1876
|
if (null != r) {
|
|
1896
|
-
var n, o, i, a, u = [],
|
|
1877
|
+
var n, o, i, a, u = [], c = !0, l = !1;
|
|
1897
1878
|
try {
|
|
1898
1879
|
if (i = (r = r.call(t)).next, 0 === e) {
|
|
1899
1880
|
if (Object(r) !== r) return;
|
|
1900
|
-
|
|
1901
|
-
} else for (;!(
|
|
1881
|
+
c = !1;
|
|
1882
|
+
} else for (;!(c = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); c = !0) ;
|
|
1902
1883
|
} catch (t) {
|
|
1903
|
-
|
|
1884
|
+
l = !0, o = t;
|
|
1904
1885
|
} finally {
|
|
1905
1886
|
try {
|
|
1906
|
-
if (!
|
|
1887
|
+
if (!c && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
1907
1888
|
} finally {
|
|
1908
|
-
if (
|
|
1889
|
+
if (l) throw o;
|
|
1909
1890
|
}
|
|
1910
1891
|
}
|
|
1911
1892
|
return u;
|
|
1912
1893
|
}
|
|
1913
1894
|
}(t, e) || function(t, e) {
|
|
1914
1895
|
if (t) {
|
|
1915
|
-
if ("string" == typeof t) return
|
|
1896
|
+
if ("string" == typeof t) return Ee(t, e);
|
|
1916
1897
|
var r = {}.toString.call(t).slice(8, -1);
|
|
1917
|
-
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) ?
|
|
1898
|
+
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) ? Ee(t, e) : void 0;
|
|
1918
1899
|
}
|
|
1919
1900
|
}(t, e) || function() {
|
|
1920
1901
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1921
1902
|
}();
|
|
1922
1903
|
}
|
|
1923
|
-
function
|
|
1904
|
+
function Ee(t, e) {
|
|
1924
1905
|
(null == e || e > t.length) && (e = t.length);
|
|
1925
1906
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1926
1907
|
return n;
|
|
1927
1908
|
}
|
|
1928
|
-
var
|
|
1909
|
+
var ke = new Set([ "open", "high", "low", "close" ]), xe = function(t, e) {
|
|
1929
1910
|
return "Array" === t ? new Array(e).fill(null) : "Float64Array" === t ? new Float64Array(e).fill(NaN) : "Int32Array" === t ? new Int32Array(e).fill(NaN) : void 0;
|
|
1930
|
-
}, De = function(t, e) {
|
|
1931
|
-
for (var r = {}, n = {}, o = Object.entries(e), i = function() {
|
|
1932
|
-
var t = Te(u[a], 2), e = t[0], i = t[1], l = o.find((function(t) {
|
|
1933
|
-
return Te(t, 2)[1] === e;
|
|
1934
|
-
}));
|
|
1935
|
-
// see if this column is one of your known targetCols
|
|
1936
|
-
if (l) {
|
|
1937
|
-
var c = Te(l, 1)[0];
|
|
1938
|
-
Ie.includes(c) ? (
|
|
1939
|
-
// OHLCV fields
|
|
1940
|
-
r[e] = Ae(i, !0), n[e] = "Float64Array") : "volume" === c ? (r[e] = Ae(i, !0), n[e] = "Int32Array") : "date" === c ? (r[e] = function(t) {
|
|
1941
|
-
// Regex for a UTC Time Format where the string ends with "Z".
|
|
1942
|
-
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() {
|
|
1943
|
-
throw new Error('Invalid "'.concat(xe(t), '" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")));
|
|
1944
|
-
};
|
|
1945
|
-
// Regex for a Timezone Offset Format,
|
|
1946
|
-
// which includes a plus or minus sign followed by HH:MM at the end.
|
|
1947
|
-
if ("object" === xe(t)) {
|
|
1948
|
-
if (t instanceof Date && !isNaN(t.valueOf())) return "dateObject";
|
|
1949
|
-
r();
|
|
1950
|
-
} else {
|
|
1951
|
-
if ("number" == typeof t)
|
|
1952
|
-
// Use a numeric threshold based on the absolute value: typically,
|
|
1953
|
-
// if the absolute value is below 1e11, then it's a seconds timestamp.
|
|
1954
|
-
// Otherwise, it's a milliseconds timestamp.
|
|
1955
|
-
return Math.abs(t) < 1e11 ? "dateSeconds" : "dateMillseconds";
|
|
1956
|
-
if ("string" == typeof t) {
|
|
1957
|
-
if (/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t) || /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t) || /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t) && t.length > 10 || /^\d{4}\/\d{2}\/\d{2}$/.test(t)) return "dateCompleteDateString";
|
|
1958
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) return "dateIncompleteDayString";
|
|
1959
|
-
r();
|
|
1960
|
-
} else r();
|
|
1961
|
-
}
|
|
1962
|
-
}(i), n[e] = "Array") : (
|
|
1963
|
-
// in case you ever add other semanticKeys
|
|
1964
|
-
r[e] = Ae(i, !1), "number" === r[e] ? n[e] = "Float64Array" : n[e] = "Array");
|
|
1965
|
-
} else r[e] = Ae(i, !1), "number" === r[e] ? n[e] = "Float64Array" : n[e] = "Array";
|
|
1966
|
-
}, a = 0, u = Object.entries(t); a < u.length; a++) i();
|
|
1967
|
-
return {
|
|
1968
|
-
inputTypes: r,
|
|
1969
|
-
arrayTypes: n
|
|
1970
|
-
};
|
|
1971
1911
|
};
|
|
1972
1912
|
// ./src/studies/lag.js
|
|
1973
|
-
function
|
|
1913
|
+
function Me(t, e) {
|
|
1974
1914
|
return function(t) {
|
|
1975
1915
|
if (Array.isArray(t)) return t;
|
|
1976
1916
|
}(t) || function(t, e) {
|
|
1977
1917
|
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1978
1918
|
if (null != r) {
|
|
1979
|
-
var n, o, i, a, u = [],
|
|
1919
|
+
var n, o, i, a, u = [], c = !0, l = !1;
|
|
1980
1920
|
try {
|
|
1981
1921
|
if (i = (r = r.call(t)).next, 0 === e) {
|
|
1982
1922
|
if (Object(r) !== r) return;
|
|
1983
|
-
|
|
1984
|
-
} else for (;!(
|
|
1923
|
+
c = !1;
|
|
1924
|
+
} else for (;!(c = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); c = !0) ;
|
|
1985
1925
|
} catch (t) {
|
|
1986
|
-
|
|
1926
|
+
l = !0, o = t;
|
|
1987
1927
|
} finally {
|
|
1988
1928
|
try {
|
|
1989
|
-
if (!
|
|
1929
|
+
if (!c && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
1990
1930
|
} finally {
|
|
1991
|
-
if (
|
|
1931
|
+
if (l) throw o;
|
|
1992
1932
|
}
|
|
1993
1933
|
}
|
|
1994
1934
|
return u;
|
|
1995
1935
|
}
|
|
1996
|
-
}(t, e) ||
|
|
1936
|
+
}(t, e) || De(t, e) || function() {
|
|
1997
1937
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1998
1938
|
}();
|
|
1999
1939
|
}
|
|
2000
|
-
function
|
|
1940
|
+
function Ie(t, e) {
|
|
2001
1941
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2002
1942
|
if (!r) {
|
|
2003
|
-
if (Array.isArray(t) || (r =
|
|
1943
|
+
if (Array.isArray(t) || (r = De(t)) || e && t && "number" == typeof t.length) {
|
|
2004
1944
|
r && (t = r);
|
|
2005
1945
|
var n = 0, o = function() {};
|
|
2006
1946
|
return {
|
|
@@ -2042,42 +1982,42 @@ var OHLCV_INDICATORS;
|
|
|
2042
1982
|
}
|
|
2043
1983
|
};
|
|
2044
1984
|
}
|
|
2045
|
-
function
|
|
1985
|
+
function De(t, e) {
|
|
2046
1986
|
if (t) {
|
|
2047
|
-
if ("string" == typeof t) return
|
|
1987
|
+
if ("string" == typeof t) return Re(t, e);
|
|
2048
1988
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2049
|
-
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) ?
|
|
1989
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Re(t, e) : void 0;
|
|
2050
1990
|
}
|
|
2051
1991
|
}
|
|
2052
|
-
function
|
|
1992
|
+
function Re(t, e) {
|
|
2053
1993
|
(null == e || e > t.length) && (e = t.length);
|
|
2054
1994
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2055
1995
|
return n;
|
|
2056
1996
|
}
|
|
2057
|
-
function
|
|
2058
|
-
return
|
|
1997
|
+
function Ce(t) {
|
|
1998
|
+
return Ce = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2059
1999
|
return typeof t;
|
|
2060
2000
|
} : function(t) {
|
|
2061
2001
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2062
|
-
},
|
|
2002
|
+
}, Ce(t);
|
|
2063
2003
|
}
|
|
2064
|
-
var
|
|
2004
|
+
var Fe = function(t, e) {
|
|
2065
2005
|
var r = t.instances, n = t.verticalOhlcv, o = t.len, i = t.arrayTypes, a = t.priceBased;
|
|
2066
2006
|
if (0 === e) {
|
|
2067
2007
|
var u = t.inputParams.filter((function(t) {
|
|
2068
2008
|
return "lag" === t.key;
|
|
2069
2009
|
}));
|
|
2070
|
-
if ("object" !==
|
|
2071
|
-
var
|
|
2010
|
+
if ("object" !== Ce(u)) return;
|
|
2011
|
+
var c, l = u.map((function(t) {
|
|
2072
2012
|
return t.params;
|
|
2073
|
-
})), s =
|
|
2013
|
+
})), s = Ie(l);
|
|
2074
2014
|
try {
|
|
2075
|
-
for (s.s(); !(
|
|
2076
|
-
var f,
|
|
2015
|
+
for (s.s(); !(c = s.n()).done; ) {
|
|
2016
|
+
var f, y = Me(c.value, 2), h = y[0], p = y[1], v = Ie(h);
|
|
2077
2017
|
try {
|
|
2078
2018
|
for (v.s(); !(f = v.n()).done; ) {
|
|
2079
|
-
var
|
|
2080
|
-
if (a.
|
|
2019
|
+
var m = f.value;
|
|
2020
|
+
if (a.has(m)) for (var d = 1; d <= p; d++) a.add("".concat(m, "_lag_").concat(d));
|
|
2081
2021
|
}
|
|
2082
2022
|
} catch (t) {
|
|
2083
2023
|
v.e(t);
|
|
@@ -2091,28 +2031,29 @@ var OHLCV_INDICATORS;
|
|
|
2091
2031
|
s.f();
|
|
2092
2032
|
}
|
|
2093
2033
|
r.lag = {
|
|
2094
|
-
lagParams:
|
|
2034
|
+
lagParams: l
|
|
2095
2035
|
};
|
|
2096
2036
|
}
|
|
2097
|
-
var b, g =
|
|
2037
|
+
var b, g = Ie(r.lag.lagParams);
|
|
2098
2038
|
try {
|
|
2099
2039
|
for (g.s(); !(b = g.n()).done; ) {
|
|
2100
|
-
var w, O =
|
|
2040
|
+
var w, O = Me(b.value, 2), S = O[0], j = O[1], P = Ie(S);
|
|
2101
2041
|
try {
|
|
2102
2042
|
for (P.s(); !(w = P.n()).done; ) {
|
|
2103
2043
|
var _ = w.value, N = n[_];
|
|
2104
2044
|
// Initialize lagged arrays only on the first index
|
|
2105
|
-
if (0 === e) for (var
|
|
2106
|
-
var
|
|
2107
|
-
i.hasOwnProperty(_)
|
|
2045
|
+
if (0 === e) for (var T = 1; T <= j; T++) {
|
|
2046
|
+
var A = "".concat(_, "_lag_").concat(T);
|
|
2047
|
+
if (!i.hasOwnProperty(_)) throw new Error('Lag processing invoked by "'.concat(_, '" expected arrayTypes to have a "').concat(_, '" property, but it wasn’t found.'));
|
|
2048
|
+
n[A] = xe(i[_], o), i[A] = i[_];
|
|
2108
2049
|
}
|
|
2109
2050
|
// Populate lagged values
|
|
2110
2051
|
for (var E = 1; E <= j; E++) {
|
|
2111
|
-
var
|
|
2052
|
+
var k = "".concat(_, "_lag_").concat(E), x = e - E, M = x <= 0 || void 0 === N[x] ? null : N[x];
|
|
2112
2053
|
t.pushToMain({
|
|
2113
2054
|
index: e,
|
|
2114
|
-
key:
|
|
2115
|
-
value:
|
|
2055
|
+
key: k,
|
|
2056
|
+
value: M
|
|
2116
2057
|
});
|
|
2117
2058
|
}
|
|
2118
2059
|
}
|
|
@@ -2130,14 +2071,14 @@ var OHLCV_INDICATORS;
|
|
|
2130
2071
|
return !0;
|
|
2131
2072
|
};
|
|
2132
2073
|
// ./src/studies/findCrosses.js
|
|
2133
|
-
function
|
|
2074
|
+
function Le(t, e) {
|
|
2134
2075
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2135
2076
|
if (!r) {
|
|
2136
2077
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
2137
2078
|
if (t) {
|
|
2138
|
-
if ("string" == typeof t) return
|
|
2079
|
+
if ("string" == typeof t) return Be(t, e);
|
|
2139
2080
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2140
|
-
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) ?
|
|
2081
|
+
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) ? Be(t, e) : void 0;
|
|
2141
2082
|
}
|
|
2142
2083
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
2143
2084
|
r && (t = r);
|
|
@@ -2181,55 +2122,54 @@ var OHLCV_INDICATORS;
|
|
|
2181
2122
|
}
|
|
2182
2123
|
};
|
|
2183
2124
|
}
|
|
2184
|
-
function
|
|
2125
|
+
function Be(t, e) {
|
|
2185
2126
|
(null == e || e > t.length) && (e = t.length);
|
|
2186
2127
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2187
2128
|
return n;
|
|
2188
2129
|
}
|
|
2189
|
-
function
|
|
2190
|
-
return
|
|
2130
|
+
function He(t) {
|
|
2131
|
+
return He = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2191
2132
|
return typeof t;
|
|
2192
2133
|
} : function(t) {
|
|
2193
2134
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2194
|
-
},
|
|
2135
|
+
}, He(t);
|
|
2195
2136
|
}
|
|
2196
|
-
function
|
|
2137
|
+
function Ve(t, e) {
|
|
2197
2138
|
for (var r = 0; r < e.length; r++) {
|
|
2198
2139
|
var n = e[r];
|
|
2199
2140
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
2200
|
-
Object.defineProperty(t,
|
|
2141
|
+
Object.defineProperty(t, Ue(n.key), n);
|
|
2201
2142
|
}
|
|
2202
2143
|
}
|
|
2203
|
-
function
|
|
2144
|
+
function Ue(t) {
|
|
2204
2145
|
var e = function(t, e) {
|
|
2205
|
-
if ("object" !=
|
|
2146
|
+
if ("object" != He(t) || !t) return t;
|
|
2206
2147
|
var r = t[Symbol.toPrimitive];
|
|
2207
2148
|
if (void 0 !== r) {
|
|
2208
2149
|
var n = r.call(t, e || "default");
|
|
2209
|
-
if ("object" !=
|
|
2150
|
+
if ("object" != He(n)) return n;
|
|
2210
2151
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2211
2152
|
}
|
|
2212
2153
|
return ("string" === e ? String : Number)(t);
|
|
2213
2154
|
}(t, "string");
|
|
2214
|
-
return "symbol" ==
|
|
2155
|
+
return "symbol" == He(e) ? e : e + "";
|
|
2215
2156
|
}
|
|
2216
|
-
var
|
|
2157
|
+
var qe = function(t, e) {
|
|
2217
2158
|
return t > e;
|
|
2218
|
-
},
|
|
2159
|
+
}, $e = function(t, e) {
|
|
2219
2160
|
return t < e;
|
|
2220
|
-
},
|
|
2161
|
+
}, ze = function() {
|
|
2221
2162
|
return t = function t() {
|
|
2222
2163
|
!function(t, e) {
|
|
2223
2164
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
2224
2165
|
}(this, t), Object.assign(this, {
|
|
2225
2166
|
interval: 0,
|
|
2226
2167
|
prevState: .5,
|
|
2227
|
-
prevFast:
|
|
2228
|
-
prevSlow:
|
|
2229
|
-
prevHigh:
|
|
2230
|
-
prevLow:
|
|
2168
|
+
prevFast: NaN,
|
|
2169
|
+
prevSlow: NaN,
|
|
2170
|
+
prevHigh: NaN,
|
|
2171
|
+
prevLow: NaN,
|
|
2231
2172
|
areHighAndLowUndefined: !1,
|
|
2232
|
-
index: 0,
|
|
2233
2173
|
crossIndexes: {
|
|
2234
2174
|
up: [],
|
|
2235
2175
|
down: []
|
|
@@ -2237,25 +2177,24 @@ var OHLCV_INDICATORS;
|
|
|
2237
2177
|
});
|
|
2238
2178
|
}, (e = [ {
|
|
2239
2179
|
key: "update",
|
|
2240
|
-
value: function(t) {
|
|
2241
|
-
var
|
|
2242
|
-
this.areHighAndLowUndefined || void 0 !==
|
|
2243
|
-
|
|
2180
|
+
value: function(t, e) {
|
|
2181
|
+
var r = e.fast, n = e.high, o = e.slow, i = e.low, a = this.prevState;
|
|
2182
|
+
this.areHighAndLowUndefined || void 0 !== n && void 0 !== i || (this.areHighAndLowUndefined = !0),
|
|
2183
|
+
Number.isNaN(r) || Number.isNaN(o) || function(t, e) {
|
|
2244
2184
|
return t === e;
|
|
2245
|
-
}(
|
|
2246
|
-
return
|
|
2247
|
-
})) &&
|
|
2248
|
-
return
|
|
2249
|
-
})) &&
|
|
2250
|
-
1 === this.interval && this.crossIndexes.up.push(
|
|
2185
|
+
}(r, o) ? a = .5 : qe(r, o) ? a = this.areHighAndLowUndefined ? 1 : [ i, o, this.prevLow, this.prevSlow ].every((function(t) {
|
|
2186
|
+
return !Number.isNaN(t);
|
|
2187
|
+
})) && $e(i, o) && qe(this.prevLow, this.prevSlow) ? 0 : 1 : $e(r, o) && (a = this.areHighAndLowUndefined ? 0 : [ n, o, this.prevHigh, this.prevSlow ].every((function(t) {
|
|
2188
|
+
return !Number.isNaN(t);
|
|
2189
|
+
})) && qe(n, o) && $e(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--),
|
|
2190
|
+
1 === this.interval && this.crossIndexes.up.push(t), -1 === this.interval && this.crossIndexes.down.push(t),
|
|
2251
2191
|
//save prev state
|
|
2252
2192
|
Object.assign(this, {
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
prevLow: o
|
|
2193
|
+
prevState: a,
|
|
2194
|
+
prevFast: r,
|
|
2195
|
+
prevSlow: o,
|
|
2196
|
+
prevHigh: n,
|
|
2197
|
+
prevLow: i
|
|
2259
2198
|
});
|
|
2260
2199
|
}
|
|
2261
2200
|
}, {
|
|
@@ -2263,65 +2202,65 @@ var OHLCV_INDICATORS;
|
|
|
2263
2202
|
value: function() {
|
|
2264
2203
|
return this.interval;
|
|
2265
2204
|
}
|
|
2266
|
-
} ]) &&
|
|
2205
|
+
} ]) && Ve(t.prototype, e), r && Ve(t, r), Object.defineProperty(t, "prototype", {
|
|
2267
2206
|
writable: !1
|
|
2268
2207
|
}), t;
|
|
2269
2208
|
var t, e, r;
|
|
2270
|
-
}(),
|
|
2271
|
-
var r = t.verticalOhlcv, n = t.instances, o = t.len;
|
|
2209
|
+
}(), Ge = function(t, e) {
|
|
2210
|
+
var r = t.verticalOhlcv, n = t.instances, o = t.len, i = t.arrayTypes;
|
|
2272
2211
|
if (0 === e) {
|
|
2273
|
-
var
|
|
2212
|
+
var a = t.inputParams.filter((function(t) {
|
|
2274
2213
|
return "crossPairs" === t.key;
|
|
2275
2214
|
}));
|
|
2276
|
-
if ("object" !==
|
|
2215
|
+
if ("object" !== He(a)) return;
|
|
2277
2216
|
n.crossPairs = {
|
|
2278
|
-
crossPairsList:
|
|
2217
|
+
crossPairsList: a.flatMap((function(t) {
|
|
2279
2218
|
return t.params.flat();
|
|
2280
2219
|
}))
|
|
2281
2220
|
};
|
|
2282
2221
|
}
|
|
2283
|
-
var
|
|
2222
|
+
var u, c = Le(n.crossPairs.crossPairsList);
|
|
2284
2223
|
try {
|
|
2285
|
-
for (
|
|
2286
|
-
var l =
|
|
2287
|
-
if (null !=
|
|
2288
|
-
var
|
|
2224
|
+
for (c.s(); !(u = c.n()).done; ) {
|
|
2225
|
+
var l = u.value, s = l.fast, f = l.slow;
|
|
2226
|
+
if (null != s && null != f) {
|
|
2227
|
+
var y = "".concat(s, "_x_").concat(f);
|
|
2289
2228
|
if (0 === e) {
|
|
2290
|
-
if ("number" == typeof
|
|
2291
|
-
if (!r.hasOwnProperty(
|
|
2292
|
-
n[
|
|
2229
|
+
if ("number" == typeof f && (r[f] = new Int32Array(o).fill(f)), "price" !== s && !r.hasOwnProperty(s)) throw Error('fast "'.concat(s, ' not found in crossPairs"'));
|
|
2230
|
+
if (!r.hasOwnProperty(f)) throw Error('slow "'.concat(f, ' not found in crossPairs"'));
|
|
2231
|
+
n[y] = new ze, r[y] = new Int32Array(o).fill(NaN), i[y] = "Int32Array";
|
|
2293
2232
|
}
|
|
2294
|
-
var h = void 0, p = void 0,
|
|
2295
|
-
"price" ===
|
|
2233
|
+
var h = void 0, p = void 0, v = void 0, m = void 0, d = void 0;
|
|
2234
|
+
"price" === s ? (p = r.close[e], v = r.high[e], m = r.low[e], d = r[f][e], n[y].update(e, {
|
|
2296
2235
|
fast: p,
|
|
2297
2236
|
slow: d,
|
|
2298
|
-
high:
|
|
2299
|
-
low:
|
|
2300
|
-
})) : (h = r[
|
|
2237
|
+
high: v,
|
|
2238
|
+
low: m
|
|
2239
|
+
})) : (h = r[s][e], d = r[f][e], n[y].update(e, {
|
|
2301
2240
|
fast: h,
|
|
2302
2241
|
slow: d
|
|
2303
2242
|
})), t.pushToMain({
|
|
2304
2243
|
index: e,
|
|
2305
|
-
key:
|
|
2306
|
-
value: n[
|
|
2244
|
+
key: y,
|
|
2245
|
+
value: n[y].getResult()
|
|
2307
2246
|
});
|
|
2308
2247
|
}
|
|
2309
2248
|
}
|
|
2310
2249
|
} catch (t) {
|
|
2311
|
-
|
|
2250
|
+
c.e(t);
|
|
2312
2251
|
} finally {
|
|
2313
|
-
|
|
2252
|
+
c.f();
|
|
2314
2253
|
}
|
|
2315
2254
|
};
|
|
2316
2255
|
// ./src/studies/dateTime.js
|
|
2317
|
-
function
|
|
2318
|
-
return
|
|
2256
|
+
function Ye(t) {
|
|
2257
|
+
return Ye = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2319
2258
|
return typeof t;
|
|
2320
2259
|
} : function(t) {
|
|
2321
2260
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2322
|
-
},
|
|
2261
|
+
}, Ye(t);
|
|
2323
2262
|
}
|
|
2324
|
-
function
|
|
2263
|
+
function Ke(t, e) {
|
|
2325
2264
|
var r = Object.keys(t);
|
|
2326
2265
|
if (Object.getOwnPropertySymbols) {
|
|
2327
2266
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -2331,19 +2270,19 @@ var OHLCV_INDICATORS;
|
|
|
2331
2270
|
}
|
|
2332
2271
|
return r;
|
|
2333
2272
|
}
|
|
2334
|
-
function
|
|
2273
|
+
function Je(t, e, r) {
|
|
2335
2274
|
return (e = function(t) {
|
|
2336
2275
|
var e = function(t, e) {
|
|
2337
|
-
if ("object" !=
|
|
2276
|
+
if ("object" != Ye(t) || !t) return t;
|
|
2338
2277
|
var r = t[Symbol.toPrimitive];
|
|
2339
2278
|
if (void 0 !== r) {
|
|
2340
2279
|
var n = r.call(t, e || "default");
|
|
2341
|
-
if ("object" !=
|
|
2280
|
+
if ("object" != Ye(n)) return n;
|
|
2342
2281
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2343
2282
|
}
|
|
2344
2283
|
return ("string" === e ? String : Number)(t);
|
|
2345
2284
|
}(t, "string");
|
|
2346
|
-
return "symbol" ==
|
|
2285
|
+
return "symbol" == Ye(e) ? e : e + "";
|
|
2347
2286
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
2348
2287
|
value: r,
|
|
2349
2288
|
enumerable: !0,
|
|
@@ -2351,7 +2290,7 @@ var OHLCV_INDICATORS;
|
|
|
2351
2290
|
writable: !0
|
|
2352
2291
|
}) : t[e] = r, t;
|
|
2353
2292
|
}
|
|
2354
|
-
var
|
|
2293
|
+
var Ze = function(t) {
|
|
2355
2294
|
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();
|
|
2356
2295
|
return {
|
|
2357
2296
|
month: e,
|
|
@@ -2364,19 +2303,19 @@ var OHLCV_INDICATORS;
|
|
|
2364
2303
|
};
|
|
2365
2304
|
};
|
|
2366
2305
|
// ./src/studies/scaler.js
|
|
2367
|
-
function
|
|
2306
|
+
function Qe(t) {
|
|
2368
2307
|
return function(t) {
|
|
2369
|
-
if (Array.isArray(t)) return
|
|
2308
|
+
if (Array.isArray(t)) return er(t);
|
|
2370
2309
|
}(t) || function(t) {
|
|
2371
2310
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2372
|
-
}(t) ||
|
|
2311
|
+
}(t) || tr(t) || function() {
|
|
2373
2312
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2374
2313
|
}();
|
|
2375
2314
|
}
|
|
2376
|
-
function
|
|
2315
|
+
function We(t, e) {
|
|
2377
2316
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2378
2317
|
if (!r) {
|
|
2379
|
-
if (Array.isArray(t) || (r =
|
|
2318
|
+
if (Array.isArray(t) || (r = tr(t)) || e && t && "number" == typeof t.length) {
|
|
2380
2319
|
r && (t = r);
|
|
2381
2320
|
var n = 0, o = function() {};
|
|
2382
2321
|
return {
|
|
@@ -2418,60 +2357,60 @@ var OHLCV_INDICATORS;
|
|
|
2418
2357
|
}
|
|
2419
2358
|
};
|
|
2420
2359
|
}
|
|
2421
|
-
function
|
|
2360
|
+
function Xe(t, e) {
|
|
2422
2361
|
return function(t) {
|
|
2423
2362
|
if (Array.isArray(t)) return t;
|
|
2424
2363
|
}
|
|
2425
2364
|
/* General Scaler: supports "minmax" and "zscore" types */ (t) || function(t, e) {
|
|
2426
2365
|
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2427
2366
|
if (null != r) {
|
|
2428
|
-
var n, o, i, a, u = [],
|
|
2367
|
+
var n, o, i, a, u = [], c = !0, l = !1;
|
|
2429
2368
|
try {
|
|
2430
2369
|
if (i = (r = r.call(t)).next, 0 === e) {
|
|
2431
2370
|
if (Object(r) !== r) return;
|
|
2432
|
-
|
|
2433
|
-
} else for (;!(
|
|
2371
|
+
c = !1;
|
|
2372
|
+
} else for (;!(c = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); c = !0) ;
|
|
2434
2373
|
} catch (t) {
|
|
2435
|
-
|
|
2374
|
+
l = !0, o = t;
|
|
2436
2375
|
} finally {
|
|
2437
2376
|
try {
|
|
2438
|
-
if (!
|
|
2377
|
+
if (!c && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
2439
2378
|
} finally {
|
|
2440
|
-
if (
|
|
2379
|
+
if (l) throw o;
|
|
2441
2380
|
}
|
|
2442
2381
|
}
|
|
2443
2382
|
return u;
|
|
2444
2383
|
}
|
|
2445
|
-
}(t, e) ||
|
|
2384
|
+
}(t, e) || tr(t, e) || function() {
|
|
2446
2385
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2447
2386
|
}();
|
|
2448
2387
|
}
|
|
2449
|
-
function
|
|
2388
|
+
function tr(t, e) {
|
|
2450
2389
|
if (t) {
|
|
2451
|
-
if ("string" == typeof t) return
|
|
2390
|
+
if ("string" == typeof t) return er(t, e);
|
|
2452
2391
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2453
|
-
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) ?
|
|
2392
|
+
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;
|
|
2454
2393
|
}
|
|
2455
2394
|
}
|
|
2456
|
-
function
|
|
2395
|
+
function er(t, e) {
|
|
2457
2396
|
(null == e || e > t.length) && (e = t.length);
|
|
2458
2397
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2459
2398
|
return n;
|
|
2460
2399
|
}
|
|
2461
2400
|
// ./src/core-functions/mainLoop.js
|
|
2462
|
-
function
|
|
2401
|
+
function rr(t) {
|
|
2463
2402
|
return function(t) {
|
|
2464
|
-
if (Array.isArray(t)) return
|
|
2403
|
+
if (Array.isArray(t)) return ar(t);
|
|
2465
2404
|
}(t) || function(t) {
|
|
2466
2405
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2467
|
-
}(t) ||
|
|
2406
|
+
}(t) || ir(t) || function() {
|
|
2468
2407
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2469
2408
|
}();
|
|
2470
2409
|
}
|
|
2471
|
-
function
|
|
2410
|
+
function nr(t, e) {
|
|
2472
2411
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2473
2412
|
if (!r) {
|
|
2474
|
-
if (Array.isArray(t) || (r =
|
|
2413
|
+
if (Array.isArray(t) || (r = ir(t)) || e && t && "number" == typeof t.length) {
|
|
2475
2414
|
r && (t = r);
|
|
2476
2415
|
var n = 0, o = function() {};
|
|
2477
2416
|
return {
|
|
@@ -2513,7 +2452,7 @@ var OHLCV_INDICATORS;
|
|
|
2513
2452
|
}
|
|
2514
2453
|
};
|
|
2515
2454
|
}
|
|
2516
|
-
function
|
|
2455
|
+
function or(t, e) {
|
|
2517
2456
|
return function(t) {
|
|
2518
2457
|
if (Array.isArray(t)) return t;
|
|
2519
2458
|
}
|
|
@@ -2521,45 +2460,45 @@ var OHLCV_INDICATORS;
|
|
|
2521
2460
|
(t) || function(t, e) {
|
|
2522
2461
|
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2523
2462
|
if (null != r) {
|
|
2524
|
-
var n, o, i, a, u = [],
|
|
2463
|
+
var n, o, i, a, u = [], c = !0, l = !1;
|
|
2525
2464
|
try {
|
|
2526
2465
|
if (i = (r = r.call(t)).next, 0 === e) {
|
|
2527
2466
|
if (Object(r) !== r) return;
|
|
2528
|
-
|
|
2529
|
-
} else for (;!(
|
|
2467
|
+
c = !1;
|
|
2468
|
+
} else for (;!(c = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); c = !0) ;
|
|
2530
2469
|
} catch (t) {
|
|
2531
|
-
|
|
2470
|
+
l = !0, o = t;
|
|
2532
2471
|
} finally {
|
|
2533
2472
|
try {
|
|
2534
|
-
if (!
|
|
2473
|
+
if (!c && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
2535
2474
|
} finally {
|
|
2536
|
-
if (
|
|
2475
|
+
if (l) throw o;
|
|
2537
2476
|
}
|
|
2538
2477
|
}
|
|
2539
2478
|
return u;
|
|
2540
2479
|
}
|
|
2541
|
-
}(t, e) ||
|
|
2480
|
+
}(t, e) || ir(t, e) || function() {
|
|
2542
2481
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2543
2482
|
}();
|
|
2544
2483
|
}
|
|
2545
|
-
function
|
|
2484
|
+
function ir(t, e) {
|
|
2546
2485
|
if (t) {
|
|
2547
|
-
if ("string" == typeof t) return
|
|
2486
|
+
if ("string" == typeof t) return ar(t, e);
|
|
2548
2487
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2549
|
-
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) ?
|
|
2488
|
+
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) ? ar(t, e) : void 0;
|
|
2550
2489
|
}
|
|
2551
2490
|
}
|
|
2552
|
-
function
|
|
2491
|
+
function ar(t, e) {
|
|
2553
2492
|
(null == e || e > t.length) && (e = t.length);
|
|
2554
2493
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2555
2494
|
return n;
|
|
2556
2495
|
}
|
|
2557
|
-
var
|
|
2496
|
+
var ur = {
|
|
2558
2497
|
dateTime: function(t, e, r) {
|
|
2559
2498
|
var n = r.lag, o = t.instances, i = t.verticalOhlcv;
|
|
2560
2499
|
if (0 === e) {
|
|
2561
|
-
var a = t.len;
|
|
2562
|
-
if (!
|
|
2500
|
+
var a = t.len, u = t.dateType, c = t.arrayTypes;
|
|
2501
|
+
if (!u) throw Error('dateTime method found and invalid "date" in input ohlcv');
|
|
2563
2502
|
Object.assign(o, {
|
|
2564
2503
|
dateTime: {
|
|
2565
2504
|
prevDateStr: i.date[0],
|
|
@@ -2568,23 +2507,25 @@ var OHLCV_INDICATORS;
|
|
|
2568
2507
|
cachedDayInfo: i.date[0]
|
|
2569
2508
|
}
|
|
2570
2509
|
});
|
|
2571
|
-
var
|
|
2510
|
+
for (var l = [ "day_of_the_week", "day_of_the_month", "week_of_the_month", "hour", "month", "year", "session_daily_index", "session_intraday_index" ], s = 0, f = l; s < f.length; s++) {
|
|
2511
|
+
c[f[s]] = "Int32Array";
|
|
2512
|
+
}
|
|
2572
2513
|
Object.assign(i, function(t) {
|
|
2573
2514
|
for (var e = 1; e < arguments.length; e++) {
|
|
2574
2515
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2575
|
-
e % 2 ?
|
|
2576
|
-
|
|
2577
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2516
|
+
e % 2 ? Ke(Object(r), !0).forEach((function(e) {
|
|
2517
|
+
Je(t, e, r[e]);
|
|
2518
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ke(Object(r)).forEach((function(e) {
|
|
2578
2519
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2579
2520
|
}));
|
|
2580
2521
|
}
|
|
2581
2522
|
return t;
|
|
2582
|
-
}({}, Object.fromEntries(
|
|
2523
|
+
}({}, Object.fromEntries(l.map((function(t) {
|
|
2583
2524
|
return [ t, new Int32Array(a).fill(NaN) ];
|
|
2584
|
-
}))))), n > 0 && t.lag(
|
|
2525
|
+
}))))), n > 0 && t.lag(l, n);
|
|
2585
2526
|
}
|
|
2586
|
-
var
|
|
2587
|
-
|
|
2527
|
+
var y = i.date[e], h = Ze(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 = y;
|
|
2528
|
+
w !== o.dateTime.prevDateStr && (o.dateTime.prevDateStr = w, o.dateTime.sessionDailyIndexCount++,
|
|
2588
2529
|
o.dateTime.sessionIntradayIndexCount = 0), t.pushToMain({
|
|
2589
2530
|
index: e,
|
|
2590
2531
|
key: "session_daily_index",
|
|
@@ -2596,471 +2537,490 @@ var OHLCV_INDICATORS;
|
|
|
2596
2537
|
}), t.pushToMain({
|
|
2597
2538
|
index: e,
|
|
2598
2539
|
key: "day_of_the_week",
|
|
2599
|
-
value:
|
|
2540
|
+
value: p
|
|
2600
2541
|
}), t.pushToMain({
|
|
2601
2542
|
index: e,
|
|
2602
2543
|
key: "day_of_the_month",
|
|
2603
|
-
value:
|
|
2544
|
+
value: v
|
|
2604
2545
|
}), t.pushToMain({
|
|
2605
2546
|
index: e,
|
|
2606
2547
|
key: "week_of_the_month",
|
|
2607
|
-
value:
|
|
2548
|
+
value: m
|
|
2608
2549
|
}), t.pushToMain({
|
|
2609
2550
|
index: e,
|
|
2610
2551
|
key: "month",
|
|
2611
|
-
value:
|
|
2552
|
+
value: d
|
|
2612
2553
|
}), t.pushToMain({
|
|
2613
2554
|
index: e,
|
|
2614
2555
|
key: "year",
|
|
2615
|
-
value:
|
|
2556
|
+
value: b
|
|
2616
2557
|
}), t.pushToMain({
|
|
2617
2558
|
index: e,
|
|
2618
2559
|
key: "hour",
|
|
2619
|
-
value:
|
|
2560
|
+
value: g
|
|
2620
2561
|
}), o.dateTime.sessionIntradayIndexCount++;
|
|
2621
2562
|
},
|
|
2622
2563
|
rsi: function(t, e, r, n) {
|
|
2623
|
-
var o = n.target, i = n.lag, a = t.verticalOhlcv, u = t.instances,
|
|
2564
|
+
var o = n.target, i = n.lag, a = t.verticalOhlcv, u = t.instances, c = "close" === o ? "" : "_".concat(o), l = "rsi_".concat(r).concat(c), s = "rsi_sma_".concat(r).concat(c);
|
|
2624
2565
|
// Initialization on the first index.
|
|
2625
2566
|
if (0 === e) {
|
|
2626
|
-
var
|
|
2567
|
+
var f = t.crossPairsList, y = t.len, h = t.arrayTypes;
|
|
2627
2568
|
if (!a.hasOwnProperty(o)) throw new Error("Target property ".concat(o, " not found in verticalOhlcv for rsi."));
|
|
2628
|
-
|
|
2629
|
-
fast:
|
|
2630
|
-
slow:
|
|
2569
|
+
f.push({
|
|
2570
|
+
fast: l,
|
|
2571
|
+
slow: s,
|
|
2631
2572
|
isDefault: !0
|
|
2632
|
-
}), Object.assign(u,
|
|
2633
|
-
|
|
2573
|
+
}), Object.assign(u, ae(ae({}, l, new oe(r)), s, new ut(r))), Object.assign(a, ae(ae({}, l, new Float64Array(y).fill(NaN)), s, new Float64Array(y).fill(NaN)));
|
|
2574
|
+
var p = [ l, s ];
|
|
2575
|
+
i > 0 && t.lag(p, i);
|
|
2576
|
+
for (var v = 0, m = p; v < m.length; v++) {
|
|
2577
|
+
h[m[v]] = "Float64Array";
|
|
2578
|
+
}
|
|
2634
2579
|
}
|
|
2635
|
-
var
|
|
2580
|
+
var d = a[o][e], b = NaN, g = NaN;
|
|
2636
2581
|
// Update the RSI indicator.
|
|
2637
|
-
u[
|
|
2582
|
+
u[l].update(d);
|
|
2638
2583
|
try {
|
|
2639
|
-
|
|
2584
|
+
b = u[l].getResult();
|
|
2640
2585
|
} catch (t) {
|
|
2641
|
-
|
|
2586
|
+
b = NaN;
|
|
2642
2587
|
}
|
|
2643
2588
|
// Always push the RSI value, using NaN as a fallback.
|
|
2644
2589
|
t.pushToMain({
|
|
2645
2590
|
index: e,
|
|
2646
|
-
key:
|
|
2647
|
-
value:
|
|
2591
|
+
key: l,
|
|
2592
|
+
value: b
|
|
2648
2593
|
}),
|
|
2649
2594
|
// Update the SMA indicator only if a valid RSI value is available.
|
|
2650
|
-
Number.isNaN(
|
|
2595
|
+
Number.isNaN(b) || u[s].update(b);
|
|
2651
2596
|
try {
|
|
2652
|
-
|
|
2597
|
+
g = u[s].getResult();
|
|
2653
2598
|
} catch (t) {
|
|
2654
|
-
|
|
2599
|
+
g = NaN;
|
|
2655
2600
|
}
|
|
2656
2601
|
// Always push the smoothed RSI value.
|
|
2657
2602
|
t.pushToMain({
|
|
2658
2603
|
index: e,
|
|
2659
|
-
key:
|
|
2660
|
-
value:
|
|
2604
|
+
key: s,
|
|
2605
|
+
value: g
|
|
2661
2606
|
});
|
|
2662
2607
|
},
|
|
2663
2608
|
ema: ce,
|
|
2664
2609
|
sma: ce,
|
|
2665
2610
|
macd: function(t, e, r, n, o, i) {
|
|
2666
|
-
var a = i.target, u = i.lag,
|
|
2611
|
+
var a = i.target, u = i.lag, c = t.verticalOhlcv, l = t.instances, s = "".concat(r, "_").concat(n, "_").concat(o).concat(a === fe ? "" : "_".concat(a));
|
|
2667
2612
|
// Initialization on the first index.
|
|
2668
2613
|
if (0 === e) {
|
|
2669
|
-
var
|
|
2670
|
-
if (!
|
|
2671
|
-
var
|
|
2614
|
+
var f = t.inputParams, y = t.crossPairsList, h = t.priceBased, p = t.len, v = t.arrayTypes;
|
|
2615
|
+
if (!c.hasOwnProperty(a)) throw new Error("Target property ".concat(a, " not found in verticalOhlcv for macd."));
|
|
2616
|
+
var m = f.filter((function(t) {
|
|
2672
2617
|
return "macd" === t.key;
|
|
2673
|
-
})).length,
|
|
2618
|
+
})).length, d = m > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", b = a === fe ? "".concat(d, "_diff") : "".concat(d, "_diff_").concat(a), g = a === fe ? "".concat(d, "_dea") : "".concat(d, "_dea_").concat(a), w = a === fe ? "".concat(d, "_histogram") : "".concat(d, "_histogram_").concat(a);
|
|
2674
2619
|
// Choose a display prefix based on the number of indicators.
|
|
2675
|
-
|
|
2620
|
+
y.push({
|
|
2676
2621
|
fast: b,
|
|
2677
2622
|
slow: g,
|
|
2678
2623
|
isDefault: !0
|
|
2679
|
-
}),
|
|
2680
|
-
numberOfIndicators:
|
|
2624
|
+
}), l.hasOwnProperty("macd") || (l.macd = {
|
|
2625
|
+
numberOfIndicators: m,
|
|
2681
2626
|
settings: {}
|
|
2682
|
-
}),
|
|
2683
|
-
|
|
2627
|
+
}), l.macd.settings[s] = new Gt(new Bt(r), new Bt(n), new Bt(o)), Object.assign(c, se(se(se({}, b, new Float64Array(p).fill(NaN)), g, new Float64Array(p).fill(NaN)), w, new Float64Array(p).fill(NaN))),
|
|
2628
|
+
[ b, g, w ].forEach((function(t) {
|
|
2629
|
+
h.add(t);
|
|
2630
|
+
}));
|
|
2631
|
+
var O = [ b, g, w ];
|
|
2632
|
+
u > 0 && t.lag(O, u);
|
|
2633
|
+
for (var S = 0, j = O; S < j.length; S++) {
|
|
2634
|
+
v[j[S]] = "Float64Array";
|
|
2635
|
+
}
|
|
2684
2636
|
}
|
|
2685
|
-
var
|
|
2686
|
-
x.update(
|
|
2687
|
-
var
|
|
2637
|
+
var P = l.macd, _ = P.numberOfIndicators, N = P.settings, T = _ > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", A = a === fe ? "".concat(T, "_diff") : "".concat(T, "_diff_").concat(a), E = a === fe ? "".concat(T, "_dea") : "".concat(T, "_dea_").concat(a), k = a === fe ? "".concat(T, "_histogram") : "".concat(T, "_histogram_").concat(a), x = N[s], M = c[a][e];
|
|
2638
|
+
x.update(M);
|
|
2639
|
+
var I = {};
|
|
2688
2640
|
try {
|
|
2689
|
-
|
|
2641
|
+
I = x.getResult();
|
|
2690
2642
|
} catch (t) {
|
|
2691
2643
|
// If the result is unavailable, macdResult remains NaN.
|
|
2692
2644
|
}
|
|
2693
2645
|
// Always push values; use NaN as fallback when macdResult is missing.
|
|
2694
2646
|
return t.pushToMain({
|
|
2695
2647
|
index: e,
|
|
2696
|
-
key:
|
|
2697
|
-
value:
|
|
2648
|
+
key: A,
|
|
2649
|
+
value: I ? I.macd : NaN
|
|
2698
2650
|
}), t.pushToMain({
|
|
2699
2651
|
index: e,
|
|
2700
|
-
key:
|
|
2701
|
-
value:
|
|
2652
|
+
key: E,
|
|
2653
|
+
value: I ? I.signal : NaN
|
|
2702
2654
|
}), t.pushToMain({
|
|
2703
2655
|
index: e,
|
|
2704
|
-
key:
|
|
2705
|
-
value:
|
|
2656
|
+
key: k,
|
|
2657
|
+
value: I ? I.histogram : NaN
|
|
2706
2658
|
}), !0;
|
|
2707
2659
|
},
|
|
2708
2660
|
relativeVolume: function(t, e, r, n) {
|
|
2709
|
-
var o = n.lag, i = "relative_volume_".concat(r), a = t.instances, u = t.verticalOhlcv
|
|
2661
|
+
var o = n.lag, i = "relative_volume_".concat(r), a = t.instances, u = t.verticalOhlcv;
|
|
2710
2662
|
if (0 === e) {
|
|
2711
|
-
var c = t.len;
|
|
2663
|
+
var c = t.len, l = t.arrayTypes;
|
|
2712
2664
|
a[i] = {
|
|
2713
|
-
instance: new
|
|
2665
|
+
instance: new ut(r),
|
|
2714
2666
|
prevRelativeVolumeSma: NaN
|
|
2715
|
-
}, u[i] = new Float64Array(c).fill(NaN), o > 0 && t.lag([ i ], o);
|
|
2667
|
+
}, u[i] = new Float64Array(c).fill(NaN), o > 0 && t.lag([ i ], o), l[i] = "Float64Array";
|
|
2716
2668
|
}
|
|
2717
2669
|
var s = u.volume[e], f = a[i].instance;
|
|
2718
|
-
f.update(s
|
|
2719
|
-
var
|
|
2670
|
+
f.update(s);
|
|
2671
|
+
var y = NaN;
|
|
2720
2672
|
try {
|
|
2721
|
-
|
|
2673
|
+
y = f.getResult();
|
|
2722
2674
|
} catch (t) {}
|
|
2723
|
-
var
|
|
2675
|
+
var h = a[i].prevRelativeVolumeSma, p = NaN;
|
|
2724
2676
|
// Only calculate relative volume if both current SMA and previous SMA are valid numbers and prevSma is not zero.
|
|
2725
|
-
return Number.isNaN(
|
|
2677
|
+
return Number.isNaN(y) || Number.isNaN(h) || (p = s / h), t.pushToMain({
|
|
2726
2678
|
index: e,
|
|
2727
2679
|
key: i,
|
|
2728
|
-
value:
|
|
2729
|
-
}), a[i].prevRelativeVolumeSma =
|
|
2680
|
+
value: p
|
|
2681
|
+
}), a[i].prevRelativeVolumeSma = y, !0;
|
|
2730
2682
|
},
|
|
2731
2683
|
donchianChannels: function(t, e, r, n, o) {
|
|
2732
|
-
var i = o.height, a = o.range, u = o.lag,
|
|
2733
|
-
t.lastIndexReplace;
|
|
2684
|
+
var i = o.height, a = o.range, u = o.lag, c = "".concat(r, "_").concat(n), l = t.verticalOhlcv, s = t.instances, f = t.len;
|
|
2734
2685
|
// Initialization: create output arrays and indicator instance on the first call.
|
|
2735
2686
|
if (0 === e) {
|
|
2736
|
-
var
|
|
2687
|
+
var y = t.inputParams, h = t.priceBased, p = t.arrayTypes, v = y.filter((function(t) {
|
|
2737
2688
|
return "donchianChannels" === t.key;
|
|
2738
|
-
})).length,
|
|
2739
|
-
i && d.push("".concat(
|
|
2740
|
-
numberOfIndicators:
|
|
2689
|
+
})).length, m = v > 1 ? "donchian_channel_".concat(c) : "donchian_channel", d = [ "".concat(m, "_upper"), "".concat(m, "_basis"), "".concat(m, "_lower") ];
|
|
2690
|
+
i && d.push("".concat(m, "_height")), s.hasOwnProperty("donchian_channel") || (s.donchian_channel = {
|
|
2691
|
+
numberOfIndicators: v,
|
|
2741
2692
|
settings: {}
|
|
2742
2693
|
});
|
|
2743
2694
|
// Set up additional arrays for each range property.
|
|
2744
|
-
var
|
|
2695
|
+
var b, g = ve(a);
|
|
2745
2696
|
try {
|
|
2746
|
-
for (
|
|
2747
|
-
var
|
|
2748
|
-
if (!(
|
|
2749
|
-
d.push("".concat(
|
|
2697
|
+
for (g.s(); !(b = g.n()).done; ) {
|
|
2698
|
+
var w = b.value;
|
|
2699
|
+
if (!(w in l) || !h.has(w)) throw new Error('Invalid range item value "'.concat(w, '" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(h)));
|
|
2700
|
+
d.push("".concat(m, "_range_").concat(w));
|
|
2750
2701
|
}
|
|
2751
2702
|
} catch (t) {
|
|
2752
|
-
|
|
2703
|
+
g.e(t);
|
|
2753
2704
|
} finally {
|
|
2754
|
-
|
|
2705
|
+
g.f();
|
|
2755
2706
|
}
|
|
2756
|
-
var
|
|
2707
|
+
var O = Object.fromEntries(d.map((function(t) {
|
|
2757
2708
|
return [ t, new Float64Array(f).fill(NaN) ];
|
|
2758
2709
|
})));
|
|
2759
|
-
Object.assign(
|
|
2710
|
+
Object.assign(l, function(t) {
|
|
2760
2711
|
for (var e = 1; e < arguments.length; e++) {
|
|
2761
2712
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2762
|
-
e % 2 ?
|
|
2763
|
-
|
|
2764
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2713
|
+
e % 2 ? he(Object(r), !0).forEach((function(e) {
|
|
2714
|
+
pe(t, e, r[e]);
|
|
2715
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : he(Object(r)).forEach((function(e) {
|
|
2765
2716
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2766
2717
|
}));
|
|
2767
2718
|
}
|
|
2768
2719
|
return t;
|
|
2769
|
-
}({},
|
|
2770
|
-
|
|
2720
|
+
}({}, O)), u > 0 && t.lag(d, u), [ "".concat(m, "_upper"), "".concat(m, "_basis"), "".concat(m, "_lower") ].forEach((function(t) {
|
|
2721
|
+
h.add(t);
|
|
2722
|
+
})), s.donchian_channel.settings[c] = {
|
|
2771
2723
|
maxDeque: [],
|
|
2772
2724
|
// will hold indices for highs in descending order
|
|
2773
2725
|
minDeque: []
|
|
2774
2726
|
};
|
|
2727
|
+
for (var S = 0, j = d; S < j.length; S++) {
|
|
2728
|
+
p[j[S]] = "Float64Array";
|
|
2729
|
+
}
|
|
2775
2730
|
}
|
|
2776
|
-
var
|
|
2731
|
+
var P = s.donchian_channel.numberOfIndicators > 1 ? "donchian_channel_".concat(c) : "donchian_channel", _ = s.donchian_channel.settings[c], N = _.maxDeque, T = _.minDeque, A = e - n, E = A + 1, k = E - r;
|
|
2777
2732
|
// window: [startIdx, endIdx)
|
|
2778
2733
|
// If the window is not fully available, push NaN values for all computed outputs.
|
|
2779
|
-
if (
|
|
2734
|
+
if (k < 0 || E > f) {
|
|
2780
2735
|
t.pushToMain({
|
|
2781
2736
|
index: e,
|
|
2782
|
-
key: "".concat(
|
|
2737
|
+
key: "".concat(P, "_upper"),
|
|
2783
2738
|
value: NaN
|
|
2784
2739
|
}), t.pushToMain({
|
|
2785
2740
|
index: e,
|
|
2786
|
-
key: "".concat(
|
|
2741
|
+
key: "".concat(P, "_basis"),
|
|
2787
2742
|
value: NaN
|
|
2788
2743
|
}), t.pushToMain({
|
|
2789
2744
|
index: e,
|
|
2790
|
-
key: "".concat(
|
|
2745
|
+
key: "".concat(P, "_lower"),
|
|
2791
2746
|
value: NaN
|
|
2792
2747
|
}), i && t.pushToMain({
|
|
2793
2748
|
index: e,
|
|
2794
|
-
key: "".concat(
|
|
2749
|
+
key: "".concat(P, "_height"),
|
|
2795
2750
|
value: NaN
|
|
2796
2751
|
});
|
|
2797
|
-
var x,
|
|
2752
|
+
var x, M = ve(a);
|
|
2798
2753
|
try {
|
|
2799
|
-
for (
|
|
2800
|
-
var
|
|
2754
|
+
for (M.s(); !(x = M.n()).done; ) {
|
|
2755
|
+
var I = x.value;
|
|
2801
2756
|
t.pushToMain({
|
|
2802
2757
|
index: e,
|
|
2803
|
-
key: "".concat(
|
|
2758
|
+
key: "".concat(P, "_range_").concat(I),
|
|
2804
2759
|
value: NaN
|
|
2805
2760
|
});
|
|
2806
2761
|
}
|
|
2807
2762
|
} catch (t) {
|
|
2808
|
-
|
|
2763
|
+
M.e(t);
|
|
2809
2764
|
} finally {
|
|
2810
|
-
|
|
2765
|
+
M.f();
|
|
2811
2766
|
}
|
|
2812
2767
|
return !0;
|
|
2813
2768
|
}
|
|
2814
2769
|
// **Update the maximum deque:**
|
|
2815
|
-
for (var
|
|
2816
|
-
for (;
|
|
2770
|
+
for (var D = l.high, R = l.low; N.length && N[0] < k; ) N.shift();
|
|
2771
|
+
for (;N.length && D[N[N.length - 1]] <= D[A]; ) N.pop();
|
|
2817
2772
|
// **Update the minimum deque:**
|
|
2818
|
-
for (
|
|
2819
|
-
for (;
|
|
2820
|
-
|
|
2773
|
+
for (N.push(A); T.length && T[0] < k; ) T.shift();
|
|
2774
|
+
for (;T.length && R[T[T.length - 1]] >= R[A]; ) T.pop();
|
|
2775
|
+
T.push(A);
|
|
2821
2776
|
// Retrieve computed values with safety checks.
|
|
2822
|
-
var
|
|
2777
|
+
var C = N.length ? D[N[0]] : NaN, F = T.length ? R[T[0]] : NaN, L = Number.isNaN(C) || Number.isNaN(F) ? NaN : (C + F) / 2;
|
|
2823
2778
|
// Process height if enabled.
|
|
2824
2779
|
if (
|
|
2825
2780
|
// Always push the main indicator values.
|
|
2826
2781
|
t.pushToMain({
|
|
2827
2782
|
index: e,
|
|
2828
|
-
key: "".concat(
|
|
2829
|
-
value:
|
|
2783
|
+
key: "".concat(P, "_upper"),
|
|
2784
|
+
value: C
|
|
2830
2785
|
}), t.pushToMain({
|
|
2831
2786
|
index: e,
|
|
2832
|
-
key: "".concat(
|
|
2833
|
-
value:
|
|
2787
|
+
key: "".concat(P, "_basis"),
|
|
2788
|
+
value: L
|
|
2834
2789
|
}), t.pushToMain({
|
|
2835
2790
|
index: e,
|
|
2836
|
-
key: "".concat(
|
|
2837
|
-
value:
|
|
2791
|
+
key: "".concat(P, "_lower"),
|
|
2792
|
+
value: F
|
|
2838
2793
|
}), i) {
|
|
2839
|
-
var
|
|
2840
|
-
Number.isNaN(
|
|
2794
|
+
var B = NaN;
|
|
2795
|
+
Number.isNaN(C) || Number.isNaN(F) || (B = (C - F) / F), t.pushToMain({
|
|
2841
2796
|
index: e,
|
|
2842
|
-
key: "".concat(
|
|
2843
|
-
value:
|
|
2797
|
+
key: "".concat(P, "_height"),
|
|
2798
|
+
value: B
|
|
2844
2799
|
});
|
|
2845
2800
|
}
|
|
2846
2801
|
// Process each range property.
|
|
2847
|
-
var
|
|
2802
|
+
var H, V = ve(a);
|
|
2848
2803
|
try {
|
|
2849
|
-
for (
|
|
2850
|
-
var
|
|
2851
|
-
Number.isNaN(
|
|
2804
|
+
for (V.s(); !(H = V.n()).done; ) {
|
|
2805
|
+
var U = H.value, q = NaN, $ = l[U][e];
|
|
2806
|
+
Number.isNaN($) || Number.isNaN(C) || Number.isNaN(F) || (q = ($ - F) / (C - F)),
|
|
2852
2807
|
t.pushToMain({
|
|
2853
2808
|
index: e,
|
|
2854
|
-
key: "".concat(
|
|
2855
|
-
value:
|
|
2809
|
+
key: "".concat(P, "_range_").concat(U),
|
|
2810
|
+
value: q
|
|
2856
2811
|
});
|
|
2857
2812
|
}
|
|
2858
2813
|
} catch (t) {
|
|
2859
|
-
|
|
2814
|
+
V.e(t);
|
|
2860
2815
|
} finally {
|
|
2861
|
-
|
|
2816
|
+
V.f();
|
|
2862
2817
|
}
|
|
2863
2818
|
return !0;
|
|
2864
2819
|
},
|
|
2865
2820
|
bollingerBands: function(t, e, r, n, o) {
|
|
2866
|
-
var i, a, u,
|
|
2821
|
+
var i, a, u, c, l, s, f, y = o.height, h = o.range, p = void 0 === h ? [] : h, v = o.target, m = o.lag, d = t.verticalOhlcv, b = t.instances, g = "close" === v ? "" : "_".concat(v), w = "".concat(r, "_").concat(n).concat(g);
|
|
2867
2822
|
// Initialization on the first call.
|
|
2868
2823
|
if (0 === e) {
|
|
2869
|
-
var
|
|
2870
|
-
if (!(v in
|
|
2871
|
-
var N =
|
|
2824
|
+
var O = t.priceBased, S = t.inputParams, j = t.verticalOhlcv, P = t.len, _ = t.arrayTypes;
|
|
2825
|
+
if (!(v in j)) throw new Error('bollingerBands could not find target "'.concat(v, '"'));
|
|
2826
|
+
var N = S.filter((function(t) {
|
|
2872
2827
|
return "bollingerBands" === t.key;
|
|
2873
2828
|
})).length;
|
|
2874
|
-
f = N > 1 ? "bollinger_bands_".concat(
|
|
2829
|
+
f = N > 1 ? "bollinger_bands_".concat(w) : "bollinger_bands".concat(g),
|
|
2875
2830
|
// Only create the container if it doesn't already exist.
|
|
2876
2831
|
b.bollinger_bands || (b.bollinger_bands = {
|
|
2877
2832
|
numberOfIndicators: N,
|
|
2878
2833
|
settings: {}
|
|
2879
2834
|
}),
|
|
2880
2835
|
// Add (or override) the indicator instance keyed by indicatorKey.
|
|
2881
|
-
b.bollinger_bands.settings[
|
|
2882
|
-
var
|
|
2883
|
-
|
|
2836
|
+
b.bollinger_bands.settings[w] = new Tt(r, n);
|
|
2837
|
+
var T = [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ];
|
|
2838
|
+
y && T.push("".concat(f, "_height"));
|
|
2884
2839
|
// Set up additional arrays for each range property.
|
|
2885
|
-
var
|
|
2840
|
+
var A, E = we(p);
|
|
2886
2841
|
try {
|
|
2887
|
-
for (E.s(); !(
|
|
2888
|
-
var
|
|
2889
|
-
if (!(
|
|
2890
|
-
|
|
2842
|
+
for (E.s(); !(A = E.n()).done; ) {
|
|
2843
|
+
var k = A.value;
|
|
2844
|
+
if (!(k in j) || !O.has(k)) throw new Error('Invalid range item value "'.concat(k, '" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(O)));
|
|
2845
|
+
T.push("".concat(f, "_range_").concat(k));
|
|
2891
2846
|
}
|
|
2892
2847
|
} catch (t) {
|
|
2893
2848
|
E.e(t);
|
|
2894
2849
|
} finally {
|
|
2895
2850
|
E.f();
|
|
2896
2851
|
}
|
|
2897
|
-
var
|
|
2898
|
-
return [ t, new Float64Array(
|
|
2852
|
+
var x = Object.fromEntries(T.map((function(t) {
|
|
2853
|
+
return [ t, new Float64Array(P).fill(NaN) ];
|
|
2899
2854
|
})));
|
|
2900
|
-
Object.assign(
|
|
2855
|
+
Object.assign(j, function(t) {
|
|
2901
2856
|
for (var e = 1; e < arguments.length; e++) {
|
|
2902
2857
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2903
|
-
e % 2 ?
|
|
2904
|
-
|
|
2905
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2858
|
+
e % 2 ? be(Object(r), !0).forEach((function(e) {
|
|
2859
|
+
ge(t, e, r[e]);
|
|
2860
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : be(Object(r)).forEach((function(e) {
|
|
2906
2861
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2907
2862
|
}));
|
|
2908
2863
|
}
|
|
2909
2864
|
return t;
|
|
2910
|
-
}({},
|
|
2865
|
+
}({}, x)), m > 0 && t.lag(T, m), [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ].forEach((function(t) {
|
|
2866
|
+
O.add(t);
|
|
2867
|
+
}));
|
|
2868
|
+
for (var M = 0, I = T; M < I.length; M++) {
|
|
2869
|
+
_[I[M]] = "Float64Array";
|
|
2870
|
+
}
|
|
2911
2871
|
}
|
|
2912
2872
|
// Derive prefix for subsequent calls if not set.
|
|
2913
|
-
f || (f = b.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(
|
|
2914
|
-
var
|
|
2873
|
+
f || (f = b.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(w) : "bollinger_bands".concat(g));
|
|
2874
|
+
var D = f, R = b.bollinger_bands.settings[w], C = d[v][e];
|
|
2915
2875
|
// Update the indicator with the current value.
|
|
2916
|
-
|
|
2876
|
+
R.update(C);
|
|
2917
2877
|
// Attempt to retrieve the result.
|
|
2918
|
-
var
|
|
2878
|
+
var F = {};
|
|
2919
2879
|
try {
|
|
2920
|
-
|
|
2880
|
+
F = R.getResult();
|
|
2921
2881
|
} catch (t) {
|
|
2922
2882
|
// If not available, result stays {}.
|
|
2923
2883
|
}
|
|
2924
2884
|
// Use NaN fallbacks for the primary values.
|
|
2925
|
-
var
|
|
2885
|
+
var L = null !== (i = null === (a = F) || void 0 === a ? void 0 : a.upper) && void 0 !== i ? i : NaN, B = null !== (u = null === (c = F) || void 0 === c ? void 0 : c.middle) && void 0 !== u ? u : NaN, H = null !== (l = null === (s = F) || void 0 === s ? void 0 : s.lower) && void 0 !== l ? l : NaN;
|
|
2926
2886
|
// Process height if requested.
|
|
2927
2887
|
if (
|
|
2928
2888
|
// Always push the indicator outputs.
|
|
2929
2889
|
t.pushToMain({
|
|
2930
2890
|
index: e,
|
|
2931
|
-
key: "".concat(
|
|
2932
|
-
value: R
|
|
2933
|
-
}), t.pushToMain({
|
|
2934
|
-
index: e,
|
|
2935
|
-
key: "".concat(I, "_middle"),
|
|
2891
|
+
key: "".concat(D, "_upper"),
|
|
2936
2892
|
value: L
|
|
2937
2893
|
}), t.pushToMain({
|
|
2938
2894
|
index: e,
|
|
2939
|
-
key: "".concat(
|
|
2895
|
+
key: "".concat(D, "_middle"),
|
|
2940
2896
|
value: B
|
|
2941
|
-
}),
|
|
2942
|
-
|
|
2943
|
-
|
|
2897
|
+
}), t.pushToMain({
|
|
2898
|
+
index: e,
|
|
2899
|
+
key: "".concat(D, "_lower"),
|
|
2900
|
+
value: H
|
|
2901
|
+
}), y) {
|
|
2902
|
+
var V = NaN;
|
|
2903
|
+
Number.isNaN(H) || Number.isNaN(L) || (V = (L - H) / H), t.pushToMain({
|
|
2944
2904
|
index: e,
|
|
2945
|
-
key: "".concat(
|
|
2946
|
-
value:
|
|
2905
|
+
key: "".concat(D, "_height"),
|
|
2906
|
+
value: V
|
|
2947
2907
|
});
|
|
2948
2908
|
}
|
|
2949
2909
|
// Process each range property.
|
|
2950
|
-
var
|
|
2910
|
+
var U, q = we(p);
|
|
2951
2911
|
try {
|
|
2952
|
-
for (
|
|
2953
|
-
var
|
|
2954
|
-
Number.isNaN(
|
|
2912
|
+
for (q.s(); !(U = q.n()).done; ) {
|
|
2913
|
+
var $ = U.value, z = NaN, G = d[$][e];
|
|
2914
|
+
Number.isNaN(G) || Number.isNaN(H) || Number.isNaN(L) || (z = (G - H) / (L - H)),
|
|
2955
2915
|
t.pushToMain({
|
|
2956
2916
|
index: e,
|
|
2957
|
-
key: "".concat(
|
|
2958
|
-
value:
|
|
2917
|
+
key: "".concat(D, "_range_").concat($),
|
|
2918
|
+
value: z
|
|
2959
2919
|
});
|
|
2960
2920
|
}
|
|
2961
2921
|
} catch (t) {
|
|
2962
|
-
|
|
2922
|
+
q.e(t);
|
|
2963
2923
|
} finally {
|
|
2964
|
-
|
|
2924
|
+
q.f();
|
|
2965
2925
|
}
|
|
2966
2926
|
return !0;
|
|
2967
2927
|
},
|
|
2968
2928
|
volumeOscillator: function(t, e, r, n, o) {
|
|
2969
|
-
var i = o.lag, a = t.verticalOhlcv, u = t.instances,
|
|
2929
|
+
var i = o.lag, a = t.verticalOhlcv, u = t.instances, c = a.volume[e], l = "volume_oscillator";
|
|
2970
2930
|
if (0 === e) {
|
|
2971
|
-
var
|
|
2931
|
+
var s = t.crossPairsList, f = t.len, y = t.arrayTypes;
|
|
2972
2932
|
Object.assign(u, {
|
|
2973
2933
|
volume_oscillator: {
|
|
2974
|
-
fastEMA: new
|
|
2975
|
-
slowEMA: new
|
|
2934
|
+
fastEMA: new Bt(r),
|
|
2935
|
+
slowEMA: new Bt(n)
|
|
2976
2936
|
}
|
|
2977
|
-
}), a[
|
|
2978
|
-
fast:
|
|
2937
|
+
}), a[l] = new Float64Array(f).fill(NaN), s.push({
|
|
2938
|
+
fast: l,
|
|
2979
2939
|
slow: 0,
|
|
2980
2940
|
isDefault: !0
|
|
2981
|
-
}), i > 0 && t.lag([
|
|
2941
|
+
}), i > 0 && t.lag([ l ], i), y[l] = "Float64Array";
|
|
2982
2942
|
}
|
|
2983
|
-
var
|
|
2984
|
-
|
|
2985
|
-
var
|
|
2943
|
+
var h = u[l], p = h.fastEMA, v = h.slowEMA;
|
|
2944
|
+
p.update(c), v.update(c);
|
|
2945
|
+
var m = NaN, d = NaN;
|
|
2986
2946
|
try {
|
|
2987
|
-
|
|
2947
|
+
m = p.getResult();
|
|
2988
2948
|
} catch (t) {}
|
|
2989
2949
|
try {
|
|
2990
|
-
|
|
2950
|
+
d = v.getResult();
|
|
2991
2951
|
} catch (t) {}
|
|
2992
2952
|
var b = NaN;
|
|
2993
|
-
return Number.isNaN(
|
|
2953
|
+
return Number.isNaN(m) || Number.isNaN(d) || (b = 100 * (m - d) / d), t.pushToMain({
|
|
2994
2954
|
index: e,
|
|
2995
|
-
key:
|
|
2955
|
+
key: l,
|
|
2996
2956
|
value: b
|
|
2997
2957
|
}), !0;
|
|
2998
2958
|
},
|
|
2999
2959
|
Scaler: function(t, e, r, n, o, i, a,
|
|
3000
2960
|
// used for minmax: [validMin, validMax]
|
|
3001
2961
|
u) {
|
|
3002
|
-
var
|
|
2962
|
+
var c = t.verticalOhlcv, l = t.instances, s = t.arrayTypes, f = "".concat(o, "_").concat(r), y = "";
|
|
3003
2963
|
if (0 === e) {
|
|
3004
|
-
var
|
|
2964
|
+
var h = t.len, p = t.priceBased;
|
|
3005
2965
|
t.groups;
|
|
3006
|
-
|
|
2966
|
+
y = "".concat(f, "_group_").concat(n.join("_")), l.scaler = {
|
|
3007
2967
|
groupKeyLen: n.length,
|
|
3008
|
-
groupKey:
|
|
2968
|
+
groupKey: y,
|
|
3009
2969
|
windows: {}
|
|
3010
2970
|
};
|
|
3011
|
-
var v,
|
|
2971
|
+
var v, m = We(n);
|
|
3012
2972
|
try {
|
|
3013
|
-
var
|
|
2973
|
+
var d = function() {
|
|
3014
2974
|
var e = v.value;
|
|
3015
|
-
if (!
|
|
3016
|
-
if (!
|
|
2975
|
+
if (!c.hasOwnProperty(e)) throw new Error('Target property "'.concat(e, '" not found in verticalOhlcv'));
|
|
2976
|
+
if (!p.has(e)) throw new Error('Column "'.concat(e, '" is not priceBased and cannot be scaled.'));
|
|
3017
2977
|
var r = "".concat(f, "_").concat(e);
|
|
3018
|
-
|
|
3019
|
-
var n = i ?
|
|
3020
|
-
if (
|
|
3021
|
-
t.ScaledGroups[
|
|
2978
|
+
c[r] = new Float64Array(h).fill(NaN), s[r] = "Float64Array";
|
|
2979
|
+
var n = i ? y : e;
|
|
2980
|
+
if (l.scaler.windows[n] = [], i && (t.ScaledGroups[y] || (t.ScaledGroups[y] = []),
|
|
2981
|
+
t.ScaledGroups[y].push(r)), u > 0) {
|
|
3022
2982
|
if (i) {
|
|
3023
2983
|
var o, a = Array.from({
|
|
3024
2984
|
length: u
|
|
3025
2985
|
}).map((function(t, e) {
|
|
3026
2986
|
return "".concat(r, "_lag_").concat(e + 1);
|
|
3027
2987
|
}));
|
|
3028
|
-
(o = t.ScaledGroups[
|
|
2988
|
+
(o = t.ScaledGroups[y]).push.apply(o, Qe(a));
|
|
3029
2989
|
}
|
|
3030
2990
|
t.lag([ r ], u);
|
|
3031
2991
|
}
|
|
3032
2992
|
};
|
|
3033
|
-
for (
|
|
2993
|
+
for (m.s(); !(v = m.n()).done; ) d();
|
|
3034
2994
|
} catch (t) {
|
|
3035
|
-
|
|
2995
|
+
m.e(t);
|
|
3036
2996
|
} finally {
|
|
3037
|
-
|
|
2997
|
+
m.f();
|
|
3038
2998
|
}
|
|
3039
2999
|
}
|
|
3040
|
-
var b =
|
|
3041
|
-
|
|
3000
|
+
var b = l.scaler.windows;
|
|
3001
|
+
y = l.scaler.groupKey;
|
|
3042
3002
|
// update windows with current values
|
|
3043
|
-
var g, w =
|
|
3003
|
+
var g, w = We(n);
|
|
3044
3004
|
try {
|
|
3045
3005
|
for (w.s(); !(g = w.n()).done; ) {
|
|
3046
|
-
var O = g.value, S =
|
|
3047
|
-
|
|
3006
|
+
var O = g.value, S = c[O][e], j = b[i ? y : O];
|
|
3007
|
+
j.push(S), j.length > (i ? r * l.scaler.groupKeyLen : r) && j.shift();
|
|
3048
3008
|
}
|
|
3049
3009
|
} catch (t) {
|
|
3050
3010
|
w.e(t);
|
|
3051
3011
|
} finally {
|
|
3052
3012
|
w.f();
|
|
3053
3013
|
}
|
|
3054
|
-
var P, _ = e + 1 >= r, N =
|
|
3014
|
+
var P, _ = e + 1 >= r, N = We(n);
|
|
3055
3015
|
// scale values once enough data
|
|
3056
3016
|
try {
|
|
3057
|
-
var
|
|
3058
|
-
var r, n, u,
|
|
3017
|
+
var T = function() {
|
|
3018
|
+
var r, n, u, l, s, h, p = P.value, v = c[p][e], m = "".concat(f, "_").concat(p), d = null;
|
|
3059
3019
|
if (_) {
|
|
3060
|
-
var g = b[i ?
|
|
3020
|
+
var g = b[i ? y : p];
|
|
3061
3021
|
if ("minmax" === o) {
|
|
3062
|
-
var w = Math.min.apply(Math,
|
|
3063
|
-
r = v, n = w, u = O,
|
|
3022
|
+
var w = Math.min.apply(Math, Qe(g)), O = Math.max.apply(Math, Qe(g));
|
|
3023
|
+
r = v, n = w, u = O, l = Xe(a, 2), s = l[0], h = l[1], d = (Math.min(Math.max(r, n), u) - n) / (u - n) * (h - s) + s;
|
|
3064
3024
|
} else {
|
|
3065
3025
|
if ("zscore" !== o) throw new Error('Unknown scaler type "'.concat(o, '"'));
|
|
3066
3026
|
var S = g.reduce((function(t, e) {
|
|
@@ -3068,223 +3028,187 @@ var OHLCV_INDICATORS;
|
|
|
3068
3028
|
}), 0) / g.length, j = g.reduce((function(t, e) {
|
|
3069
3029
|
return t + Math.pow(e - S, 2);
|
|
3070
3030
|
}), 0) / g.length, N = Math.sqrt(j);
|
|
3071
|
-
|
|
3031
|
+
d = function(t, e, r) {
|
|
3072
3032
|
return 0 === r ? 0 : (t - e) / r;
|
|
3073
3033
|
}(v, S, N);
|
|
3074
3034
|
}
|
|
3075
3035
|
}
|
|
3076
3036
|
t.pushToMain({
|
|
3077
3037
|
index: e,
|
|
3078
|
-
key:
|
|
3079
|
-
value:
|
|
3038
|
+
key: m,
|
|
3039
|
+
value: d
|
|
3080
3040
|
});
|
|
3081
3041
|
};
|
|
3082
|
-
for (N.s(); !(P = N.n()).done; )
|
|
3042
|
+
for (N.s(); !(P = N.n()).done; ) T();
|
|
3083
3043
|
} catch (t) {
|
|
3084
3044
|
N.e(t);
|
|
3085
3045
|
} finally {
|
|
3086
3046
|
N.f();
|
|
3087
3047
|
}
|
|
3088
3048
|
}
|
|
3089
|
-
},
|
|
3090
|
-
var r =
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
var l = a.value;
|
|
3101
|
-
if ("number" == typeof l && l > o) throw console.log(l, o), 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.");
|
|
3102
|
-
}
|
|
3103
|
-
} catch (t) {
|
|
3104
|
-
u.e(t);
|
|
3105
|
-
} finally {
|
|
3106
|
-
u.f();
|
|
3049
|
+
}, cr = function(t, e) {
|
|
3050
|
+
var r = e.len, o = e.inputParams, i = e.priceBased, a = e.precisionMultiplier, u = e.arrayTypes, c = e.verticalOhlcv, l = e.verticalOhlcvKeyNames, s = e.inputTypes;
|
|
3051
|
+
!function(t) {
|
|
3052
|
+
var e, r = t.inputParams, o = t.len, i = n(r);
|
|
3053
|
+
try {
|
|
3054
|
+
for (i.s(); !(e = i.n()).done; ) {
|
|
3055
|
+
var a, u = n(e.value.params);
|
|
3056
|
+
try {
|
|
3057
|
+
for (u.s(); !(a = u.n()).done; ) {
|
|
3058
|
+
var c = a.value;
|
|
3059
|
+
if ("number" == typeof c && c > o) throw console.log(c, o), 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.");
|
|
3107
3060
|
}
|
|
3061
|
+
} catch (t) {
|
|
3062
|
+
u.e(t);
|
|
3063
|
+
} finally {
|
|
3064
|
+
u.f();
|
|
3108
3065
|
}
|
|
3109
|
-
} catch (t) {
|
|
3110
|
-
i.e(t);
|
|
3111
|
-
} finally {
|
|
3112
|
-
i.f();
|
|
3113
3066
|
}
|
|
3114
|
-
}(
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3067
|
+
} catch (t) {
|
|
3068
|
+
i.e(t);
|
|
3069
|
+
} finally {
|
|
3070
|
+
i.f();
|
|
3118
3071
|
}
|
|
3072
|
+
}({
|
|
3073
|
+
inputParams: o,
|
|
3074
|
+
len: r
|
|
3075
|
+
});
|
|
3076
|
+
for (var f = 0, y = Object.keys(s); f < y.length; f++) {
|
|
3077
|
+
var h = y[f];
|
|
3078
|
+
c[h] = xe(u[h], r);
|
|
3119
3079
|
}
|
|
3120
|
-
//
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
fn: sr[e],
|
|
3128
|
-
args: r
|
|
3129
|
-
};
|
|
3130
|
-
})) : [];
|
|
3131
|
-
}(i), p = r; p < o; p++) {
|
|
3132
|
-
for (var y = t[p], v = 0, d = Object.entries(e.inputTypes); v < d.length; v++) {
|
|
3133
|
-
var m = ur(d[v], 2), b = m[0], g = m[1], w = y[b];
|
|
3134
|
-
if (Ne.hasOwnProperty(g)) {
|
|
3135
|
-
var O = Ne[g](w);
|
|
3136
|
-
u > 1 && a.includes(b) && (O *= u), e.pushToMain({
|
|
3080
|
+
// Process each row in the input
|
|
3081
|
+
for (var p = 0; p < r; p++) {
|
|
3082
|
+
for (var v = t[p], m = 0, d = Object.entries(s); m < d.length; m++) {
|
|
3083
|
+
var b = or(d[m], 2), g = b[0], w = b[1], O = v[g];
|
|
3084
|
+
if (je.hasOwnProperty(w)) {
|
|
3085
|
+
var S = je[w](O);
|
|
3086
|
+
a > 1 && i.has(g) && (S *= a), e.pushToMain({
|
|
3137
3087
|
index: p,
|
|
3138
|
-
key:
|
|
3139
|
-
value:
|
|
3088
|
+
key: g,
|
|
3089
|
+
value: S
|
|
3140
3090
|
});
|
|
3141
|
-
} else
|
|
3091
|
+
} else Ne.hasOwnProperty(w) ? e.pushToMain({
|
|
3142
3092
|
index: p,
|
|
3143
|
-
key:
|
|
3144
|
-
value:
|
|
3093
|
+
key: g,
|
|
3094
|
+
value: Ne[w](O)
|
|
3145
3095
|
}) : e.pushToMain({
|
|
3146
3096
|
index: p,
|
|
3147
|
-
key:
|
|
3148
|
-
value:
|
|
3097
|
+
key: g,
|
|
3098
|
+
value: O
|
|
3149
3099
|
});
|
|
3150
3100
|
}
|
|
3151
3101
|
// Run all indicator functions except for the ones processed later
|
|
3152
|
-
var
|
|
3102
|
+
var j, P = nr(o);
|
|
3153
3103
|
try {
|
|
3154
|
-
for (
|
|
3155
|
-
var
|
|
3156
|
-
|
|
3104
|
+
for (P.s(); !(j = P.n()).done; ) {
|
|
3105
|
+
var _ = j.value, N = _.key, T = _.params;
|
|
3106
|
+
"lag" !== N && "crossPairs" !== N &&
|
|
3107
|
+
// resolve fn on-demand, no per-item object allocation here
|
|
3108
|
+
ur[N].apply(ur, [ e, p ].concat(rr(T)));
|
|
3157
3109
|
}
|
|
3158
3110
|
// Process these indicators separately (ensuring their execution order)
|
|
3159
3111
|
} catch (t) {
|
|
3160
|
-
|
|
3112
|
+
P.e(t);
|
|
3161
3113
|
} finally {
|
|
3162
|
-
|
|
3114
|
+
P.f();
|
|
3163
3115
|
}
|
|
3164
|
-
|
|
3116
|
+
Fe(e, p), Ge(e, p);
|
|
3165
3117
|
}
|
|
3166
|
-
|
|
3167
|
-
|
|
3118
|
+
l.push.apply(l, rr(Object.keys(c)));
|
|
3119
|
+
}, lr = function(t, e) {
|
|
3120
|
+
for (var r = t.length, n = new ut(e), o = new Array(r), i = 0, a = 0, u = 0, c = 0; c < r; c++) if (n.update(t[c]),
|
|
3168
3121
|
n.isStable) {
|
|
3169
|
-
var
|
|
3170
|
-
o[
|
|
3171
|
-
} else o[
|
|
3172
|
-
var s = i / u, f = a / u - s * s,
|
|
3122
|
+
var l = n.getResult();
|
|
3123
|
+
o[c] = l, i += l, a += l * l, u++;
|
|
3124
|
+
} else o[c] = null;
|
|
3125
|
+
var s = i / u, f = a / u - s * s, y = Math.sqrt(f);
|
|
3173
3126
|
return o.map((function(t) {
|
|
3174
|
-
return null !== t ? (t - s) /
|
|
3127
|
+
return null !== t ? (t - s) / y : null;
|
|
3175
3128
|
}));
|
|
3176
|
-
},
|
|
3129
|
+
}, sr = function(t, e) {
|
|
3177
3130
|
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5;
|
|
3178
3131
|
if (t.length !== e.length) throw new Error("Both arrays must have the same length");
|
|
3179
|
-
for (var n =
|
|
3180
|
-
if (null !== n[
|
|
3181
|
-
|
|
3132
|
+
for (var n = lr(t, r), o = lr(e, r), i = t.length, a = [], u = 0, c = 0, l = 0, s = 0, f = 0, y = 0, h = -1, p = 0; p < i; p++) {
|
|
3133
|
+
if (null !== n[p] && null !== o[p]) {
|
|
3134
|
+
h = p;
|
|
3182
3135
|
break;
|
|
3183
3136
|
}
|
|
3184
3137
|
a.push(0);
|
|
3185
3138
|
}
|
|
3186
|
-
if (-1 ===
|
|
3139
|
+
if (-1 === h)
|
|
3187
3140
|
// No valid data points
|
|
3188
3141
|
return new Array(i).fill(0);
|
|
3189
|
-
for (var v =
|
|
3190
|
-
var
|
|
3191
|
-
if (null !==
|
|
3192
|
-
++
|
|
3193
|
-
var b =
|
|
3142
|
+
for (var v = h; v < i; v++) {
|
|
3143
|
+
var m = n[v], d = o[v];
|
|
3144
|
+
if (null !== m && null !== d) if (u += m, c += d, l += m * d, s += m * m, f += d * d,
|
|
3145
|
+
++y < 2) a.push(0); else {
|
|
3146
|
+
var b = y * l - u * c, g = Math.sqrt((y * s - u * u) * (y * f - c * c)), w = 0 === g ? 0 : b / g;
|
|
3194
3147
|
a.push(w);
|
|
3195
3148
|
} else
|
|
3196
3149
|
// Reset sums and counts when encountering null values
|
|
3197
|
-
u =
|
|
3150
|
+
u = c = l = s = f = y = 0, a.push(0);
|
|
3198
3151
|
}
|
|
3199
3152
|
return a;
|
|
3153
|
+
}, fr = function() {
|
|
3154
|
+
var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], e = arguments.length > 1 ? arguments[1] : void 0, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, n = e.precisionMultiplier, o = e.priceBased, i = e.precision, a = e.verticalOhlcv, u = e.invalidValueIndex, c = e.len, l = e.verticalOhlcvKeyNames;
|
|
3155
|
+
if (0 === l.length) return [];
|
|
3156
|
+
for (var s = t && u >= 0 ? u + 1 : 0, f = Math.max(s, r), y = new Array(c - f), h = f; h < c; h++) {
|
|
3157
|
+
for (var p = {}, v = 0; v < l.length; v++) {
|
|
3158
|
+
var m = l[v], d = a[m][h];
|
|
3159
|
+
p[m] = i && o.has(m) ? d / n : d;
|
|
3160
|
+
}
|
|
3161
|
+
y[h - f] = p;
|
|
3162
|
+
}
|
|
3163
|
+
return y;
|
|
3200
3164
|
};
|
|
3201
|
-
// Processes the inputParams into a list of indicator calls
|
|
3202
|
-
// ./src/utilities/targetCols.js
|
|
3203
3165
|
function yr(t, e) {
|
|
3204
3166
|
return function(t) {
|
|
3205
3167
|
if (Array.isArray(t)) return t;
|
|
3206
3168
|
}(t) || function(t, e) {
|
|
3207
3169
|
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3208
3170
|
if (null != r) {
|
|
3209
|
-
var n, o, i, a, u = [],
|
|
3210
|
-
try {
|
|
3211
|
-
if (i = (r = r.call(t)).next, 0 === e) {
|
|
3212
|
-
if (Object(r) !== r) return;
|
|
3213
|
-
l = !1;
|
|
3214
|
-
} else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
|
|
3215
|
-
} catch (t) {
|
|
3216
|
-
c = !0, o = t;
|
|
3217
|
-
} finally {
|
|
3218
|
-
try {
|
|
3219
|
-
if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
3220
|
-
} finally {
|
|
3221
|
-
if (c) throw o;
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
return u;
|
|
3225
|
-
}
|
|
3226
|
-
}(t, e) || function(t, e) {
|
|
3227
|
-
if (t) {
|
|
3228
|
-
if ("string" == typeof t) return vr(t, e);
|
|
3229
|
-
var r = {}.toString.call(t).slice(8, -1);
|
|
3230
|
-
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) ? vr(t, e) : void 0;
|
|
3231
|
-
}
|
|
3232
|
-
}(t, e) || function() {
|
|
3233
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3234
|
-
}();
|
|
3235
|
-
}
|
|
3236
|
-
function vr(t, e) {
|
|
3237
|
-
(null == e || e > t.length) && (e = t.length);
|
|
3238
|
-
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3239
|
-
return n;
|
|
3240
|
-
}
|
|
3241
|
-
function dr(t, e) {
|
|
3242
|
-
return function(t) {
|
|
3243
|
-
if (Array.isArray(t)) return t;
|
|
3244
|
-
}(t) || function(t, e) {
|
|
3245
|
-
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3246
|
-
if (null != r) {
|
|
3247
|
-
var n, o, i, a, u = [], l = !0, c = !1;
|
|
3171
|
+
var n, o, i, a, u = [], c = !0, l = !1;
|
|
3248
3172
|
try {
|
|
3249
3173
|
if (i = (r = r.call(t)).next, 0 === e) {
|
|
3250
3174
|
if (Object(r) !== r) return;
|
|
3251
|
-
|
|
3252
|
-
} else for (;!(
|
|
3175
|
+
c = !1;
|
|
3176
|
+
} else for (;!(c = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); c = !0) ;
|
|
3253
3177
|
} catch (t) {
|
|
3254
|
-
|
|
3178
|
+
l = !0, o = t;
|
|
3255
3179
|
} finally {
|
|
3256
3180
|
try {
|
|
3257
|
-
if (!
|
|
3181
|
+
if (!c && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
3258
3182
|
} finally {
|
|
3259
|
-
if (
|
|
3183
|
+
if (l) throw o;
|
|
3260
3184
|
}
|
|
3261
3185
|
}
|
|
3262
3186
|
return u;
|
|
3263
3187
|
}
|
|
3264
|
-
}(t, e) ||
|
|
3188
|
+
}(t, e) || hr(t, e) || function() {
|
|
3265
3189
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3266
3190
|
}();
|
|
3267
3191
|
}
|
|
3268
|
-
function
|
|
3192
|
+
function hr(t, e) {
|
|
3269
3193
|
if (t) {
|
|
3270
|
-
if ("string" == typeof t) return
|
|
3194
|
+
if ("string" == typeof t) return pr(t, e);
|
|
3271
3195
|
var r = {}.toString.call(t).slice(8, -1);
|
|
3272
|
-
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) ?
|
|
3196
|
+
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;
|
|
3273
3197
|
}
|
|
3274
3198
|
}
|
|
3275
|
-
function
|
|
3199
|
+
function pr(t, e) {
|
|
3276
3200
|
(null == e || e > t.length) && (e = t.length);
|
|
3277
3201
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3278
3202
|
return n;
|
|
3279
3203
|
}
|
|
3280
|
-
var
|
|
3204
|
+
var vr = function(t, e) {
|
|
3281
3205
|
var r = t.precision, n = t.priceBased;
|
|
3282
3206
|
if (!1 === r) return 1;
|
|
3283
3207
|
var o, i = 1, a = // ./src/utilities/precisionMultiplier.js
|
|
3284
3208
|
function(t, e) {
|
|
3285
3209
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3286
3210
|
if (!r) {
|
|
3287
|
-
if (Array.isArray(t) || (r =
|
|
3211
|
+
if (Array.isArray(t) || (r = hr(t)) || e && t && "number" == typeof t.length) {
|
|
3288
3212
|
r && (t = r);
|
|
3289
3213
|
var n = 0, o = function() {};
|
|
3290
3214
|
return {
|
|
@@ -3326,17 +3250,17 @@ var OHLCV_INDICATORS;
|
|
|
3326
3250
|
}
|
|
3327
3251
|
};
|
|
3328
3252
|
}(Object.entries(e).filter((function(t) {
|
|
3329
|
-
var e =
|
|
3253
|
+
var e = yr(t, 2), r = e[0];
|
|
3330
3254
|
e[1];
|
|
3331
|
-
return n.
|
|
3255
|
+
return n.has(r);
|
|
3332
3256
|
})).map((function(t) {
|
|
3333
|
-
var e =
|
|
3257
|
+
var e = yr(t, 2);
|
|
3334
3258
|
e[0];
|
|
3335
3259
|
return e[1];
|
|
3336
3260
|
})));
|
|
3337
3261
|
try {
|
|
3338
3262
|
for (a.s(); !(o = a.n()).done; ) {
|
|
3339
|
-
var u = o.value,
|
|
3263
|
+
var u = o.value, c = yr(String(u).split("."), 2)[1], l = void 0 === c ? "" : c, s = Math.max(4, l.length), f = s > 1 ? Math.pow(10, s - 1) : 1;
|
|
3340
3264
|
f > i && (i = f);
|
|
3341
3265
|
}
|
|
3342
3266
|
} catch (t) {
|
|
@@ -3347,75 +3271,75 @@ var OHLCV_INDICATORS;
|
|
|
3347
3271
|
return i;
|
|
3348
3272
|
};
|
|
3349
3273
|
// ./index.js
|
|
3350
|
-
function
|
|
3274
|
+
function mr(t) {
|
|
3275
|
+
return mr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
3276
|
+
return typeof t;
|
|
3277
|
+
} : function(t) {
|
|
3278
|
+
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
3279
|
+
}, mr(t);
|
|
3280
|
+
}
|
|
3281
|
+
function dr(t) {
|
|
3351
3282
|
return function(t) {
|
|
3352
|
-
if (Array.isArray(t)) return
|
|
3283
|
+
if (Array.isArray(t)) return wr(t);
|
|
3353
3284
|
}(t) || function(t) {
|
|
3354
3285
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
3355
|
-
}(t) ||
|
|
3286
|
+
}(t) || gr(t) || function() {
|
|
3356
3287
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3357
3288
|
}();
|
|
3358
3289
|
}
|
|
3359
|
-
function
|
|
3360
|
-
return Or = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
3361
|
-
return typeof t;
|
|
3362
|
-
} : function(t) {
|
|
3363
|
-
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
3364
|
-
}, Or(t);
|
|
3365
|
-
}
|
|
3366
|
-
function Sr(t, e) {
|
|
3290
|
+
function br(t, e) {
|
|
3367
3291
|
return function(t) {
|
|
3368
3292
|
if (Array.isArray(t)) return t;
|
|
3369
3293
|
}(t) || function(t, e) {
|
|
3370
3294
|
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3371
3295
|
if (null != r) {
|
|
3372
|
-
var n, o, i, a, u = [],
|
|
3296
|
+
var n, o, i, a, u = [], c = !0, l = !1;
|
|
3373
3297
|
try {
|
|
3374
3298
|
if (i = (r = r.call(t)).next, 0 === e) {
|
|
3375
3299
|
if (Object(r) !== r) return;
|
|
3376
|
-
|
|
3377
|
-
} else for (;!(
|
|
3300
|
+
c = !1;
|
|
3301
|
+
} else for (;!(c = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); c = !0) ;
|
|
3378
3302
|
} catch (t) {
|
|
3379
|
-
|
|
3303
|
+
l = !0, o = t;
|
|
3380
3304
|
} finally {
|
|
3381
3305
|
try {
|
|
3382
|
-
if (!
|
|
3306
|
+
if (!c && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
3383
3307
|
} finally {
|
|
3384
|
-
if (
|
|
3308
|
+
if (l) throw o;
|
|
3385
3309
|
}
|
|
3386
3310
|
}
|
|
3387
3311
|
return u;
|
|
3388
3312
|
}
|
|
3389
|
-
}(t, e) ||
|
|
3313
|
+
}(t, e) || gr(t, e) || function() {
|
|
3390
3314
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3391
3315
|
}();
|
|
3392
3316
|
}
|
|
3393
|
-
function
|
|
3317
|
+
function gr(t, e) {
|
|
3394
3318
|
if (t) {
|
|
3395
|
-
if ("string" == typeof t) return
|
|
3319
|
+
if ("string" == typeof t) return wr(t, e);
|
|
3396
3320
|
var r = {}.toString.call(t).slice(8, -1);
|
|
3397
|
-
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) ?
|
|
3321
|
+
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) ? wr(t, e) : void 0;
|
|
3398
3322
|
}
|
|
3399
3323
|
}
|
|
3400
|
-
function
|
|
3324
|
+
function wr(t, e) {
|
|
3401
3325
|
(null == e || e > t.length) && (e = t.length);
|
|
3402
3326
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3403
3327
|
return n;
|
|
3404
3328
|
}
|
|
3405
|
-
function
|
|
3329
|
+
function Or(t, e) {
|
|
3406
3330
|
for (var r = 0; r < e.length; r++) {
|
|
3407
3331
|
var n = e[r];
|
|
3408
3332
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
3409
|
-
Object.defineProperty(t,
|
|
3333
|
+
Object.defineProperty(t, Sr(n.key), n);
|
|
3410
3334
|
}
|
|
3411
3335
|
}
|
|
3412
|
-
function
|
|
3336
|
+
function Sr(t) {
|
|
3413
3337
|
var e = function(t, e) {
|
|
3414
|
-
if ("object" !=
|
|
3338
|
+
if ("object" != mr(t) || !t) return t;
|
|
3415
3339
|
var r = t[Symbol.toPrimitive];
|
|
3416
3340
|
if (void 0 !== r) {
|
|
3417
3341
|
var n = r.call(t, e || "default");
|
|
3418
|
-
if ("object" !=
|
|
3342
|
+
if ("object" != mr(n)) return n;
|
|
3419
3343
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3420
3344
|
}
|
|
3421
3345
|
return ("string" === e ? String : Number)(t);
|
|
@@ -3428,56 +3352,44 @@ var OHLCV_INDICATORS;
|
|
|
3428
3352
|
* to parallel compute various technical indicators in 1 single loop.
|
|
3429
3353
|
* OHLCV datasets.
|
|
3430
3354
|
*/ (t, "string");
|
|
3431
|
-
return "symbol" ==
|
|
3355
|
+
return "symbol" == mr(e) ? e : e + "";
|
|
3432
3356
|
}
|
|
3433
|
-
var
|
|
3357
|
+
var jr = function() {
|
|
3434
3358
|
return t = function t(e) {
|
|
3435
|
-
var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o,
|
|
3359
|
+
var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, u = e.precision, l = void 0 === u || u, s = e.inputParams, f = void 0 === s ? null : s;
|
|
3436
3360
|
if (function(t, e) {
|
|
3437
3361
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
3438
|
-
}(this, t),
|
|
3362
|
+
}(this, t), a(n, "input", null !== i ? "contructor ".concat(i) : "constuctor"),
|
|
3439
3363
|
0 === n.length) throw Error("input OHLCV must not be empty: " + i);
|
|
3440
|
-
c(
|
|
3441
|
-
var
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
volume: "volume",
|
|
3450
|
-
date: "date"
|
|
3451
|
-
}, n = Object.keys(e), o = Object.keys(r), i = 0, a = Object.entries(t); i < a.length; i++) {
|
|
3452
|
-
var u = yr(a[i], 2), c = u[0], s = u[1];
|
|
3453
|
-
if (!o.includes(c)) throw new Error('Property "inputCols['.concat(c, ']" in "constructor" is invalid. Param "inputCols" only accepts the following properties: ').concat(o.join(", ")));
|
|
3454
|
-
if (!n.includes(s)) throw new Error("The value (".concat(s, ') of your param "inputCols[').concat(c, ']" was not found as a property in your "input" ohlcv array object.'));
|
|
3455
|
-
if (!s || "string" != typeof s) throw new Error('Value of property "inputCols['.concat(c, ']" in "constructor" is not a valid string.'));
|
|
3456
|
-
r[c] = s;
|
|
3457
|
-
}
|
|
3458
|
-
for (var f = 0, h = Object.entries(r); f < h.length; f++) {
|
|
3459
|
-
var p = yr(h[f], 2), y = p[0], v = p[1];
|
|
3460
|
-
n.includes(v) || delete r[y];
|
|
3364
|
+
c(l, "precision", "constructor"), this.firstRow = n[0];
|
|
3365
|
+
var y = function(t) {
|
|
3366
|
+
for (var e = {}, r = {}, n = 0, o = Object.entries(t); n < o.length; n++) {
|
|
3367
|
+
var i = Ae(o[n], 2), a = i[0], u = i[1];
|
|
3368
|
+
if ("date" === a) e[a] = Te(u), r[a] = "Array"; else if ("volume" === a) e[a] = Pe(u, !0),
|
|
3369
|
+
r[a] = "Int32Array"; else if (ke.has(a)) e[a] = Pe(u, !0), r[a] = "Float64Array"; else {
|
|
3370
|
+
var c = Pe(u, !1);
|
|
3371
|
+
e[a] = c, r[a] = "number" === c ? "Float64Array" : "Array";
|
|
3372
|
+
}
|
|
3461
3373
|
}
|
|
3462
|
-
return
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
if (
|
|
3468
|
-
return this.
|
|
3469
|
-
this.
|
|
3470
|
-
this.
|
|
3471
|
-
this.
|
|
3472
|
-
correlation:
|
|
3473
|
-
}, this.invalidValueIndex = -1, this.precision =
|
|
3474
|
-
this.ScaledGroups = {}, null !==
|
|
3374
|
+
return {
|
|
3375
|
+
inputTypes: e,
|
|
3376
|
+
arrayTypes: r
|
|
3377
|
+
};
|
|
3378
|
+
}(this.firstRow), h = y.inputTypes, p = y.arrayTypes;
|
|
3379
|
+
if (this.inputTypes = h, this.arrayTypes = p, !this.firstRow.hasOwnProperty("close")) throw Error('input OHLCV array objects require at least "close" property: '.concat(i));
|
|
3380
|
+
return this.dateType = this.inputTypes.date ? this.inputTypes.date : null, this.isComputed = !1,
|
|
3381
|
+
this.input = n, this.priceBased = new Set([ "open", "high", "low", "close" ]), this.len = n.length,
|
|
3382
|
+
this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {}, this.verticalOhlcvKeyNames = [],
|
|
3383
|
+
this.utilities = {
|
|
3384
|
+
correlation: sr
|
|
3385
|
+
}, this.invalidValueIndex = -1, this.precision = l, this.precisionMultiplier = vr(this, this.firstRow),
|
|
3386
|
+
this.ScaledGroups = {}, null !== f && (a(f, "inputParams", "constructor"), this.inputParams = f,
|
|
3475
3387
|
this.compute()), this.inputParams = [], this.pushToMain = function(t) {
|
|
3476
3388
|
var e = t.index, n = t.key, o = t.value;
|
|
3477
3389
|
return function(t) {
|
|
3478
3390
|
var e = t.main, r = t.index, n = t.key, o = t.value, i = e.verticalOhlcv;
|
|
3479
|
-
return null == o || Number.isNaN(o) ? (e.invalidValueIndex = r, i[n][r] =
|
|
3480
|
-
!
|
|
3391
|
+
return null == o || Number.isNaN(o) ? (e.invalidValueIndex = r, i[n][r] = o, !1) : (i[n][r] = o,
|
|
3392
|
+
!0);
|
|
3481
3393
|
}({
|
|
3482
3394
|
main: r,
|
|
3483
3395
|
index: e,
|
|
@@ -3490,13 +3402,13 @@ var OHLCV_INDICATORS;
|
|
|
3490
3402
|
value: function() {
|
|
3491
3403
|
var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
|
3492
3404
|
this.compute();
|
|
3493
|
-
for (var e = this.precisionMultiplier, r = this.precision, n = this.invalidValueIndex, o = this.len, i = this.verticalOhlcv, a = this.priceBased, u = {},
|
|
3494
|
-
var
|
|
3405
|
+
for (var e = this.precisionMultiplier, r = this.precision, n = this.invalidValueIndex, o = this.len, i = this.verticalOhlcv, a = this.priceBased, u = {}, c = n >= 0 && t, l = o - (n + 1), s = 0, f = Object.entries(i); s < f.length; s++) {
|
|
3406
|
+
var y = br(f[s], 2), h = y[0], p = y[1], v = c ? p.slice(-l) : p;
|
|
3495
3407
|
// If slicing is needed, create a sliced copy, otherwise re-use the array.
|
|
3496
3408
|
// If this key is price based and precision is enabled, map over the array.
|
|
3497
|
-
r && a.
|
|
3409
|
+
r && a.has(h) && (v = v.map((function(t) {
|
|
3498
3410
|
return null == t ? null : t / e;
|
|
3499
|
-
}))), u[
|
|
3411
|
+
}))), u[h] = v;
|
|
3500
3412
|
}
|
|
3501
3413
|
return u;
|
|
3502
3414
|
}
|
|
@@ -3505,76 +3417,32 @@ var OHLCV_INDICATORS;
|
|
|
3505
3417
|
value: function() {
|
|
3506
3418
|
var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
|
3507
3419
|
//getData method returns the last object (row) of the new OHLCV with indicators: {open, high, low, close, rsi_14, bollinger_bands_upper}
|
|
3508
|
-
this.compute();
|
|
3509
|
-
var e = this.precisionMultiplier, r = this.priceBased, n = this.precision;
|
|
3510
|
-
return function(t) {
|
|
3511
|
-
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = arguments.length > 2 ? arguments[2] : void 0, n = arguments.length > 3 ? arguments[3] : void 0, o = arguments.length > 4 ? arguments[4] : void 0, i = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0, a = Object.keys(t);
|
|
3512
|
-
if (0 === a.length) return [];
|
|
3513
|
-
for (var u = e && i >= 0 ? i + 1 : 0, l = t[a[0]].length, c = new Array(l - u), s = u; s < l; s++) {
|
|
3514
|
-
for (var f = {}, h = 0; h < a.length; h++) {
|
|
3515
|
-
var p = a[h], y = t[p][s];
|
|
3516
|
-
f[p] = r && o.includes(p) ? y / n : y;
|
|
3517
|
-
}
|
|
3518
|
-
c[s - u] = f;
|
|
3519
|
-
}
|
|
3520
|
-
return c;
|
|
3521
|
-
}(this.verticalOhlcv, t, n, e, r, this.invalidValueIndex);
|
|
3420
|
+
return this.compute(), fr(t, this, 0);
|
|
3522
3421
|
}
|
|
3523
3422
|
}, {
|
|
3524
3423
|
key: "getLastValues",
|
|
3525
3424
|
value: function() {
|
|
3526
|
-
this.compute();
|
|
3527
|
-
for (var t = this.precisionMultiplier, e = this.priceBased, r = this.precision, n = this.verticalOhlcv, o = this.len, i = {}, a = 0, u = Object.keys(n); a < u.length; a++) {
|
|
3528
|
-
var l = u[a];
|
|
3529
|
-
i[l] = n[l][o - 1];
|
|
3530
|
-
}
|
|
3531
|
-
return r ? function(t) {
|
|
3532
|
-
for (var e = t.row, r = t.precisionMultiplier, n = t.priceBased, o = {}, i = 0, a = Object.entries(e); i < a.length; i++) {
|
|
3533
|
-
var u = Pe(a[i], 2), l = u[0], c = u[1];
|
|
3534
|
-
n.includes(l) && (c /= r), o[l] = c;
|
|
3535
|
-
}
|
|
3536
|
-
return o;
|
|
3537
|
-
}({
|
|
3538
|
-
row: i,
|
|
3539
|
-
precisionMultiplier: t,
|
|
3540
|
-
priceBased: e
|
|
3541
|
-
}) : i;
|
|
3425
|
+
return this.compute(), fr(!1, this, this.len - 1)[0];
|
|
3542
3426
|
}
|
|
3543
3427
|
}, {
|
|
3544
3428
|
key: "compute",
|
|
3545
|
-
value: function(
|
|
3546
|
-
//
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
//
|
|
3552
|
-
if
|
|
3553
|
-
|
|
3554
|
-
//
|
|
3555
|
-
|
|
3556
|
-
this.len > this.lastComputedIndex && !t && fr(this.input, this, 0), t && "object" === Or(t)) {
|
|
3557
|
-
var e;
|
|
3558
|
-
if (![ "open", "high", "low", "close", "volume", "date" ].every((function(e) {
|
|
3559
|
-
return Object.keys(t).includes(e);
|
|
3560
|
-
}))) throw Error('Invalid OHLCV object sent in "compute". Correct usage: .compute({open: 108.25, high: 108.410004, low: 108.25, close: 99999999, volume: 875903, date: "2024-12-16 15:45:00" || "2024-12-16"})');
|
|
3561
|
-
if (!this.dateType) throw Error('All the OHLCV rows require a valid date property to access the compute change method. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');
|
|
3562
|
-
if (!i(t.date)) throw Error('The date in the new OHLCV row is invalid. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');
|
|
3563
|
-
var r = t.date, n = this.len - 1, o = null === (e = this.input[n]) || void 0 === e ? void 0 : e.date;
|
|
3564
|
-
//fallback if .compute(change) is triggered before .compute() alone
|
|
3565
|
-
0 === this.lastComputedIndex && this.compute(), o !== r ? (
|
|
3566
|
-
// Add new item
|
|
3567
|
-
this.len++, this.input.push(t), fr(this.input, this, this.len)) : (
|
|
3568
|
-
// Modify the last item
|
|
3569
|
-
this.input[n] = t, fr(this.input, this, n));
|
|
3570
|
-
}
|
|
3571
|
-
return this;
|
|
3429
|
+
value: function() {
|
|
3430
|
+
// If we've already computed, bail out immediately
|
|
3431
|
+
return this.isComputed || (
|
|
3432
|
+
// Mark as “in progress”
|
|
3433
|
+
this.isComputed = !1,
|
|
3434
|
+
// Figure out whether there’s a date field in the inputs
|
|
3435
|
+
// Only run the full loop once (or when new data appears later,
|
|
3436
|
+
// if you extend this to reset isComputed elsewhere)
|
|
3437
|
+
this.len > 0 && (cr(this.input, this), this.isComputed = !0,
|
|
3438
|
+
//flushing after mainLoop
|
|
3439
|
+
this.input = [], this.instances = {}, this.firstRow = [])), this;
|
|
3572
3440
|
}
|
|
3573
3441
|
}, {
|
|
3574
3442
|
key: "crossPairs",
|
|
3575
3443
|
value: function() {
|
|
3576
3444
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = "crossPairs";
|
|
3577
|
-
return
|
|
3445
|
+
return i(this), a(t, "arr", e), this.crossPairsList = [].concat(dr(this.crossPairsList), dr(t)),
|
|
3578
3446
|
this.inputParams.push({
|
|
3579
3447
|
key: e,
|
|
3580
3448
|
params: [ this.crossPairsList ]
|
|
@@ -3583,35 +3451,84 @@ var OHLCV_INDICATORS;
|
|
|
3583
3451
|
}, {
|
|
3584
3452
|
key: "lag",
|
|
3585
3453
|
value: function() {
|
|
3586
|
-
var t =
|
|
3587
|
-
|
|
3454
|
+
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";
|
|
3455
|
+
i(this), a(t, "colKeys", r), l(e, {
|
|
3588
3456
|
min: 1,
|
|
3589
3457
|
max: this.len,
|
|
3590
3458
|
allowDecimals: !1
|
|
3591
|
-
}, "lookback",
|
|
3592
|
-
key:
|
|
3593
|
-
params: [
|
|
3459
|
+
}, "lookback", r), this.inputParams.push({
|
|
3460
|
+
key: r,
|
|
3461
|
+
params: [ t, e ]
|
|
3594
3462
|
});
|
|
3595
|
-
|
|
3596
|
-
var r =
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3463
|
+
var n, o = function(t, e) {
|
|
3464
|
+
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3465
|
+
if (!r) {
|
|
3466
|
+
if (Array.isArray(t) || (r = gr(t)) || e && t && "number" == typeof t.length) {
|
|
3467
|
+
r && (t = r);
|
|
3468
|
+
var n = 0, o = function() {};
|
|
3469
|
+
return {
|
|
3470
|
+
s: o,
|
|
3471
|
+
n: function() {
|
|
3472
|
+
return n >= t.length ? {
|
|
3473
|
+
done: !0
|
|
3474
|
+
} : {
|
|
3475
|
+
done: !1,
|
|
3476
|
+
value: t[n++]
|
|
3477
|
+
};
|
|
3478
|
+
},
|
|
3479
|
+
e: function(t) {
|
|
3480
|
+
throw t;
|
|
3481
|
+
},
|
|
3482
|
+
f: o
|
|
3483
|
+
};
|
|
3484
|
+
}
|
|
3485
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3486
|
+
}
|
|
3487
|
+
var i, a = !0, u = !1;
|
|
3488
|
+
return {
|
|
3489
|
+
s: function() {
|
|
3490
|
+
r = r.call(t);
|
|
3491
|
+
},
|
|
3492
|
+
n: function() {
|
|
3493
|
+
var t = r.next();
|
|
3494
|
+
return a = t.done, t;
|
|
3495
|
+
},
|
|
3496
|
+
e: function(t) {
|
|
3497
|
+
u = !0, i = t;
|
|
3498
|
+
},
|
|
3499
|
+
f: function() {
|
|
3500
|
+
try {
|
|
3501
|
+
a || null == r.return || r.return();
|
|
3502
|
+
} finally {
|
|
3503
|
+
if (u) throw i;
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
}(t);
|
|
3508
|
+
try {
|
|
3509
|
+
for (o.s(); !(n = o.n()).done; ) {
|
|
3510
|
+
var u = n.value;
|
|
3511
|
+
this.priceBased.has(u) && this.priceBased.add(u);
|
|
3512
|
+
}
|
|
3513
|
+
} catch (t) {
|
|
3514
|
+
o.e(t);
|
|
3515
|
+
} finally {
|
|
3516
|
+
o.f();
|
|
3517
|
+
}
|
|
3601
3518
|
return this;
|
|
3602
3519
|
}
|
|
3603
3520
|
}, {
|
|
3604
3521
|
key: "relativeVolume",
|
|
3605
3522
|
value: function() {
|
|
3606
3523
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 10, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "relativeVolume";
|
|
3607
|
-
if (!this.
|
|
3608
|
-
|
|
3524
|
+
if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
|
|
3525
|
+
i(this), l(t, {
|
|
3609
3526
|
min: 1,
|
|
3610
3527
|
max: this.len,
|
|
3611
3528
|
allowDecimals: !1
|
|
3612
|
-
}, "size", r),
|
|
3529
|
+
}, "size", r), u(e, "options", r);
|
|
3613
3530
|
var n = e.lag, o = void 0 === n ? 0 : n;
|
|
3614
|
-
return
|
|
3531
|
+
return l(o, {
|
|
3615
3532
|
min: 0,
|
|
3616
3533
|
max: this.len,
|
|
3617
3534
|
allowDecimals: !1
|
|
@@ -3626,13 +3543,13 @@ var OHLCV_INDICATORS;
|
|
|
3626
3543
|
key: "ema",
|
|
3627
3544
|
value: function() {
|
|
3628
3545
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "ema";
|
|
3629
|
-
|
|
3546
|
+
i(this), l(t, {
|
|
3630
3547
|
min: 1,
|
|
3631
3548
|
max: this.len,
|
|
3632
3549
|
allowDecimals: !1
|
|
3633
|
-
}, "size", r),
|
|
3634
|
-
var n = e.target, o = void 0 === n ? "close" : n,
|
|
3635
|
-
return
|
|
3550
|
+
}, "size", r), u(e, "options", r);
|
|
3551
|
+
var n = e.target, o = void 0 === n ? "close" : n, a = e.lag, c = void 0 === a ? 0 : a;
|
|
3552
|
+
return l(c, {
|
|
3636
3553
|
min: 0,
|
|
3637
3554
|
max: this.len,
|
|
3638
3555
|
allowDecimals: !1
|
|
@@ -3640,7 +3557,7 @@ var OHLCV_INDICATORS;
|
|
|
3640
3557
|
key: r,
|
|
3641
3558
|
params: [ r, t, {
|
|
3642
3559
|
target: o,
|
|
3643
|
-
lag:
|
|
3560
|
+
lag: c
|
|
3644
3561
|
} ]
|
|
3645
3562
|
}), this;
|
|
3646
3563
|
}
|
|
@@ -3648,13 +3565,13 @@ var OHLCV_INDICATORS;
|
|
|
3648
3565
|
key: "sma",
|
|
3649
3566
|
value: function() {
|
|
3650
3567
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "sma";
|
|
3651
|
-
|
|
3568
|
+
i(this), l(t, {
|
|
3652
3569
|
min: 1,
|
|
3653
3570
|
max: this.len,
|
|
3654
3571
|
allowDecimals: !1
|
|
3655
|
-
}, "size", r),
|
|
3656
|
-
var n = e.target, o = void 0 === n ? "close" : n,
|
|
3657
|
-
return
|
|
3572
|
+
}, "size", r), u(e, "options", r);
|
|
3573
|
+
var n = e.target, o = void 0 === n ? "close" : n, a = e.lag, c = void 0 === a ? 0 : a;
|
|
3574
|
+
return l(c, {
|
|
3658
3575
|
min: 0,
|
|
3659
3576
|
max: this.len,
|
|
3660
3577
|
allowDecimals: !1
|
|
@@ -3662,7 +3579,7 @@ var OHLCV_INDICATORS;
|
|
|
3662
3579
|
key: r,
|
|
3663
3580
|
params: [ r, t, {
|
|
3664
3581
|
target: o,
|
|
3665
|
-
lag:
|
|
3582
|
+
lag: c
|
|
3666
3583
|
} ]
|
|
3667
3584
|
}), this;
|
|
3668
3585
|
}
|
|
@@ -3670,28 +3587,28 @@ var OHLCV_INDICATORS;
|
|
|
3670
3587
|
key: "macd",
|
|
3671
3588
|
value: function() {
|
|
3672
3589
|
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";
|
|
3673
|
-
|
|
3590
|
+
i(this), l(t, {
|
|
3674
3591
|
min: 1,
|
|
3675
3592
|
max: this.len,
|
|
3676
3593
|
allowDecimals: !1
|
|
3677
|
-
}, "fast", o),
|
|
3594
|
+
}, "fast", o), l(e, {
|
|
3678
3595
|
min: 1,
|
|
3679
3596
|
max: this.len,
|
|
3680
3597
|
allowDecimals: !1
|
|
3681
|
-
}, "slow", o),
|
|
3598
|
+
}, "slow", o), l(r, {
|
|
3682
3599
|
min: 1,
|
|
3683
3600
|
max: this.len,
|
|
3684
3601
|
allowDecimals: !1
|
|
3685
|
-
}, "signal", o),
|
|
3686
|
-
var
|
|
3687
|
-
return
|
|
3602
|
+
}, "signal", o), u(n, "options", o);
|
|
3603
|
+
var a = n.target, c = void 0 === a ? "close" : a, s = n.lag, f = void 0 === s ? 0 : s;
|
|
3604
|
+
return l(f, {
|
|
3688
3605
|
min: 0,
|
|
3689
3606
|
max: this.len,
|
|
3690
3607
|
allowDecimals: !1
|
|
3691
3608
|
}, "lag", o), this.inputParams.push({
|
|
3692
3609
|
key: o,
|
|
3693
3610
|
params: [ t, e, r, {
|
|
3694
|
-
target:
|
|
3611
|
+
target: c,
|
|
3695
3612
|
lag: f
|
|
3696
3613
|
} ]
|
|
3697
3614
|
}), this;
|
|
@@ -3700,27 +3617,27 @@ var OHLCV_INDICATORS;
|
|
|
3700
3617
|
key: "bollingerBands",
|
|
3701
3618
|
value: function() {
|
|
3702
3619
|
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";
|
|
3703
|
-
|
|
3620
|
+
i(this), l(t, {
|
|
3704
3621
|
min: 1,
|
|
3705
3622
|
max: this.len,
|
|
3706
3623
|
allowDecimals: !1
|
|
3707
|
-
}, "size", n),
|
|
3624
|
+
}, "size", n), l(e, {
|
|
3708
3625
|
min: .01,
|
|
3709
3626
|
max: 50,
|
|
3710
3627
|
allowDecimals: !0
|
|
3711
|
-
}, "stdDev", n),
|
|
3712
|
-
var o = r.target,
|
|
3713
|
-
return
|
|
3628
|
+
}, "stdDev", n), u(r, "options", n);
|
|
3629
|
+
var o = r.target, s = void 0 === o ? "close" : o, f = r.height, y = void 0 !== f && f, h = r.range, p = void 0 === h ? [] : h, v = r.lag, m = void 0 === v ? 0 : v;
|
|
3630
|
+
return a(p, "range", n), l(m, {
|
|
3714
3631
|
min: 0,
|
|
3715
3632
|
max: this.len,
|
|
3716
3633
|
allowDecimals: !1
|
|
3717
|
-
}, "lag", n), c(
|
|
3634
|
+
}, "lag", n), c(y, "height", n), this.inputParams.push({
|
|
3718
3635
|
key: n,
|
|
3719
3636
|
params: [ t, e, {
|
|
3720
|
-
target:
|
|
3721
|
-
height:
|
|
3722
|
-
range:
|
|
3723
|
-
lag:
|
|
3637
|
+
target: s,
|
|
3638
|
+
height: y,
|
|
3639
|
+
range: p,
|
|
3640
|
+
lag: m
|
|
3724
3641
|
} ]
|
|
3725
3642
|
}), this;
|
|
3726
3643
|
}
|
|
@@ -3728,13 +3645,13 @@ var OHLCV_INDICATORS;
|
|
|
3728
3645
|
key: "rsi",
|
|
3729
3646
|
value: function() {
|
|
3730
3647
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 14, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = "rsi";
|
|
3731
|
-
|
|
3648
|
+
i(this), l(t, {
|
|
3732
3649
|
min: 1,
|
|
3733
3650
|
max: this.len,
|
|
3734
3651
|
allowDecimals: !1
|
|
3735
|
-
}, "size", r),
|
|
3736
|
-
var n = e.target, o = void 0 === n ? "close" : n,
|
|
3737
|
-
return
|
|
3652
|
+
}, "size", r), u(e, "options", r);
|
|
3653
|
+
var n = e.target, o = void 0 === n ? "close" : n, a = e.lag, c = void 0 === a ? 0 : a;
|
|
3654
|
+
return l(c, {
|
|
3738
3655
|
min: 0,
|
|
3739
3656
|
max: this.len,
|
|
3740
3657
|
allowDecimals: !1
|
|
@@ -3742,7 +3659,7 @@ var OHLCV_INDICATORS;
|
|
|
3742
3659
|
key: r,
|
|
3743
3660
|
params: [ t, {
|
|
3744
3661
|
target: o,
|
|
3745
|
-
lag:
|
|
3662
|
+
lag: c
|
|
3746
3663
|
} ]
|
|
3747
3664
|
}), this;
|
|
3748
3665
|
}
|
|
@@ -3750,26 +3667,26 @@ var OHLCV_INDICATORS;
|
|
|
3750
3667
|
key: "donchianChannels",
|
|
3751
3668
|
value: function() {
|
|
3752
3669
|
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";
|
|
3753
|
-
|
|
3670
|
+
i(this), l(t, {
|
|
3754
3671
|
min: 1,
|
|
3755
3672
|
max: this.len,
|
|
3756
3673
|
allowDecimals: !1
|
|
3757
|
-
}, "size", n),
|
|
3674
|
+
}, "size", n), l(e, {
|
|
3758
3675
|
min: 0,
|
|
3759
3676
|
max: this.len,
|
|
3760
3677
|
allowDecimals: !1
|
|
3761
|
-
}, "offset", n),
|
|
3762
|
-
var o = r.height,
|
|
3763
|
-
return
|
|
3678
|
+
}, "offset", n), u(r, "options", n);
|
|
3679
|
+
var o = r.height, s = void 0 !== o && o, f = r.range, y = void 0 === f ? [] : f, h = r.lag, p = void 0 === h ? 0 : h;
|
|
3680
|
+
return a(y, "range", n), l(p, {
|
|
3764
3681
|
min: 0,
|
|
3765
3682
|
max: this.len,
|
|
3766
3683
|
allowDecimals: !1
|
|
3767
|
-
}, "lag", n), c(
|
|
3684
|
+
}, "lag", n), c(s, "height", n), this.inputParams.push({
|
|
3768
3685
|
key: n,
|
|
3769
3686
|
params: [ t, e, {
|
|
3770
|
-
height:
|
|
3771
|
-
range:
|
|
3772
|
-
lag:
|
|
3687
|
+
height: s,
|
|
3688
|
+
range: y,
|
|
3689
|
+
lag: p
|
|
3773
3690
|
} ]
|
|
3774
3691
|
}), this;
|
|
3775
3692
|
}
|
|
@@ -3777,25 +3694,25 @@ var OHLCV_INDICATORS;
|
|
|
3777
3694
|
key: "volumeOscillator",
|
|
3778
3695
|
value: function() {
|
|
3779
3696
|
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";
|
|
3780
|
-
if (!this.
|
|
3781
|
-
|
|
3697
|
+
if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');
|
|
3698
|
+
i(this), l(t, {
|
|
3782
3699
|
min: 1,
|
|
3783
3700
|
max: this.len,
|
|
3784
3701
|
allowDecimals: !1
|
|
3785
|
-
}, "fastSize", n),
|
|
3702
|
+
}, "fastSize", n), l(e, {
|
|
3786
3703
|
min: t,
|
|
3787
3704
|
max: this.len,
|
|
3788
3705
|
allowDecimals: !1
|
|
3789
|
-
}, "slowSize", n),
|
|
3790
|
-
var o = r.lag,
|
|
3791
|
-
return
|
|
3706
|
+
}, "slowSize", n), u(r, "options", n);
|
|
3707
|
+
var o = r.lag, a = void 0 === o ? 0 : o;
|
|
3708
|
+
return l(a, {
|
|
3792
3709
|
min: 0,
|
|
3793
3710
|
max: this.len,
|
|
3794
3711
|
allowDecimals: !1
|
|
3795
3712
|
}, "lag", n), this.inputParams.push({
|
|
3796
3713
|
key: n,
|
|
3797
3714
|
params: [ t, e, {
|
|
3798
|
-
lag:
|
|
3715
|
+
lag: a
|
|
3799
3716
|
} ]
|
|
3800
3717
|
}), this;
|
|
3801
3718
|
}
|
|
@@ -3803,9 +3720,9 @@ var OHLCV_INDICATORS;
|
|
|
3803
3720
|
key: "dateTime",
|
|
3804
3721
|
value: function() {
|
|
3805
3722
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = "dateTime";
|
|
3806
|
-
|
|
3723
|
+
i(this), u(t, "options", e);
|
|
3807
3724
|
var r = t.lag, n = void 0 === r ? 0 : r;
|
|
3808
|
-
return
|
|
3725
|
+
return l(n, {
|
|
3809
3726
|
min: 0,
|
|
3810
3727
|
max: this.len,
|
|
3811
3728
|
allowDecimals: !1
|
|
@@ -3820,21 +3737,21 @@ var OHLCV_INDICATORS;
|
|
|
3820
3737
|
key: "Scaler",
|
|
3821
3738
|
value: function(t, e, r) {
|
|
3822
3739
|
var n = "Scaler";
|
|
3823
|
-
|
|
3740
|
+
i(this), l(t, {
|
|
3824
3741
|
min: 1,
|
|
3825
3742
|
max: this.len,
|
|
3826
3743
|
allowDecimals: !1
|
|
3827
|
-
}, "size", n),
|
|
3828
|
-
var o = r.group,
|
|
3829
|
-
return c(
|
|
3830
|
-
if (
|
|
3744
|
+
}, "size", n), a(e, "colKeys", n);
|
|
3745
|
+
var o = r.group, u = void 0 !== o && o, s = r.range, f = void 0 === s ? [ 0, 1 ] : s, y = r.lag, h = void 0 === y ? 0 : y, p = r.type, v = void 0 === p ? "minmax" : p;
|
|
3746
|
+
return c(u, "group", n), a(f, "range", n), function(t, e, r, n) {
|
|
3747
|
+
if (a(t, "arrayOptions", "".concat(n, ".").concat(r, ".validateArrayOptions")),
|
|
3831
3748
|
!t.includes(e.toString())) throw new Error('Param "'.concat(r, '" must be any of the following values [').concat(t.join(", "), '] in "').concat(n, '".'));
|
|
3832
3749
|
}([ "minmax", "zscore" ], v, "type", n), this.inputParams.push({
|
|
3833
3750
|
key: n,
|
|
3834
|
-
params: [ t, e, v,
|
|
3751
|
+
params: [ t, e, v, u, f, h ]
|
|
3835
3752
|
}), this;
|
|
3836
3753
|
}
|
|
3837
|
-
} ], e &&
|
|
3754
|
+
} ], e && Or(t.prototype, e), r && Or(t, r), Object.defineProperty(t, "prototype", {
|
|
3838
3755
|
writable: !1
|
|
3839
3756
|
}), t;
|
|
3840
3757
|
var t, e, r;
|