ohlcv-indicators 3.3.4 → 3.3.6
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 +1165 -1079
- package/index.js +63 -63
- package/package.json +1 -1
- package/src/core-functions/mainLoop.js +26 -41
- package/src/moving-averages/bollingerBands.js +10 -3
- package/src/moving-averages/donchianChannel.js +11 -3
- package/src/moving-averages/macd.js +9 -2
- package/src/moving-averages/movingAverages.js +2 -1
- package/src/studies/findCrosses.js +14 -7
- package/src/studies/lag.js +8 -5
- 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 +27 -2
- package/src/utilities/verticalToHorizontal.js +20 -23
|
@@ -35,27 +35,48 @@ var OHLCV_INDICATORS;
|
|
|
35
35
|
// This entry need to be wrapped in an IIFE because it declares 'OHLCV_INDICATORS' on top-level, which conflicts with the current library output.
|
|
36
36
|
(() => {
|
|
37
37
|
// ./src/utilities/validators.js
|
|
38
|
-
function r(t) {
|
|
39
|
-
return
|
|
38
|
+
function r(t, e) {
|
|
39
|
+
return function(t) {
|
|
40
|
+
if (Array.isArray(t)) return t;
|
|
41
|
+
}(t) || function(t, e) {
|
|
42
|
+
var r = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
43
|
+
if (null != r) {
|
|
44
|
+
var n, o, i, a, u = [], l = !0, c = !1;
|
|
45
|
+
try {
|
|
46
|
+
if (i = (r = r.call(t)).next, 0 === e) {
|
|
47
|
+
if (Object(r) !== r) return;
|
|
48
|
+
l = !1;
|
|
49
|
+
} else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== e); l = !0) ;
|
|
50
|
+
} catch (t) {
|
|
51
|
+
c = !0, o = t;
|
|
52
|
+
} finally {
|
|
53
|
+
try {
|
|
54
|
+
if (!l && null != r.return && (a = r.return(), Object(a) !== a)) return;
|
|
55
|
+
} finally {
|
|
56
|
+
if (c) throw o;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return u;
|
|
60
|
+
}
|
|
61
|
+
}(t, e) || i(t, e) || function() {
|
|
62
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
63
|
+
}();
|
|
64
|
+
}
|
|
65
|
+
function n(t) {
|
|
66
|
+
return n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
40
67
|
return typeof t;
|
|
41
68
|
} : function(t) {
|
|
42
69
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
43
|
-
},
|
|
70
|
+
}, n(t);
|
|
44
71
|
}
|
|
45
|
-
function
|
|
72
|
+
function o(t, e) {
|
|
46
73
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
47
74
|
if (!r) {
|
|
48
|
-
if (Array.isArray(t) || (r =
|
|
49
|
-
if (t) {
|
|
50
|
-
if ("string" == typeof t) return o(t, e);
|
|
51
|
-
var r = {}.toString.call(t).slice(8, -1);
|
|
52
|
-
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) ? o(t, e) : void 0;
|
|
53
|
-
}
|
|
54
|
-
}(t)) || e && t && "number" == typeof t.length) {
|
|
75
|
+
if (Array.isArray(t) || (r = i(t)) || e && t && "number" == typeof t.length) {
|
|
55
76
|
r && (t = r);
|
|
56
|
-
var n = 0,
|
|
77
|
+
var n = 0, o = function() {};
|
|
57
78
|
return {
|
|
58
|
-
s:
|
|
79
|
+
s: o,
|
|
59
80
|
n: function() {
|
|
60
81
|
return n >= t.length ? {
|
|
61
82
|
done: !0
|
|
@@ -67,7 +88,7 @@ var OHLCV_INDICATORS;
|
|
|
67
88
|
e: function(t) {
|
|
68
89
|
throw t;
|
|
69
90
|
},
|
|
70
|
-
f:
|
|
91
|
+
f: o
|
|
71
92
|
};
|
|
72
93
|
}
|
|
73
94
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
@@ -93,7 +114,14 @@ var OHLCV_INDICATORS;
|
|
|
93
114
|
}
|
|
94
115
|
};
|
|
95
116
|
}
|
|
96
|
-
function
|
|
117
|
+
function i(t, e) {
|
|
118
|
+
if (t) {
|
|
119
|
+
if ("string" == typeof t) return a(t, e);
|
|
120
|
+
var r = {}.toString.call(t).slice(8, -1);
|
|
121
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? a(t, e) : void 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function a(t, e) {
|
|
97
125
|
(null == e || e > t.length) && (e = t.length);
|
|
98
126
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
99
127
|
return n;
|
|
@@ -104,37 +132,35 @@ var OHLCV_INDICATORS;
|
|
|
104
132
|
t.d(e, {
|
|
105
133
|
default: () => /* binding */ Ar
|
|
106
134
|
});
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
},
|
|
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) {
|
|
135
|
+
var u = function(t) {
|
|
136
|
+
if (!0 === t.isComputed) throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.');
|
|
137
|
+
}, l = function(t, e, r) {
|
|
112
138
|
if (!Array.isArray(t)) throw new Error('Param "'.concat(e, '" must be an array in "').concat(r, '".'));
|
|
113
139
|
return !0;
|
|
114
|
-
}, l = function(t, e, n) {
|
|
115
|
-
if (!Boolean(t) || "object" == !r(t)) throw new Error('Param "'.concat(e, '" must be an object in "').concat(n, '".'));
|
|
116
|
-
return !0;
|
|
117
140
|
}, c = function(t, e, r) {
|
|
141
|
+
if (!Boolean(t) || "object" == !n(t)) throw new Error('Param "'.concat(e, '" must be an object in "').concat(r, '".'));
|
|
142
|
+
return !0;
|
|
143
|
+
}, s = function(t, e, r) {
|
|
118
144
|
if ("boolean" != typeof t) throw new Error('Param "'.concat(e, '" must be an boolean in "').concat(r, '".'));
|
|
119
145
|
return !0;
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
var o = e.allowDecimals, i = void 0 !== o && o, a = e.min, u = e.max,
|
|
146
|
+
}, f = function(t, e, r, n) {
|
|
147
|
+
c(e, "options", "".concat(n, ".").concat(r, ".validateNumber"));
|
|
148
|
+
var o = e.allowDecimals, i = void 0 !== o && o, a = e.min, u = e.max, l = i ? "number" : "integer";
|
|
123
149
|
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 u || a >= u) throw new Error('Param "min" must be a valid '.concat(
|
|
125
|
-
if (t < a) throw new Error('Param "'.concat(r, '" must be an ').concat(
|
|
126
|
-
if (t > u) throw new Error('Param "'.concat(r, '" must be an ').concat(
|
|
150
|
+
if ("number" != typeof a || "number" != typeof u || a >= u) throw new Error('Param "min" must be a valid '.concat(l, ' lower than "max" "').concat(n, ".").concat(r, '.validateNumber".'));
|
|
151
|
+
if (t < a) throw new Error('Param "'.concat(r, '" must be an ').concat(l, " greater than or equal to ").concat(a, ' in "').concat(n, '".'));
|
|
152
|
+
if (t > u) throw new Error('Param "'.concat(r, '" must be an ').concat(l, " lower than or equal to ").concat(u, ' in "').concat(n, '".'));
|
|
127
153
|
return !0;
|
|
128
154
|
}, // 0, 1, 2 or 3
|
|
129
155
|
// The maximum value of DP and Big.DP.
|
|
130
|
-
|
|
156
|
+
y = 1e6, // 0 to 1000000
|
|
131
157
|
// The maximum magnitude of the exponent argument to the pow method.
|
|
132
158
|
h = 1e6, // true or false
|
|
133
159
|
/**************************************************************************************************/
|
|
134
160
|
// Error messages.
|
|
135
|
-
p = "[big.js] ",
|
|
161
|
+
p = "[big.js] ", v = p + "Invalid ", m = v + "decimal places", d = v + "rounding mode", b = p + "Division by zero",
|
|
136
162
|
// The shared prototype object.
|
|
137
|
-
|
|
163
|
+
g = {}, w = void 0, O = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
138
164
|
/*
|
|
139
165
|
* Round Big x to a maximum of sd significant digits using rounding mode rm.
|
|
140
166
|
*
|
|
@@ -143,10 +169,10 @@ var OHLCV_INDICATORS;
|
|
|
143
169
|
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
144
170
|
* [more] {boolean} Whether the result of division was truncated.
|
|
145
171
|
*/
|
|
146
|
-
function
|
|
172
|
+
function S(t, e, r, n) {
|
|
147
173
|
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] !==
|
|
174
|
+
if (r === w && (r = t.constructor.RM), 0 !== r && 1 !== r && 2 !== r && 3 !== r) throw Error(d);
|
|
175
|
+
if (e < 1) n = 3 === r && (n || !!o[0]) || 0 === e && (1 === r && o[0] >= 5 || 2 === r && (o[0] > 5 || 5 === o[0] && (n || o[1] !== w))),
|
|
150
176
|
o.length = 1, n ? (
|
|
151
177
|
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
|
152
178
|
t.e = t.e - e + 1, o[0] = 1) :
|
|
@@ -155,7 +181,7 @@ var OHLCV_INDICATORS;
|
|
|
155
181
|
// Round up?
|
|
156
182
|
if (
|
|
157
183
|
// 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] !==
|
|
184
|
+
n = 1 === r && o[e] >= 5 || 2 === r && (o[e] > 5 || 5 === o[e] && (n || o[e + 1] !== w || 1 & o[e - 1])) || 3 === r && (n || !!o[0]),
|
|
159
185
|
// Remove any digits after the required precision.
|
|
160
186
|
o.length = e, n)
|
|
161
187
|
// Rounding up may mean the previous digit has to be rounded up.
|
|
@@ -171,7 +197,7 @@ var OHLCV_INDICATORS;
|
|
|
171
197
|
/*
|
|
172
198
|
* Return a string representing the value of Big x in normal or exponential notation.
|
|
173
199
|
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
174
|
-
*/ function
|
|
200
|
+
*/ function j(t, e, r) {
|
|
175
201
|
var n = t.e, o = t.c.join(""), i = o.length;
|
|
176
202
|
// Exponential notation?
|
|
177
203
|
if (e) o = o.charAt(0) + (i > 1 ? "." + o.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
|
|
@@ -185,7 +211,7 @@ var OHLCV_INDICATORS;
|
|
|
185
211
|
// Prototype/instance methods
|
|
186
212
|
/*
|
|
187
213
|
* Return a new Big whose value is the absolute value of this Big.
|
|
188
|
-
*/
|
|
214
|
+
*/ g.abs = function() {
|
|
189
215
|
var t = new this.constructor(this);
|
|
190
216
|
return t.s = 1, t;
|
|
191
217
|
},
|
|
@@ -194,7 +220,7 @@ var OHLCV_INDICATORS;
|
|
|
194
220
|
* -1 if the value of this Big is less than the value of Big y, or
|
|
195
221
|
* 0 if they have the same value.
|
|
196
222
|
*/
|
|
197
|
-
|
|
223
|
+
g.cmp = function(t) {
|
|
198
224
|
var e, r = this, n = r.c, o = (t = new r.constructor(t)).c, i = r.s, a = t.s, u = r.e, l = t.e;
|
|
199
225
|
// Either zero?
|
|
200
226
|
if (!n[0] || !o[0]) return n[0] ? i : o[0] ? -a : 0;
|
|
@@ -211,103 +237,103 @@ var OHLCV_INDICATORS;
|
|
|
211
237
|
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
|
|
212
238
|
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
213
239
|
*/
|
|
214
|
-
|
|
240
|
+
g.div = function(t) {
|
|
215
241
|
var e = this, r = e.constructor, n = e.c, // dividend
|
|
216
242
|
o = (t = new r(t)).c, // divisor
|
|
217
243
|
i = e.s == t.s ? 1 : -1, a = r.DP;
|
|
218
|
-
if (a !== ~~a || a < 0 || a >
|
|
244
|
+
if (a !== ~~a || a < 0 || a > y) throw Error(m);
|
|
219
245
|
// Divisor is zero?
|
|
220
|
-
if (!o[0]) throw Error(
|
|
246
|
+
if (!o[0]) throw Error(b);
|
|
221
247
|
// Dividend is 0? Return +-0.
|
|
222
248
|
if (!n[0]) return t.s = i, t.c = [ t.e = 0 ], t;
|
|
223
|
-
var u, l, c, s,
|
|
224
|
-
|
|
225
|
-
j =
|
|
249
|
+
var u, l, c, s, f, h = o.slice(), p = u = o.length, v = n.length, d = n.slice(0, u), // remainder
|
|
250
|
+
g = d.length, O = t, // quotient
|
|
251
|
+
j = O.c = [], P = 0, _ = a + (O.e = e.e - t.e) + 1;
|
|
226
252
|
// precision of the result
|
|
227
253
|
// Add zeros to make remainder as long as divisor.
|
|
228
|
-
for (
|
|
254
|
+
for (O.s = i, i = _ < 0 ? 0 : _,
|
|
229
255
|
// Create version of divisor with leading zero.
|
|
230
|
-
|
|
256
|
+
h.unshift(0); g++ < u; ) d.push(0);
|
|
231
257
|
do {
|
|
232
258
|
// n is how many times the divisor goes into current remainder.
|
|
233
259
|
for (c = 0; c < 10; c++) {
|
|
234
260
|
// Compare divisor and remainder.
|
|
235
|
-
if (u != (
|
|
236
|
-
s = o[
|
|
261
|
+
if (u != (g = d.length)) s = u > g ? 1 : -1; else for (f = -1, s = 0; ++f < u; ) if (o[f] != d[f]) {
|
|
262
|
+
s = o[f] > d[f] ? 1 : -1;
|
|
237
263
|
break;
|
|
238
264
|
}
|
|
239
265
|
// If divisor < remainder, subtract divisor from remainder.
|
|
240
266
|
if (!(s < 0)) break;
|
|
241
267
|
// Remainder can't be more than 1 digit longer than divisor.
|
|
242
268
|
// Equalise lengths using divisor with extra leading zero?
|
|
243
|
-
for (l =
|
|
244
|
-
if (
|
|
245
|
-
for (
|
|
246
|
-
--
|
|
269
|
+
for (l = g == u ? o : h; g; ) {
|
|
270
|
+
if (d[--g] < l[g]) {
|
|
271
|
+
for (f = g; f && !d[--f]; ) d[f] = 9;
|
|
272
|
+
--d[f], d[g] += 10;
|
|
247
273
|
}
|
|
248
|
-
|
|
274
|
+
d[g] -= l[g];
|
|
249
275
|
}
|
|
250
|
-
for (;!
|
|
276
|
+
for (;!d[0]; ) d.shift();
|
|
251
277
|
}
|
|
252
278
|
// Add the digit n to the result array.
|
|
253
279
|
j[P++] = s ? c : ++c,
|
|
254
280
|
// Update the remainder.
|
|
255
|
-
|
|
256
|
-
} while ((
|
|
281
|
+
d[0] && s ? d[g] = n[p] || 0 : d = [ n[p] ];
|
|
282
|
+
} while ((p++ < v || d[0] !== w) && i--);
|
|
257
283
|
// Leading zero? Do not remove if result is simply zero (qi == 1).
|
|
258
284
|
return j[0] || 1 == P || (
|
|
259
285
|
// There can't be more than one zero.
|
|
260
|
-
j.shift(),
|
|
286
|
+
j.shift(), O.e--, _--),
|
|
261
287
|
// Round?
|
|
262
|
-
P > _ && O
|
|
288
|
+
P > _ && S(O, _, r.RM, d[0] !== w), O;
|
|
263
289
|
},
|
|
264
290
|
/*
|
|
265
291
|
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
266
292
|
*/
|
|
267
|
-
|
|
293
|
+
g.eq = function(t) {
|
|
268
294
|
return 0 === this.cmp(t);
|
|
269
295
|
},
|
|
270
296
|
/*
|
|
271
297
|
* Return true if the value of this Big is greater than the value of Big y, otherwise return
|
|
272
298
|
* false.
|
|
273
299
|
*/
|
|
274
|
-
|
|
300
|
+
g.gt = function(t) {
|
|
275
301
|
return this.cmp(t) > 0;
|
|
276
302
|
},
|
|
277
303
|
/*
|
|
278
304
|
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
|
|
279
305
|
* return false.
|
|
280
306
|
*/
|
|
281
|
-
|
|
307
|
+
g.gte = function(t) {
|
|
282
308
|
return this.cmp(t) > -1;
|
|
283
309
|
},
|
|
284
310
|
/*
|
|
285
311
|
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
|
|
286
312
|
*/
|
|
287
|
-
|
|
313
|
+
g.lt = function(t) {
|
|
288
314
|
return this.cmp(t) < 0;
|
|
289
315
|
},
|
|
290
316
|
/*
|
|
291
317
|
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
|
|
292
318
|
* return false.
|
|
293
319
|
*/
|
|
294
|
-
|
|
320
|
+
g.lte = function(t) {
|
|
295
321
|
return this.cmp(t) < 1;
|
|
296
322
|
},
|
|
297
323
|
/*
|
|
298
324
|
* Return a new Big whose value is the value of this Big minus the value of Big y.
|
|
299
325
|
*/
|
|
300
|
-
|
|
326
|
+
g.minus = g.sub = function(t) {
|
|
301
327
|
var e, r, n, o, i = this, a = i.constructor, u = i.s, l = (t = new a(t)).s;
|
|
302
328
|
// Signs differ?
|
|
303
329
|
if (u != l) return t.s = -l, i.plus(t);
|
|
304
|
-
var c = i.c.slice(), s = i.e, f = t.c,
|
|
330
|
+
var c = i.c.slice(), s = i.e, f = t.c, y = t.e;
|
|
305
331
|
// Either zero?
|
|
306
332
|
if (!c[0] || !f[0]) return f[0] ? t.s = -l : c[0] ? t = new a(i) : t.s = 1,
|
|
307
333
|
t;
|
|
308
334
|
// Determine which is the bigger number. Prepend zeros to equalise exponents.
|
|
309
|
-
if (u = s -
|
|
310
|
-
for ((o = u < 0) ? (u = -u, n = c) : (
|
|
335
|
+
if (u = s - y) {
|
|
336
|
+
for ((o = u < 0) ? (u = -u, n = c) : (y = s, n = f), n.reverse(), l = u; l--; ) n.push(0);
|
|
311
337
|
n.reverse();
|
|
312
338
|
} else for (
|
|
313
339
|
// Exponents equal. Check digit by digit.
|
|
@@ -332,33 +358,33 @@ var OHLCV_INDICATORS;
|
|
|
332
358
|
// Remove trailing zeros.
|
|
333
359
|
for (;0 === c[--l]; ) c.pop();
|
|
334
360
|
// Remove leading zeros and adjust exponent accordingly.
|
|
335
|
-
for (;0 === c[0]; ) c.shift(), --
|
|
361
|
+
for (;0 === c[0]; ) c.shift(), --y;
|
|
336
362
|
return c[0] || (
|
|
337
363
|
// n - n = +0
|
|
338
364
|
t.s = 1,
|
|
339
365
|
// Result must be zero.
|
|
340
|
-
c = [
|
|
366
|
+
c = [ y = 0 ]), t.c = c, t.e = y, t;
|
|
341
367
|
},
|
|
342
368
|
/*
|
|
343
369
|
* Return a new Big whose value is the value of this Big modulo the value of Big y.
|
|
344
370
|
*/
|
|
345
|
-
|
|
371
|
+
g.mod = function(t) {
|
|
346
372
|
var e, r = this, n = r.constructor, o = r.s, i = (t = new n(t)).s;
|
|
347
|
-
if (!t.c[0]) throw Error(
|
|
373
|
+
if (!t.c[0]) throw Error(b);
|
|
348
374
|
return r.s = t.s = 1, e = 1 == t.cmp(r), r.s = o, t.s = i, e ? new n(r) : (o = n.DP,
|
|
349
375
|
i = n.RM, n.DP = n.RM = 0, r = r.div(t), n.DP = o, n.RM = i, this.minus(r.times(t)));
|
|
350
376
|
},
|
|
351
377
|
/*
|
|
352
378
|
* Return a new Big whose value is the value of this Big negated.
|
|
353
379
|
*/
|
|
354
|
-
|
|
380
|
+
g.neg = function() {
|
|
355
381
|
var t = new this.constructor(this);
|
|
356
382
|
return t.s = -t.s, t;
|
|
357
383
|
},
|
|
358
384
|
/*
|
|
359
385
|
* Return a new Big whose value is the value of this Big plus the value of Big y.
|
|
360
386
|
*/
|
|
361
|
-
|
|
387
|
+
g.plus = g.add = function(t) {
|
|
362
388
|
var e, r, n, o = this, i = o.constructor;
|
|
363
389
|
// Signs differ?
|
|
364
390
|
if (t = new i(t), o.s != t.s) return t.s = -t.s, o.minus(t);
|
|
@@ -387,9 +413,9 @@ var OHLCV_INDICATORS;
|
|
|
387
413
|
*
|
|
388
414
|
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
|
|
389
415
|
*/
|
|
390
|
-
|
|
416
|
+
g.pow = function(t) {
|
|
391
417
|
var e = this, r = new e.constructor("1"), n = r, o = t < 0;
|
|
392
|
-
if (t !== ~~t || t < -1e6 || t > h) throw Error(
|
|
418
|
+
if (t !== ~~t || t < -1e6 || t > h) throw Error(v + "exponent");
|
|
393
419
|
for (o && (t = -t); 1 & t && (n = n.times(e)), t >>= 1; ) e = e.times(e);
|
|
394
420
|
return o ? r.div(n) : n;
|
|
395
421
|
},
|
|
@@ -400,9 +426,9 @@ var OHLCV_INDICATORS;
|
|
|
400
426
|
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
401
427
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
402
428
|
*/
|
|
403
|
-
|
|
404
|
-
if (t !== ~~t || t < 1 || t >
|
|
405
|
-
return
|
|
429
|
+
g.prec = function(t, e) {
|
|
430
|
+
if (t !== ~~t || t < 1 || t > y) throw Error(v + "precision");
|
|
431
|
+
return S(new this.constructor(this), t, e);
|
|
406
432
|
},
|
|
407
433
|
/*
|
|
408
434
|
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
@@ -413,15 +439,15 @@ var OHLCV_INDICATORS;
|
|
|
413
439
|
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
|
|
414
440
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
415
441
|
*/
|
|
416
|
-
|
|
417
|
-
if (t ===
|
|
418
|
-
return
|
|
442
|
+
g.round = function(t, e) {
|
|
443
|
+
if (t === w) t = 0; else if (t !== ~~t || t < -y || t > y) throw Error(m);
|
|
444
|
+
return S(new this.constructor(this), t + this.e + 1, e);
|
|
419
445
|
},
|
|
420
446
|
/*
|
|
421
447
|
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
422
448
|
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
423
449
|
*/
|
|
424
|
-
|
|
450
|
+
g.sqrt = function() {
|
|
425
451
|
var t, e, r, n = this, o = n.constructor, i = n.s, a = n.e, u = new o("0.5");
|
|
426
452
|
// Zero?
|
|
427
453
|
if (!n.c[0]) return new o(n);
|
|
@@ -437,12 +463,12 @@ var OHLCV_INDICATORS;
|
|
|
437
463
|
do {
|
|
438
464
|
r = t, t = u.times(r.plus(n.div(r)));
|
|
439
465
|
} while (r.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
|
|
440
|
-
return
|
|
466
|
+
return S(t, (o.DP -= 4) + t.e + 1, o.RM);
|
|
441
467
|
},
|
|
442
468
|
/*
|
|
443
469
|
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
444
470
|
*/
|
|
445
|
-
|
|
471
|
+
g.times = g.mul = function(t) {
|
|
446
472
|
var e, r = this, n = r.constructor, o = r.c, i = (t = new n(t)).c, a = o.length, u = i.length, l = r.e, c = t.e;
|
|
447
473
|
// Determine sign of result.
|
|
448
474
|
// Return signed 0 if either 0.
|
|
@@ -475,13 +501,13 @@ var OHLCV_INDICATORS;
|
|
|
475
501
|
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
476
502
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
477
503
|
*/
|
|
478
|
-
|
|
504
|
+
g.toExponential = function(t, e) {
|
|
479
505
|
var r = this, n = r.c[0];
|
|
480
|
-
if (t !==
|
|
481
|
-
if (t !== ~~t || t < 0 || t >
|
|
482
|
-
for (r =
|
|
506
|
+
if (t !== w) {
|
|
507
|
+
if (t !== ~~t || t < 0 || t > y) throw Error(m);
|
|
508
|
+
for (r = S(new r.constructor(r), ++t, e); r.c.length < t; ) r.c.push(0);
|
|
483
509
|
}
|
|
484
|
-
return
|
|
510
|
+
return j(r, !0, !!n);
|
|
485
511
|
},
|
|
486
512
|
/*
|
|
487
513
|
* Return a string representing the value of this Big in normal notation rounded to dp fixed
|
|
@@ -493,14 +519,14 @@ var OHLCV_INDICATORS;
|
|
|
493
519
|
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
|
|
494
520
|
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
|
|
495
521
|
*/
|
|
496
|
-
|
|
522
|
+
g.toFixed = function(t, e) {
|
|
497
523
|
var r = this, n = r.c[0];
|
|
498
|
-
if (t !==
|
|
499
|
-
if (t !== ~~t || t < 0 || t >
|
|
524
|
+
if (t !== w) {
|
|
525
|
+
if (t !== ~~t || t < 0 || t > y) throw Error(m);
|
|
500
526
|
// x.e may have changed if the value is rounded up.
|
|
501
|
-
for (t = t + (r =
|
|
527
|
+
for (t = t + (r = S(new r.constructor(r), t + r.e + 1, e)).e + 1; r.c.length < t; ) r.c.push(0);
|
|
502
528
|
}
|
|
503
|
-
return
|
|
529
|
+
return j(r, !1, !!n);
|
|
504
530
|
},
|
|
505
531
|
/*
|
|
506
532
|
* Return a string representing the value of this Big.
|
|
@@ -508,15 +534,15 @@ var OHLCV_INDICATORS;
|
|
|
508
534
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
509
535
|
* Omit the sign for negative zero.
|
|
510
536
|
*/
|
|
511
|
-
|
|
537
|
+
g[Symbol.for("nodejs.util.inspect.custom")] = g.toJSON = g.toString = function() {
|
|
512
538
|
var t = this, e = t.constructor;
|
|
513
|
-
return
|
|
539
|
+
return j(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
|
|
514
540
|
},
|
|
515
541
|
/*
|
|
516
542
|
* Return the value of this Big as a primitve number.
|
|
517
543
|
*/
|
|
518
|
-
|
|
519
|
-
var t = Number(
|
|
544
|
+
g.toNumber = function() {
|
|
545
|
+
var t = Number(j(this, !0, !0));
|
|
520
546
|
if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(p + "Imprecise conversion");
|
|
521
547
|
return t;
|
|
522
548
|
},
|
|
@@ -529,13 +555,13 @@ var OHLCV_INDICATORS;
|
|
|
529
555
|
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
530
556
|
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
531
557
|
*/
|
|
532
|
-
|
|
558
|
+
g.toPrecision = function(t, e) {
|
|
533
559
|
var r = this, n = r.constructor, o = r.c[0];
|
|
534
|
-
if (t !==
|
|
535
|
-
if (t !== ~~t || t < 1 || t >
|
|
536
|
-
for (r =
|
|
560
|
+
if (t !== w) {
|
|
561
|
+
if (t !== ~~t || t < 1 || t > y) throw Error(v + "precision");
|
|
562
|
+
for (r = S(new n(r), t, e); r.c.length < t; ) r.c.push(0);
|
|
537
563
|
}
|
|
538
|
-
return
|
|
564
|
+
return j(r, t <= r.e || r.e <= n.NE || r.e >= n.PE, !!o);
|
|
539
565
|
},
|
|
540
566
|
/*
|
|
541
567
|
* Return a string representing the value of this Big.
|
|
@@ -543,10 +569,10 @@ var OHLCV_INDICATORS;
|
|
|
543
569
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
544
570
|
* Include the sign for negative zero.
|
|
545
571
|
*/
|
|
546
|
-
|
|
572
|
+
g.valueOf = function() {
|
|
547
573
|
var t = this, e = t.constructor;
|
|
548
574
|
if (!0 === e.strict) throw Error(p + "valueOf disallowed");
|
|
549
|
-
return
|
|
575
|
+
return j(t, t.e <= e.NE || t.e >= e.PE, !0);
|
|
550
576
|
};
|
|
551
577
|
// Export
|
|
552
578
|
(
|
|
@@ -563,11 +589,11 @@ var OHLCV_INDICATORS;
|
|
|
563
589
|
function e(r) {
|
|
564
590
|
var n = this;
|
|
565
591
|
// Enable constructor usage without new.
|
|
566
|
-
if (!(n instanceof e)) return r ===
|
|
592
|
+
if (!(n instanceof e)) return r === w ? t() : new e(r);
|
|
567
593
|
// Duplicate.
|
|
568
594
|
if (r instanceof e) n.s = r.s, n.e = r.e, n.c = r.c.slice(); else {
|
|
569
595
|
if ("string" != typeof r) {
|
|
570
|
-
if (!0 === e.strict && "bigint" != typeof r) throw TypeError(
|
|
596
|
+
if (!0 === e.strict && "bigint" != typeof r) throw TypeError(v + "value");
|
|
571
597
|
// Minus zero?
|
|
572
598
|
r = 0 === r && 1 / r < 0 ? "-0" : String(r);
|
|
573
599
|
}
|
|
@@ -580,7 +606,7 @@ var OHLCV_INDICATORS;
|
|
|
580
606
|
*/
|
|
581
607
|
function(t, e) {
|
|
582
608
|
var r, n, o;
|
|
583
|
-
if (!
|
|
609
|
+
if (!O.test(e)) throw Error(v + "number");
|
|
584
610
|
// Determine sign.
|
|
585
611
|
// Decimal point?
|
|
586
612
|
t.s = "-" == e.charAt(0) ? (e = e.slice(1), -1) : 1, (r = e.indexOf(".")) > -1 && (e = e.replace(".", ""));
|
|
@@ -606,47 +632,47 @@ var OHLCV_INDICATORS;
|
|
|
606
632
|
// Shadow Big.prototype.constructor which points to Object.
|
|
607
633
|
n.constructor = e;
|
|
608
634
|
}
|
|
609
|
-
return e.prototype =
|
|
635
|
+
return e.prototype = g, e.DP = 20, e.RM = 1, e.NE = -7, e.PE = 21, e.strict = false,
|
|
610
636
|
e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e;
|
|
611
637
|
})();
|
|
612
638
|
/// <reference types="https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/big.js/index.d.ts" />
|
|
613
639
|
/* harmony default export */ // ./node_modules/trading-signals/dist/error/NotEnoughDataError.js
|
|
614
|
-
function
|
|
615
|
-
return
|
|
640
|
+
function P(t) {
|
|
641
|
+
return P = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
616
642
|
return typeof t;
|
|
617
643
|
} : function(t) {
|
|
618
644
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
619
|
-
},
|
|
645
|
+
}, P(t);
|
|
620
646
|
}
|
|
621
|
-
function
|
|
647
|
+
function _(t, e) {
|
|
622
648
|
for (var r = 0; r < e.length; r++) {
|
|
623
649
|
var n = e[r];
|
|
624
650
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
625
|
-
Object.defineProperty(t,
|
|
651
|
+
Object.defineProperty(t, N(n.key), n);
|
|
626
652
|
}
|
|
627
653
|
}
|
|
628
|
-
function
|
|
654
|
+
function N(t) {
|
|
629
655
|
var e = function(t, e) {
|
|
630
|
-
if ("object" !=
|
|
656
|
+
if ("object" != P(t) || !t) return t;
|
|
631
657
|
var r = t[Symbol.toPrimitive];
|
|
632
658
|
if (void 0 !== r) {
|
|
633
659
|
var n = r.call(t, e || "default");
|
|
634
|
-
if ("object" !=
|
|
660
|
+
if ("object" != P(n)) return n;
|
|
635
661
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
636
662
|
}
|
|
637
663
|
return ("string" === e ? String : Number)(t);
|
|
638
664
|
}(t, "string");
|
|
639
|
-
return "symbol" ==
|
|
665
|
+
return "symbol" == P(e) ? e : e + "";
|
|
640
666
|
}
|
|
641
|
-
function
|
|
642
|
-
return e =
|
|
643
|
-
if (e && ("object" ==
|
|
667
|
+
function T(t, e, r) {
|
|
668
|
+
return e = k(e), function(t, e) {
|
|
669
|
+
if (e && ("object" == P(e) || "function" == typeof e)) return e;
|
|
644
670
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
645
671
|
return function(t) {
|
|
646
672
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
647
673
|
return t;
|
|
648
674
|
}(t);
|
|
649
|
-
}(t,
|
|
675
|
+
}(t, E() ? Reflect.construct(e, r || [], k(t).constructor) : e.apply(t, r));
|
|
650
676
|
}
|
|
651
677
|
function A(t) {
|
|
652
678
|
var e = "function" == typeof Map ? new Map : void 0;
|
|
@@ -665,12 +691,12 @@ var OHLCV_INDICATORS;
|
|
|
665
691
|
}
|
|
666
692
|
function r() {
|
|
667
693
|
return function(t, e, r) {
|
|
668
|
-
if (
|
|
694
|
+
if (E()) return Reflect.construct.apply(null, arguments);
|
|
669
695
|
var n = [ null ];
|
|
670
696
|
n.push.apply(n, e);
|
|
671
697
|
var o = new (t.bind.apply(t, n));
|
|
672
|
-
return r &&
|
|
673
|
-
}(t, arguments,
|
|
698
|
+
return r && x(o, r.prototype), o;
|
|
699
|
+
}(t, arguments, k(this).constructor);
|
|
674
700
|
}
|
|
675
701
|
return r.prototype = Object.create(t.prototype, {
|
|
676
702
|
constructor: {
|
|
@@ -679,33 +705,33 @@ var OHLCV_INDICATORS;
|
|
|
679
705
|
writable: !0,
|
|
680
706
|
configurable: !0
|
|
681
707
|
}
|
|
682
|
-
}),
|
|
708
|
+
}), x(r, t);
|
|
683
709
|
}, A(t);
|
|
684
710
|
}
|
|
685
|
-
function
|
|
711
|
+
function E() {
|
|
686
712
|
try {
|
|
687
713
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
688
714
|
} catch (t) {}
|
|
689
|
-
return (
|
|
715
|
+
return (E = function() {
|
|
690
716
|
return !!t;
|
|
691
717
|
})();
|
|
692
718
|
}
|
|
693
|
-
function
|
|
694
|
-
return
|
|
719
|
+
function x(t, e) {
|
|
720
|
+
return x = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
695
721
|
return t.__proto__ = e, t;
|
|
696
|
-
},
|
|
722
|
+
}, x(t, e);
|
|
697
723
|
}
|
|
698
|
-
function
|
|
699
|
-
return
|
|
724
|
+
function k(t) {
|
|
725
|
+
return k = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
700
726
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
701
|
-
},
|
|
727
|
+
}, k(t);
|
|
702
728
|
}
|
|
703
|
-
var
|
|
729
|
+
var I = function(t) {
|
|
704
730
|
function e() {
|
|
705
731
|
var t, r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "Not enough data";
|
|
706
732
|
return function(t, e) {
|
|
707
733
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
708
|
-
}(this, e), t =
|
|
734
|
+
}(this, e), t = T(this, e, [ r ]), Object.setPrototypeOf(t, (this instanceof e ? this.constructor : void 0).prototype),
|
|
709
735
|
t.name = "NotEnoughDataError", t;
|
|
710
736
|
}
|
|
711
737
|
return function(t, e) {
|
|
@@ -718,24 +744,24 @@ var OHLCV_INDICATORS;
|
|
|
718
744
|
}
|
|
719
745
|
}), Object.defineProperty(t, "prototype", {
|
|
720
746
|
writable: !1
|
|
721
|
-
}), e &&
|
|
722
|
-
}(e, t), r = e, n &&
|
|
747
|
+
}), e && x(t, e);
|
|
748
|
+
}(e, t), r = e, n && _(r.prototype, n), o && _(r, o), Object.defineProperty(r, "prototype", {
|
|
723
749
|
writable: !1
|
|
724
750
|
}), r;
|
|
725
751
|
var r, n, o;
|
|
726
752
|
}( A(Error));
|
|
727
753
|
// ./node_modules/trading-signals/dist/Indicator.js
|
|
728
|
-
function
|
|
729
|
-
return
|
|
754
|
+
function M(t) {
|
|
755
|
+
return M = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
730
756
|
return typeof t;
|
|
731
757
|
} : function(t) {
|
|
732
758
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
733
|
-
},
|
|
759
|
+
}, M(t);
|
|
734
760
|
}
|
|
735
|
-
function
|
|
761
|
+
function D(t, e) {
|
|
736
762
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
737
763
|
}
|
|
738
|
-
function
|
|
764
|
+
function R(t, e) {
|
|
739
765
|
for (var r = 0; r < e.length; r++) {
|
|
740
766
|
var n = e[r];
|
|
741
767
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
@@ -743,11 +769,11 @@ var OHLCV_INDICATORS;
|
|
|
743
769
|
}
|
|
744
770
|
}
|
|
745
771
|
function C(t, e, r) {
|
|
746
|
-
return e &&
|
|
772
|
+
return e && R(t.prototype, e), r && R(t, r), Object.defineProperty(t, "prototype", {
|
|
747
773
|
writable: !1
|
|
748
774
|
}), t;
|
|
749
775
|
}
|
|
750
|
-
function
|
|
776
|
+
function F(t, e, r) {
|
|
751
777
|
return (e = L(e)) in t ? Object.defineProperty(t, e, {
|
|
752
778
|
value: r,
|
|
753
779
|
enumerable: !0,
|
|
@@ -757,21 +783,21 @@ var OHLCV_INDICATORS;
|
|
|
757
783
|
}
|
|
758
784
|
function L(t) {
|
|
759
785
|
var e = function(t, e) {
|
|
760
|
-
if ("object" !=
|
|
786
|
+
if ("object" != M(t) || !t) return t;
|
|
761
787
|
var r = t[Symbol.toPrimitive];
|
|
762
788
|
if (void 0 !== r) {
|
|
763
789
|
var n = r.call(t, e || "default");
|
|
764
|
-
if ("object" !=
|
|
790
|
+
if ("object" != M(n)) return n;
|
|
765
791
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
766
792
|
}
|
|
767
793
|
return ("string" === e ? String : Number)(t);
|
|
768
794
|
}(t, "string");
|
|
769
|
-
return "symbol" ==
|
|
795
|
+
return "symbol" == M(e) ? e : e + "";
|
|
770
796
|
}
|
|
771
797
|
var B = function() {
|
|
772
798
|
return C((function t() {
|
|
773
|
-
|
|
774
|
-
|
|
799
|
+
D(this, t), F(this, "previousHighest", void 0), F(this, "highest", void 0), F(this, "previousLowest", void 0),
|
|
800
|
+
F(this, "lowest", void 0), F(this, "previousResult", void 0), F(this, "result", void 0);
|
|
775
801
|
}), [ {
|
|
776
802
|
key: "isStable",
|
|
777
803
|
get: function() {
|
|
@@ -780,7 +806,7 @@ var OHLCV_INDICATORS;
|
|
|
780
806
|
}, {
|
|
781
807
|
key: "getResult",
|
|
782
808
|
value: function() {
|
|
783
|
-
if (void 0 === this.result) throw new
|
|
809
|
+
if (void 0 === this.result) throw new I;
|
|
784
810
|
return this.result;
|
|
785
811
|
}
|
|
786
812
|
}, {
|
|
@@ -800,52 +826,52 @@ var OHLCV_INDICATORS;
|
|
|
800
826
|
} ]);
|
|
801
827
|
}();
|
|
802
828
|
// ./node_modules/trading-signals/dist/MA/MovingAverage.js
|
|
803
|
-
function
|
|
804
|
-
return
|
|
829
|
+
function H(t) {
|
|
830
|
+
return H = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
805
831
|
return typeof t;
|
|
806
832
|
} : function(t) {
|
|
807
833
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
808
|
-
},
|
|
834
|
+
}, H(t);
|
|
809
835
|
}
|
|
810
836
|
function V(t, e) {
|
|
811
837
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
812
838
|
}
|
|
813
|
-
function
|
|
839
|
+
function U(t, e) {
|
|
814
840
|
for (var r = 0; r < e.length; r++) {
|
|
815
841
|
var n = e[r];
|
|
816
842
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
817
|
-
Object.defineProperty(t,
|
|
843
|
+
Object.defineProperty(t, Z(n.key), n);
|
|
818
844
|
}
|
|
819
845
|
}
|
|
820
|
-
function
|
|
821
|
-
return e &&
|
|
846
|
+
function $(t, e, r) {
|
|
847
|
+
return e && U(t.prototype, e), r && U(t, r), Object.defineProperty(t, "prototype", {
|
|
822
848
|
writable: !1
|
|
823
849
|
}), t;
|
|
824
850
|
}
|
|
825
|
-
function
|
|
826
|
-
return e =
|
|
827
|
-
if (e && ("object" ==
|
|
851
|
+
function q(t, e, r) {
|
|
852
|
+
return e = G(e), function(t, e) {
|
|
853
|
+
if (e && ("object" == H(e) || "function" == typeof e)) return e;
|
|
828
854
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
829
855
|
return function(t) {
|
|
830
856
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
831
857
|
return t;
|
|
832
858
|
}(t);
|
|
833
|
-
}(t,
|
|
859
|
+
}(t, z() ? Reflect.construct(e, r || [], G(t).constructor) : e.apply(t, r));
|
|
834
860
|
}
|
|
835
|
-
function
|
|
861
|
+
function z() {
|
|
836
862
|
try {
|
|
837
863
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
838
864
|
} catch (t) {}
|
|
839
|
-
return (
|
|
865
|
+
return (z = function() {
|
|
840
866
|
return !!t;
|
|
841
867
|
})();
|
|
842
868
|
}
|
|
843
|
-
function
|
|
844
|
-
return
|
|
869
|
+
function G(t) {
|
|
870
|
+
return G = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
845
871
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
846
|
-
},
|
|
872
|
+
}, G(t);
|
|
847
873
|
}
|
|
848
|
-
function
|
|
874
|
+
function Y(t, e) {
|
|
849
875
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
850
876
|
t.prototype = Object.create(e && e.prototype, {
|
|
851
877
|
constructor: {
|
|
@@ -855,40 +881,40 @@ var OHLCV_INDICATORS;
|
|
|
855
881
|
}
|
|
856
882
|
}), Object.defineProperty(t, "prototype", {
|
|
857
883
|
writable: !1
|
|
858
|
-
}), e &&
|
|
884
|
+
}), e && K(t, e);
|
|
859
885
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
886
|
+
function K(t, e) {
|
|
887
|
+
return K = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
862
888
|
return t.__proto__ = e, t;
|
|
863
|
-
},
|
|
889
|
+
}, K(t, e);
|
|
864
890
|
}
|
|
865
|
-
function
|
|
866
|
-
return (e =
|
|
891
|
+
function J(t, e, r) {
|
|
892
|
+
return (e = Z(e)) in t ? Object.defineProperty(t, e, {
|
|
867
893
|
value: r,
|
|
868
894
|
enumerable: !0,
|
|
869
895
|
configurable: !0,
|
|
870
896
|
writable: !0
|
|
871
897
|
}) : t[e] = r, t;
|
|
872
898
|
}
|
|
873
|
-
function
|
|
899
|
+
function Z(t) {
|
|
874
900
|
var e = function(t, e) {
|
|
875
|
-
if ("object" !=
|
|
901
|
+
if ("object" != H(t) || !t) return t;
|
|
876
902
|
var r = t[Symbol.toPrimitive];
|
|
877
903
|
if (void 0 !== r) {
|
|
878
904
|
var n = r.call(t, e || "default");
|
|
879
|
-
if ("object" !=
|
|
905
|
+
if ("object" != H(n)) return n;
|
|
880
906
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
881
907
|
}
|
|
882
908
|
return ("string" === e ? String : Number)(t);
|
|
883
909
|
}(t, "string");
|
|
884
|
-
return "symbol" ==
|
|
910
|
+
return "symbol" == H(e) ? e : e + "";
|
|
885
911
|
}
|
|
886
|
-
var
|
|
912
|
+
var Q = function(t) {
|
|
887
913
|
function e(t) {
|
|
888
914
|
var r;
|
|
889
|
-
return V(this, e),
|
|
915
|
+
return V(this, e), J(r = q(this, e), "interval", void 0), r.interval = t, r;
|
|
890
916
|
}
|
|
891
|
-
return
|
|
917
|
+
return Y(e, t), $(e, [ {
|
|
892
918
|
key: "updates",
|
|
893
919
|
value: function(t) {
|
|
894
920
|
var e = this;
|
|
@@ -904,52 +930,52 @@ var OHLCV_INDICATORS;
|
|
|
904
930
|
} ]);
|
|
905
931
|
}(B);
|
|
906
932
|
// ./node_modules/trading-signals/dist/SMA/SMA.js
|
|
907
|
-
function
|
|
908
|
-
return
|
|
933
|
+
function W(t) {
|
|
934
|
+
return W = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
909
935
|
return typeof t;
|
|
910
936
|
} : function(t) {
|
|
911
937
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
912
|
-
},
|
|
938
|
+
}, W(t);
|
|
913
939
|
}
|
|
914
|
-
function
|
|
940
|
+
function X(t, e) {
|
|
915
941
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
916
942
|
}
|
|
917
|
-
function
|
|
943
|
+
function tt(t, e) {
|
|
918
944
|
for (var r = 0; r < e.length; r++) {
|
|
919
945
|
var n = e[r];
|
|
920
946
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
921
|
-
Object.defineProperty(t,
|
|
947
|
+
Object.defineProperty(t, lt(n.key), n);
|
|
922
948
|
}
|
|
923
949
|
}
|
|
924
|
-
function
|
|
925
|
-
return e &&
|
|
950
|
+
function et(t, e, r) {
|
|
951
|
+
return e && tt(t.prototype, e), r && tt(t, r), Object.defineProperty(t, "prototype", {
|
|
926
952
|
writable: !1
|
|
927
953
|
}), t;
|
|
928
954
|
}
|
|
929
|
-
function
|
|
930
|
-
return e =
|
|
931
|
-
if (e && ("object" ==
|
|
955
|
+
function rt(t, e, r) {
|
|
956
|
+
return e = ot(e), function(t, e) {
|
|
957
|
+
if (e && ("object" == W(e) || "function" == typeof e)) return e;
|
|
932
958
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
933
959
|
return function(t) {
|
|
934
960
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
935
961
|
return t;
|
|
936
962
|
}(t);
|
|
937
|
-
}(t,
|
|
963
|
+
}(t, nt() ? Reflect.construct(e, r || [], ot(t).constructor) : e.apply(t, r));
|
|
938
964
|
}
|
|
939
|
-
function
|
|
965
|
+
function nt() {
|
|
940
966
|
try {
|
|
941
967
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
942
968
|
} catch (t) {}
|
|
943
|
-
return (
|
|
969
|
+
return (nt = function() {
|
|
944
970
|
return !!t;
|
|
945
971
|
})();
|
|
946
972
|
}
|
|
947
|
-
function
|
|
948
|
-
return
|
|
973
|
+
function ot(t) {
|
|
974
|
+
return ot = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
949
975
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
950
|
-
},
|
|
976
|
+
}, ot(t);
|
|
951
977
|
}
|
|
952
|
-
function
|
|
978
|
+
function it(t, e) {
|
|
953
979
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
954
980
|
t.prototype = Object.create(e && e.prototype, {
|
|
955
981
|
constructor: {
|
|
@@ -959,42 +985,42 @@ var OHLCV_INDICATORS;
|
|
|
959
985
|
}
|
|
960
986
|
}), Object.defineProperty(t, "prototype", {
|
|
961
987
|
writable: !1
|
|
962
|
-
}), e &&
|
|
988
|
+
}), e && at(t, e);
|
|
963
989
|
}
|
|
964
|
-
function
|
|
965
|
-
return
|
|
990
|
+
function at(t, e) {
|
|
991
|
+
return at = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
966
992
|
return t.__proto__ = e, t;
|
|
967
|
-
},
|
|
993
|
+
}, at(t, e);
|
|
968
994
|
}
|
|
969
|
-
function
|
|
970
|
-
return (e =
|
|
995
|
+
function ut(t, e, r) {
|
|
996
|
+
return (e = lt(e)) in t ? Object.defineProperty(t, e, {
|
|
971
997
|
value: r,
|
|
972
998
|
enumerable: !0,
|
|
973
999
|
configurable: !0,
|
|
974
1000
|
writable: !0
|
|
975
1001
|
}) : t[e] = r, t;
|
|
976
1002
|
}
|
|
977
|
-
function
|
|
1003
|
+
function lt(t) {
|
|
978
1004
|
var e = function(t, e) {
|
|
979
|
-
if ("object" !=
|
|
1005
|
+
if ("object" != W(t) || !t) return t;
|
|
980
1006
|
var r = t[Symbol.toPrimitive];
|
|
981
1007
|
if (void 0 !== r) {
|
|
982
1008
|
var n = r.call(t, e || "default");
|
|
983
|
-
if ("object" !=
|
|
1009
|
+
if ("object" != W(n)) return n;
|
|
984
1010
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
985
1011
|
}
|
|
986
1012
|
return ("string" === e ? String : Number)(t);
|
|
987
1013
|
}(t, "string");
|
|
988
|
-
return "symbol" ==
|
|
1014
|
+
return "symbol" == W(e) ? e : e + "";
|
|
989
1015
|
}
|
|
990
|
-
var
|
|
1016
|
+
var ct = function(t) {
|
|
991
1017
|
function e() {
|
|
992
1018
|
var t;
|
|
993
|
-
|
|
1019
|
+
X(this, e);
|
|
994
1020
|
for (var r = arguments.length, n = new Array(r), o = 0; o < r; o++) n[o] = arguments[o];
|
|
995
|
-
return
|
|
1021
|
+
return ut(t = rt(this, e, [].concat(n)), "prices", []), t;
|
|
996
1022
|
}
|
|
997
|
-
return
|
|
1023
|
+
return it(e, t), et(e, [ {
|
|
998
1024
|
key: "update",
|
|
999
1025
|
value: function(t) {
|
|
1000
1026
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1007,52 +1033,52 @@ var OHLCV_INDICATORS;
|
|
|
1007
1033
|
}
|
|
1008
1034
|
}
|
|
1009
1035
|
} ]);
|
|
1010
|
-
}(
|
|
1036
|
+
}(Q);
|
|
1011
1037
|
// ./node_modules/trading-signals/dist/WSMA/WSMA.js
|
|
1012
|
-
function
|
|
1013
|
-
return
|
|
1038
|
+
function st(t) {
|
|
1039
|
+
return st = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1014
1040
|
return typeof t;
|
|
1015
1041
|
} : function(t) {
|
|
1016
1042
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1017
|
-
},
|
|
1043
|
+
}, st(t);
|
|
1018
1044
|
}
|
|
1019
|
-
function
|
|
1045
|
+
function ft(t, e) {
|
|
1020
1046
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1021
1047
|
}
|
|
1022
|
-
function
|
|
1048
|
+
function yt(t, e) {
|
|
1023
1049
|
for (var r = 0; r < e.length; r++) {
|
|
1024
1050
|
var n = e[r];
|
|
1025
1051
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1026
|
-
Object.defineProperty(t,
|
|
1052
|
+
Object.defineProperty(t, wt(n.key), n);
|
|
1027
1053
|
}
|
|
1028
1054
|
}
|
|
1029
1055
|
function ht(t, e, r) {
|
|
1030
|
-
return e &&
|
|
1056
|
+
return e && yt(t.prototype, e), r && yt(t, r), Object.defineProperty(t, "prototype", {
|
|
1031
1057
|
writable: !1
|
|
1032
1058
|
}), t;
|
|
1033
1059
|
}
|
|
1034
1060
|
function pt(t, e, r) {
|
|
1035
|
-
return e =
|
|
1036
|
-
if (e && ("object" ==
|
|
1061
|
+
return e = mt(e), function(t, e) {
|
|
1062
|
+
if (e && ("object" == st(e) || "function" == typeof e)) return e;
|
|
1037
1063
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1038
1064
|
return function(t) {
|
|
1039
1065
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1040
1066
|
return t;
|
|
1041
1067
|
}(t);
|
|
1042
|
-
}(t,
|
|
1068
|
+
}(t, vt() ? Reflect.construct(e, r || [], mt(t).constructor) : e.apply(t, r));
|
|
1043
1069
|
}
|
|
1044
|
-
function
|
|
1070
|
+
function vt() {
|
|
1045
1071
|
try {
|
|
1046
1072
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1047
1073
|
} catch (t) {}
|
|
1048
|
-
return (
|
|
1074
|
+
return (vt = function() {
|
|
1049
1075
|
return !!t;
|
|
1050
1076
|
})();
|
|
1051
1077
|
}
|
|
1052
|
-
function
|
|
1053
|
-
return
|
|
1078
|
+
function mt(t) {
|
|
1079
|
+
return mt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1054
1080
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1055
|
-
},
|
|
1081
|
+
}, mt(t);
|
|
1056
1082
|
}
|
|
1057
1083
|
function dt(t, e) {
|
|
1058
1084
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -1064,39 +1090,39 @@ var OHLCV_INDICATORS;
|
|
|
1064
1090
|
}
|
|
1065
1091
|
}), Object.defineProperty(t, "prototype", {
|
|
1066
1092
|
writable: !1
|
|
1067
|
-
}), e &&
|
|
1093
|
+
}), e && bt(t, e);
|
|
1068
1094
|
}
|
|
1069
|
-
function
|
|
1070
|
-
return
|
|
1095
|
+
function bt(t, e) {
|
|
1096
|
+
return bt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1071
1097
|
return t.__proto__ = e, t;
|
|
1072
|
-
},
|
|
1098
|
+
}, bt(t, e);
|
|
1073
1099
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return (e =
|
|
1100
|
+
function gt(t, e, r) {
|
|
1101
|
+
return (e = wt(e)) in t ? Object.defineProperty(t, e, {
|
|
1076
1102
|
value: r,
|
|
1077
1103
|
enumerable: !0,
|
|
1078
1104
|
configurable: !0,
|
|
1079
1105
|
writable: !0
|
|
1080
1106
|
}) : t[e] = r, t;
|
|
1081
1107
|
}
|
|
1082
|
-
function
|
|
1108
|
+
function wt(t) {
|
|
1083
1109
|
var e = function(t, e) {
|
|
1084
|
-
if ("object" !=
|
|
1110
|
+
if ("object" != st(t) || !t) return t;
|
|
1085
1111
|
var r = t[Symbol.toPrimitive];
|
|
1086
1112
|
if (void 0 !== r) {
|
|
1087
1113
|
var n = r.call(t, e || "default");
|
|
1088
|
-
if ("object" !=
|
|
1114
|
+
if ("object" != st(n)) return n;
|
|
1089
1115
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1090
1116
|
}
|
|
1091
1117
|
return ("string" === e ? String : Number)(t);
|
|
1092
1118
|
}(t, "string");
|
|
1093
|
-
return "symbol" ==
|
|
1119
|
+
return "symbol" == st(e) ? e : e + "";
|
|
1094
1120
|
}
|
|
1095
|
-
var
|
|
1121
|
+
var Ot = function(t) {
|
|
1096
1122
|
function e(t) {
|
|
1097
1123
|
var r;
|
|
1098
|
-
return
|
|
1099
|
-
|
|
1124
|
+
return ft(this, e), gt(r = pt(this, e), "interval", void 0), gt(r, "indicator", void 0),
|
|
1125
|
+
gt(r, "smoothingFactor", void 0), r.interval = t, r.indicator = new ct(t), r.smoothingFactor = 1 / r.interval,
|
|
1100
1126
|
r;
|
|
1101
1127
|
}
|
|
1102
1128
|
return dt(e, t), ht(e, [ {
|
|
@@ -1123,35 +1149,35 @@ var OHLCV_INDICATORS;
|
|
|
1123
1149
|
}
|
|
1124
1150
|
} ]);
|
|
1125
1151
|
}(B);
|
|
1126
|
-
function
|
|
1152
|
+
function St(t) {
|
|
1127
1153
|
return t.length ? t.reduce((function(t, e) {
|
|
1128
1154
|
return t + e;
|
|
1129
1155
|
}), 0) / t.length : 0;
|
|
1130
1156
|
}
|
|
1131
1157
|
// ./node_modules/trading-signals/dist/BBANDS/BollingerBands.js
|
|
1132
|
-
function
|
|
1133
|
-
return
|
|
1158
|
+
function jt(t) {
|
|
1159
|
+
return jt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1134
1160
|
return typeof t;
|
|
1135
1161
|
} : function(t) {
|
|
1136
1162
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1137
|
-
},
|
|
1163
|
+
}, jt(t);
|
|
1138
1164
|
}
|
|
1139
|
-
function
|
|
1165
|
+
function Pt(t, e) {
|
|
1140
1166
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1141
1167
|
}
|
|
1142
|
-
function
|
|
1168
|
+
function _t(t, e) {
|
|
1143
1169
|
for (var r = 0; r < e.length; r++) {
|
|
1144
1170
|
var n = e[r];
|
|
1145
1171
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1146
1172
|
Object.defineProperty(t, At(n.key), n);
|
|
1147
1173
|
}
|
|
1148
1174
|
}
|
|
1149
|
-
function
|
|
1150
|
-
return e &&
|
|
1175
|
+
function Nt(t, e, r) {
|
|
1176
|
+
return e && _t(t.prototype, e), r && _t(t, r), Object.defineProperty(t, "prototype", {
|
|
1151
1177
|
writable: !1
|
|
1152
1178
|
}), t;
|
|
1153
1179
|
}
|
|
1154
|
-
function
|
|
1180
|
+
function Tt(t, e, r) {
|
|
1155
1181
|
return (e = At(e)) in t ? Object.defineProperty(t, e, {
|
|
1156
1182
|
value: r,
|
|
1157
1183
|
enumerable: !0,
|
|
@@ -1161,29 +1187,29 @@ var OHLCV_INDICATORS;
|
|
|
1161
1187
|
}
|
|
1162
1188
|
function At(t) {
|
|
1163
1189
|
var e = function(t, e) {
|
|
1164
|
-
if ("object" !=
|
|
1190
|
+
if ("object" != jt(t) || !t) return t;
|
|
1165
1191
|
var r = t[Symbol.toPrimitive];
|
|
1166
1192
|
if (void 0 !== r) {
|
|
1167
1193
|
var n = r.call(t, e || "default");
|
|
1168
|
-
if ("object" !=
|
|
1194
|
+
if ("object" != jt(n)) return n;
|
|
1169
1195
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1170
1196
|
}
|
|
1171
1197
|
return ("string" === e ? String : Number)(t);
|
|
1172
1198
|
}(t, "string");
|
|
1173
|
-
return "symbol" ==
|
|
1199
|
+
return "symbol" == jt(e) ? e : e + "";
|
|
1174
1200
|
}
|
|
1175
|
-
var
|
|
1176
|
-
return
|
|
1201
|
+
var Et = function() {
|
|
1202
|
+
return Nt((function t(e) {
|
|
1177
1203
|
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2;
|
|
1178
|
-
|
|
1179
|
-
|
|
1204
|
+
Pt(this, t), Tt(this, "interval", void 0), Tt(this, "deviationMultiplier", void 0),
|
|
1205
|
+
Tt(this, "prices", []), Tt(this, "result", void 0), this.interval = e, this.deviationMultiplier = r;
|
|
1180
1206
|
}), [ {
|
|
1181
1207
|
key: "update",
|
|
1182
1208
|
value: function(t) {
|
|
1183
1209
|
if (this.prices.push(t), this.prices.length > this.interval) {
|
|
1184
1210
|
this.prices.shift();
|
|
1185
|
-
var e =
|
|
1186
|
-
var r = e ||
|
|
1211
|
+
var e = St(this.prices), r = function(t, e) {
|
|
1212
|
+
var r = e || St(t), n = St(t.map((function(t) {
|
|
1187
1213
|
return t - r;
|
|
1188
1214
|
})).map((function(t) {
|
|
1189
1215
|
return t * t;
|
|
@@ -1200,7 +1226,7 @@ var OHLCV_INDICATORS;
|
|
|
1200
1226
|
}, {
|
|
1201
1227
|
key: "getResult",
|
|
1202
1228
|
value: function() {
|
|
1203
|
-
if (void 0 === this.result) throw new
|
|
1229
|
+
if (void 0 === this.result) throw new I;
|
|
1204
1230
|
return this.result;
|
|
1205
1231
|
}
|
|
1206
1232
|
}, {
|
|
@@ -1211,43 +1237,43 @@ var OHLCV_INDICATORS;
|
|
|
1211
1237
|
} ]);
|
|
1212
1238
|
}();
|
|
1213
1239
|
// ./node_modules/trading-signals/dist/EMA/EMA.js
|
|
1214
|
-
function
|
|
1215
|
-
return
|
|
1240
|
+
function xt(t) {
|
|
1241
|
+
return xt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1216
1242
|
return typeof t;
|
|
1217
1243
|
} : function(t) {
|
|
1218
1244
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1219
|
-
},
|
|
1245
|
+
}, xt(t);
|
|
1220
1246
|
}
|
|
1221
|
-
function
|
|
1247
|
+
function kt(t, e) {
|
|
1222
1248
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1223
1249
|
}
|
|
1224
|
-
function
|
|
1250
|
+
function It(t, e) {
|
|
1225
1251
|
for (var r = 0; r < e.length; r++) {
|
|
1226
1252
|
var n = e[r];
|
|
1227
1253
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1228
|
-
Object.defineProperty(t,
|
|
1254
|
+
Object.defineProperty(t, Ht(n.key), n);
|
|
1229
1255
|
}
|
|
1230
1256
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return e &&
|
|
1257
|
+
function Mt(t, e, r) {
|
|
1258
|
+
return e && It(t.prototype, e), r && It(t, r), Object.defineProperty(t, "prototype", {
|
|
1233
1259
|
writable: !1
|
|
1234
1260
|
}), t;
|
|
1235
1261
|
}
|
|
1236
|
-
function
|
|
1262
|
+
function Dt(t, e, r) {
|
|
1237
1263
|
return e = Ct(e), function(t, e) {
|
|
1238
|
-
if (e && ("object" ==
|
|
1264
|
+
if (e && ("object" == xt(e) || "function" == typeof e)) return e;
|
|
1239
1265
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1240
1266
|
return function(t) {
|
|
1241
1267
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1242
1268
|
return t;
|
|
1243
1269
|
}(t);
|
|
1244
|
-
}(t,
|
|
1270
|
+
}(t, Rt() ? Reflect.construct(e, r || [], Ct(t).constructor) : e.apply(t, r));
|
|
1245
1271
|
}
|
|
1246
|
-
function
|
|
1272
|
+
function Rt() {
|
|
1247
1273
|
try {
|
|
1248
1274
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1249
1275
|
} catch (t) {}
|
|
1250
|
-
return (
|
|
1276
|
+
return (Rt = function() {
|
|
1251
1277
|
return !!t;
|
|
1252
1278
|
})();
|
|
1253
1279
|
}
|
|
@@ -1256,7 +1282,7 @@ var OHLCV_INDICATORS;
|
|
|
1256
1282
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1257
1283
|
}, Ct(t);
|
|
1258
1284
|
}
|
|
1259
|
-
function
|
|
1285
|
+
function Ft(t, e) {
|
|
1260
1286
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1261
1287
|
t.prototype = Object.create(e && e.prototype, {
|
|
1262
1288
|
constructor: {
|
|
@@ -1274,34 +1300,34 @@ var OHLCV_INDICATORS;
|
|
|
1274
1300
|
}, Lt(t, e);
|
|
1275
1301
|
}
|
|
1276
1302
|
function Bt(t, e, r) {
|
|
1277
|
-
return (e =
|
|
1303
|
+
return (e = Ht(e)) in t ? Object.defineProperty(t, e, {
|
|
1278
1304
|
value: r,
|
|
1279
1305
|
enumerable: !0,
|
|
1280
1306
|
configurable: !0,
|
|
1281
1307
|
writable: !0
|
|
1282
1308
|
}) : t[e] = r, t;
|
|
1283
1309
|
}
|
|
1284
|
-
function
|
|
1310
|
+
function Ht(t) {
|
|
1285
1311
|
var e = function(t, e) {
|
|
1286
|
-
if ("object" !=
|
|
1312
|
+
if ("object" != xt(t) || !t) return t;
|
|
1287
1313
|
var r = t[Symbol.toPrimitive];
|
|
1288
1314
|
if (void 0 !== r) {
|
|
1289
1315
|
var n = r.call(t, e || "default");
|
|
1290
|
-
if ("object" !=
|
|
1316
|
+
if ("object" != xt(n)) return n;
|
|
1291
1317
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1292
1318
|
}
|
|
1293
1319
|
return ("string" === e ? String : Number)(t);
|
|
1294
1320
|
}(t, "string");
|
|
1295
|
-
return "symbol" ==
|
|
1321
|
+
return "symbol" == xt(e) ? e : e + "";
|
|
1296
1322
|
}
|
|
1297
1323
|
var Vt = function(t) {
|
|
1298
1324
|
function e(t) {
|
|
1299
1325
|
var r;
|
|
1300
|
-
return
|
|
1326
|
+
return kt(this, e), Bt(r = Dt(this, e, [ t ]), "interval", void 0), Bt(r, "pricesCounter", 0),
|
|
1301
1327
|
Bt(r, "weightFactor", void 0), r.interval = t, r.weightFactor = 2 / (r.interval + 1),
|
|
1302
1328
|
r;
|
|
1303
1329
|
}
|
|
1304
|
-
return
|
|
1330
|
+
return Ft(e, t), Mt(e, [ {
|
|
1305
1331
|
key: "update",
|
|
1306
1332
|
value: function(t) {
|
|
1307
1333
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1311,7 +1337,7 @@ var OHLCV_INDICATORS;
|
|
|
1311
1337
|
}, {
|
|
1312
1338
|
key: "getResult",
|
|
1313
1339
|
value: function() {
|
|
1314
|
-
if (this.pricesCounter < this.interval) throw new
|
|
1340
|
+
if (this.pricesCounter < this.interval) throw new I;
|
|
1315
1341
|
return this.result;
|
|
1316
1342
|
}
|
|
1317
1343
|
}, {
|
|
@@ -1324,60 +1350,60 @@ var OHLCV_INDICATORS;
|
|
|
1324
1350
|
}
|
|
1325
1351
|
}
|
|
1326
1352
|
} ]);
|
|
1327
|
-
}(
|
|
1353
|
+
}(Q);
|
|
1328
1354
|
// ./node_modules/trading-signals/dist/MACD/MACD.js
|
|
1329
|
-
function
|
|
1330
|
-
return
|
|
1355
|
+
function Ut(t) {
|
|
1356
|
+
return Ut = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1331
1357
|
return typeof t;
|
|
1332
1358
|
} : function(t) {
|
|
1333
1359
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1334
|
-
},
|
|
1360
|
+
}, Ut(t);
|
|
1335
1361
|
}
|
|
1336
|
-
function
|
|
1362
|
+
function $t(t, e) {
|
|
1337
1363
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1338
1364
|
}
|
|
1339
|
-
function
|
|
1365
|
+
function qt(t, e) {
|
|
1340
1366
|
for (var r = 0; r < e.length; r++) {
|
|
1341
1367
|
var n = e[r];
|
|
1342
1368
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1343
|
-
Object.defineProperty(t,
|
|
1369
|
+
Object.defineProperty(t, Yt(n.key), n);
|
|
1344
1370
|
}
|
|
1345
1371
|
}
|
|
1346
|
-
function
|
|
1347
|
-
return e &&
|
|
1372
|
+
function zt(t, e, r) {
|
|
1373
|
+
return e && qt(t.prototype, e), r && qt(t, r), Object.defineProperty(t, "prototype", {
|
|
1348
1374
|
writable: !1
|
|
1349
1375
|
}), t;
|
|
1350
1376
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return (e =
|
|
1377
|
+
function Gt(t, e, r) {
|
|
1378
|
+
return (e = Yt(e)) in t ? Object.defineProperty(t, e, {
|
|
1353
1379
|
value: r,
|
|
1354
1380
|
enumerable: !0,
|
|
1355
1381
|
configurable: !0,
|
|
1356
1382
|
writable: !0
|
|
1357
1383
|
}) : t[e] = r, t;
|
|
1358
1384
|
}
|
|
1359
|
-
function
|
|
1385
|
+
function Yt(t) {
|
|
1360
1386
|
var e = function(t, e) {
|
|
1361
|
-
if ("object" !=
|
|
1387
|
+
if ("object" != Ut(t) || !t) return t;
|
|
1362
1388
|
var r = t[Symbol.toPrimitive];
|
|
1363
1389
|
if (void 0 !== r) {
|
|
1364
1390
|
var n = r.call(t, e || "default");
|
|
1365
|
-
if ("object" !=
|
|
1391
|
+
if ("object" != Ut(n)) return n;
|
|
1366
1392
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1367
1393
|
}
|
|
1368
1394
|
return ("string" === e ? String : Number)(t);
|
|
1369
1395
|
}(t, "string");
|
|
1370
|
-
return "symbol" ==
|
|
1396
|
+
return "symbol" == Ut(e) ? e : e + "";
|
|
1371
1397
|
}
|
|
1372
|
-
var
|
|
1373
|
-
return
|
|
1374
|
-
|
|
1375
|
-
|
|
1398
|
+
var Kt = function() {
|
|
1399
|
+
return zt((function t(e, r, n) {
|
|
1400
|
+
$t(this, t), Gt(this, "short", void 0), Gt(this, "long", void 0), Gt(this, "signal", void 0),
|
|
1401
|
+
Gt(this, "prices", []), Gt(this, "result", void 0), this.short = e, this.long = r,
|
|
1376
1402
|
this.signal = n;
|
|
1377
1403
|
}), [ {
|
|
1378
1404
|
key: "getResult",
|
|
1379
1405
|
value: function() {
|
|
1380
|
-
if (void 0 === this.result) throw new
|
|
1406
|
+
if (void 0 === this.result) throw new I;
|
|
1381
1407
|
return this.result;
|
|
1382
1408
|
}
|
|
1383
1409
|
}, {
|
|
@@ -1403,52 +1429,52 @@ var OHLCV_INDICATORS;
|
|
|
1403
1429
|
} ]);
|
|
1404
1430
|
}();
|
|
1405
1431
|
// ./node_modules/trading-signals/dist/RSI/RSI.js
|
|
1406
|
-
function
|
|
1407
|
-
return
|
|
1432
|
+
function Jt(t) {
|
|
1433
|
+
return Jt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1408
1434
|
return typeof t;
|
|
1409
1435
|
} : function(t) {
|
|
1410
1436
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1411
|
-
},
|
|
1437
|
+
}, Jt(t);
|
|
1412
1438
|
}
|
|
1413
|
-
function
|
|
1439
|
+
function Zt(t, e) {
|
|
1414
1440
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1415
1441
|
}
|
|
1416
|
-
function
|
|
1442
|
+
function Qt(t, e) {
|
|
1417
1443
|
for (var r = 0; r < e.length; r++) {
|
|
1418
1444
|
var n = e[r];
|
|
1419
1445
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1420
|
-
Object.defineProperty(t,
|
|
1446
|
+
Object.defineProperty(t, ie(n.key), n);
|
|
1421
1447
|
}
|
|
1422
1448
|
}
|
|
1423
|
-
function
|
|
1424
|
-
return e &&
|
|
1449
|
+
function Wt(t, e, r) {
|
|
1450
|
+
return e && Qt(t.prototype, e), r && Qt(t, r), Object.defineProperty(t, "prototype", {
|
|
1425
1451
|
writable: !1
|
|
1426
1452
|
}), t;
|
|
1427
1453
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return e =
|
|
1430
|
-
if (e && ("object" ==
|
|
1454
|
+
function Xt(t, e, r) {
|
|
1455
|
+
return e = ee(e), function(t, e) {
|
|
1456
|
+
if (e && ("object" == Jt(e) || "function" == typeof e)) return e;
|
|
1431
1457
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1432
1458
|
return function(t) {
|
|
1433
1459
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1434
1460
|
return t;
|
|
1435
1461
|
}(t);
|
|
1436
|
-
}(t,
|
|
1462
|
+
}(t, te() ? Reflect.construct(e, r || [], ee(t).constructor) : e.apply(t, r));
|
|
1437
1463
|
}
|
|
1438
|
-
function
|
|
1464
|
+
function te() {
|
|
1439
1465
|
try {
|
|
1440
1466
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
1441
1467
|
} catch (t) {}
|
|
1442
|
-
return (
|
|
1468
|
+
return (te = function() {
|
|
1443
1469
|
return !!t;
|
|
1444
1470
|
})();
|
|
1445
1471
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return
|
|
1472
|
+
function ee(t) {
|
|
1473
|
+
return ee = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1448
1474
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1449
|
-
},
|
|
1475
|
+
}, ee(t);
|
|
1450
1476
|
}
|
|
1451
|
-
function
|
|
1477
|
+
function re(t, e) {
|
|
1452
1478
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
1453
1479
|
t.prototype = Object.create(e && e.prototype, {
|
|
1454
1480
|
constructor: {
|
|
@@ -1458,42 +1484,42 @@ var OHLCV_INDICATORS;
|
|
|
1458
1484
|
}
|
|
1459
1485
|
}), Object.defineProperty(t, "prototype", {
|
|
1460
1486
|
writable: !1
|
|
1461
|
-
}), e &&
|
|
1487
|
+
}), e && ne(t, e);
|
|
1462
1488
|
}
|
|
1463
|
-
function
|
|
1464
|
-
return
|
|
1489
|
+
function ne(t, e) {
|
|
1490
|
+
return ne = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1465
1491
|
return t.__proto__ = e, t;
|
|
1466
|
-
},
|
|
1492
|
+
}, ne(t, e);
|
|
1467
1493
|
}
|
|
1468
|
-
function
|
|
1469
|
-
return (e =
|
|
1494
|
+
function oe(t, e, r) {
|
|
1495
|
+
return (e = ie(e)) in t ? Object.defineProperty(t, e, {
|
|
1470
1496
|
value: r,
|
|
1471
1497
|
enumerable: !0,
|
|
1472
1498
|
configurable: !0,
|
|
1473
1499
|
writable: !0
|
|
1474
1500
|
}) : t[e] = r, t;
|
|
1475
1501
|
}
|
|
1476
|
-
function
|
|
1502
|
+
function ie(t) {
|
|
1477
1503
|
var e = function(t, e) {
|
|
1478
|
-
if ("object" !=
|
|
1504
|
+
if ("object" != Jt(t) || !t) return t;
|
|
1479
1505
|
var r = t[Symbol.toPrimitive];
|
|
1480
1506
|
if (void 0 !== r) {
|
|
1481
1507
|
var n = r.call(t, e || "default");
|
|
1482
|
-
if ("object" !=
|
|
1508
|
+
if ("object" != Jt(n)) return n;
|
|
1483
1509
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1484
1510
|
}
|
|
1485
1511
|
return ("string" === e ? String : Number)(t);
|
|
1486
1512
|
}(t, "string");
|
|
1487
|
-
return "symbol" ==
|
|
1513
|
+
return "symbol" == Jt(e) ? e : e + "";
|
|
1488
1514
|
}
|
|
1489
|
-
var
|
|
1515
|
+
var ae = function(t) {
|
|
1490
1516
|
function e(t) {
|
|
1491
|
-
var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] :
|
|
1492
|
-
return
|
|
1493
|
-
|
|
1517
|
+
var r, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Ot;
|
|
1518
|
+
return Zt(this, e), oe(r = Xt(this, e), "interval", void 0), oe(r, "previousPrices", []),
|
|
1519
|
+
oe(r, "avgGain", void 0), oe(r, "avgLoss", void 0), oe(r, "maxValue", 100), r.interval = t,
|
|
1494
1520
|
r.avgGain = new n(r.interval), r.avgLoss = new n(r.interval), r;
|
|
1495
1521
|
}
|
|
1496
|
-
return
|
|
1522
|
+
return re(e, t), Wt(e, [ {
|
|
1497
1523
|
key: "update",
|
|
1498
1524
|
value: function(t) {
|
|
1499
1525
|
var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
@@ -1512,26 +1538,26 @@ var OHLCV_INDICATORS;
|
|
|
1512
1538
|
} ]);
|
|
1513
1539
|
}(B);
|
|
1514
1540
|
// ./src/oscillators/rsi.js
|
|
1515
|
-
function
|
|
1516
|
-
return
|
|
1541
|
+
function ue(t) {
|
|
1542
|
+
return ue = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1517
1543
|
return typeof t;
|
|
1518
1544
|
} : function(t) {
|
|
1519
1545
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1520
|
-
},
|
|
1546
|
+
}, ue(t);
|
|
1521
1547
|
}
|
|
1522
|
-
function
|
|
1548
|
+
function le(t, e, r) {
|
|
1523
1549
|
return (e = function(t) {
|
|
1524
1550
|
var e = function(t, e) {
|
|
1525
|
-
if ("object" !=
|
|
1551
|
+
if ("object" != ue(t) || !t) return t;
|
|
1526
1552
|
var r = t[Symbol.toPrimitive];
|
|
1527
1553
|
if (void 0 !== r) {
|
|
1528
1554
|
var n = r.call(t, e || "default");
|
|
1529
|
-
if ("object" !=
|
|
1555
|
+
if ("object" != ue(n)) return n;
|
|
1530
1556
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1531
1557
|
}
|
|
1532
1558
|
return ("string" === e ? String : Number)(t);
|
|
1533
1559
|
}(t, "string");
|
|
1534
|
-
return "symbol" ==
|
|
1560
|
+
return "symbol" == ue(e) ? e : e + "";
|
|
1535
1561
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1536
1562
|
value: r,
|
|
1537
1563
|
enumerable: !0,
|
|
@@ -1539,57 +1565,57 @@ var OHLCV_INDICATORS;
|
|
|
1539
1565
|
writable: !0
|
|
1540
1566
|
}) : t[e] = r, t;
|
|
1541
1567
|
}
|
|
1542
|
-
var
|
|
1568
|
+
var ce = {
|
|
1543
1569
|
ema: Vt,
|
|
1544
|
-
sma:
|
|
1545
|
-
},
|
|
1546
|
-
var i = o.target, a = o.lag, u = t.verticalOhlcv, l = t.instances, c = t.priceBased, s =
|
|
1570
|
+
sma: ct
|
|
1571
|
+
}, se = function(t, e, r, n, o) {
|
|
1572
|
+
var i = o.target, a = o.lag, u = t.verticalOhlcv, l = t.instances, c = t.priceBased, s = "string" == typeof i && u.hasOwnProperty(i) && "close" !== i ? "_".concat(i) : "", f = "".concat(r, "_").concat(n).concat(s);
|
|
1547
1573
|
if (0 === e) {
|
|
1548
|
-
var
|
|
1574
|
+
var y = t.len, h = t.arrayTypes;
|
|
1549
1575
|
if (!u.hasOwnProperty(i)) throw new Error("Target property ".concat(i, " not found in verticalOhlcv for ").concat(r, "."));
|
|
1550
1576
|
// Create the main moving average instance.
|
|
1551
|
-
l[
|
|
1552
|
-
maInstance: new
|
|
1553
|
-
}, u[
|
|
1577
|
+
l[f] = {
|
|
1578
|
+
maInstance: new ce[r](n)
|
|
1579
|
+
}, u[f] = new Float64Array(y).fill(NaN), c.add(f), a > 0 && t.lag([ f ], a), h[f] = "Float64Array";
|
|
1554
1580
|
}
|
|
1555
1581
|
// Retrieve the current price value.
|
|
1556
|
-
var
|
|
1582
|
+
var p = u[i][e], v = l[f].maInstance;
|
|
1557
1583
|
// Update the moving average instance.
|
|
1558
|
-
v.update(
|
|
1559
|
-
var
|
|
1584
|
+
v.update(p);
|
|
1585
|
+
var m = NaN;
|
|
1560
1586
|
try {
|
|
1561
|
-
|
|
1587
|
+
m = v.getResult();
|
|
1562
1588
|
} catch (t) {
|
|
1563
|
-
|
|
1589
|
+
m = NaN;
|
|
1564
1590
|
}
|
|
1565
1591
|
// Always push the MA value (even if NaN).
|
|
1566
1592
|
return t.pushToMain({
|
|
1567
1593
|
index: e,
|
|
1568
|
-
key:
|
|
1569
|
-
value:
|
|
1594
|
+
key: f,
|
|
1595
|
+
value: m
|
|
1570
1596
|
}), !0;
|
|
1571
1597
|
};
|
|
1572
1598
|
// ./src/moving-averages/macd.js
|
|
1573
|
-
function
|
|
1574
|
-
return
|
|
1599
|
+
function fe(t) {
|
|
1600
|
+
return fe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1575
1601
|
return typeof t;
|
|
1576
1602
|
} : function(t) {
|
|
1577
1603
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1578
|
-
},
|
|
1604
|
+
}, fe(t);
|
|
1579
1605
|
}
|
|
1580
|
-
function
|
|
1606
|
+
function ye(t, e, r) {
|
|
1581
1607
|
return (e = function(t) {
|
|
1582
1608
|
var e = function(t, e) {
|
|
1583
|
-
if ("object" !=
|
|
1609
|
+
if ("object" != fe(t) || !t) return t;
|
|
1584
1610
|
var r = t[Symbol.toPrimitive];
|
|
1585
1611
|
if (void 0 !== r) {
|
|
1586
1612
|
var n = r.call(t, e || "default");
|
|
1587
|
-
if ("object" !=
|
|
1613
|
+
if ("object" != fe(n)) return n;
|
|
1588
1614
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1589
1615
|
}
|
|
1590
1616
|
return ("string" === e ? String : Number)(t);
|
|
1591
1617
|
}(t, "string");
|
|
1592
|
-
return "symbol" ==
|
|
1618
|
+
return "symbol" == fe(e) ? e : e + "";
|
|
1593
1619
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1594
1620
|
value: r,
|
|
1595
1621
|
enumerable: !0,
|
|
@@ -1597,16 +1623,72 @@ var OHLCV_INDICATORS;
|
|
|
1597
1623
|
writable: !0
|
|
1598
1624
|
}) : t[e] = r, t;
|
|
1599
1625
|
}
|
|
1600
|
-
|
|
1626
|
+
function he(t, e) {
|
|
1627
|
+
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1628
|
+
if (!r) {
|
|
1629
|
+
if (Array.isArray(t) || (r = function(t, e) {
|
|
1630
|
+
if (t) {
|
|
1631
|
+
if ("string" == typeof t) return pe(t, e);
|
|
1632
|
+
var r = {}.toString.call(t).slice(8, -1);
|
|
1633
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? pe(t, e) : void 0;
|
|
1634
|
+
}
|
|
1635
|
+
}(t)) || e && t && "number" == typeof t.length) {
|
|
1636
|
+
r && (t = r);
|
|
1637
|
+
var n = 0, o = function() {};
|
|
1638
|
+
return {
|
|
1639
|
+
s: o,
|
|
1640
|
+
n: function() {
|
|
1641
|
+
return n >= t.length ? {
|
|
1642
|
+
done: !0
|
|
1643
|
+
} : {
|
|
1644
|
+
done: !1,
|
|
1645
|
+
value: t[n++]
|
|
1646
|
+
};
|
|
1647
|
+
},
|
|
1648
|
+
e: function(t) {
|
|
1649
|
+
throw t;
|
|
1650
|
+
},
|
|
1651
|
+
f: o
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1655
|
+
}
|
|
1656
|
+
var i, a = !0, u = !1;
|
|
1657
|
+
return {
|
|
1658
|
+
s: function() {
|
|
1659
|
+
r = r.call(t);
|
|
1660
|
+
},
|
|
1661
|
+
n: function() {
|
|
1662
|
+
var t = r.next();
|
|
1663
|
+
return a = t.done, t;
|
|
1664
|
+
},
|
|
1665
|
+
e: function(t) {
|
|
1666
|
+
u = !0, i = t;
|
|
1667
|
+
},
|
|
1668
|
+
f: function() {
|
|
1669
|
+
try {
|
|
1670
|
+
a || null == r.return || r.return();
|
|
1671
|
+
} finally {
|
|
1672
|
+
if (u) throw i;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1677
|
+
function pe(t, e) {
|
|
1678
|
+
(null == e || e > t.length) && (e = t.length);
|
|
1679
|
+
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1680
|
+
return n;
|
|
1681
|
+
}
|
|
1682
|
+
var ve = "close";
|
|
1601
1683
|
// ./src/moving-averages/donchianChannel.js
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1684
|
+
function me(t) {
|
|
1685
|
+
return me = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1604
1686
|
return typeof t;
|
|
1605
1687
|
} : function(t) {
|
|
1606
1688
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1607
|
-
},
|
|
1689
|
+
}, me(t);
|
|
1608
1690
|
}
|
|
1609
|
-
function
|
|
1691
|
+
function de(t, e) {
|
|
1610
1692
|
var r = Object.keys(t);
|
|
1611
1693
|
if (Object.getOwnPropertySymbols) {
|
|
1612
1694
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -1616,19 +1698,19 @@ var OHLCV_INDICATORS;
|
|
|
1616
1698
|
}
|
|
1617
1699
|
return r;
|
|
1618
1700
|
}
|
|
1619
|
-
function
|
|
1701
|
+
function be(t, e, r) {
|
|
1620
1702
|
return (e = function(t) {
|
|
1621
1703
|
var e = function(t, e) {
|
|
1622
|
-
if ("object" !=
|
|
1704
|
+
if ("object" != me(t) || !t) return t;
|
|
1623
1705
|
var r = t[Symbol.toPrimitive];
|
|
1624
1706
|
if (void 0 !== r) {
|
|
1625
1707
|
var n = r.call(t, e || "default");
|
|
1626
|
-
if ("object" !=
|
|
1708
|
+
if ("object" != me(n)) return n;
|
|
1627
1709
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1628
1710
|
}
|
|
1629
1711
|
return ("string" === e ? String : Number)(t);
|
|
1630
1712
|
}(t, "string");
|
|
1631
|
-
return "symbol" ==
|
|
1713
|
+
return "symbol" == me(e) ? e : e + "";
|
|
1632
1714
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1633
1715
|
value: r,
|
|
1634
1716
|
enumerable: !0,
|
|
@@ -1636,14 +1718,14 @@ var OHLCV_INDICATORS;
|
|
|
1636
1718
|
writable: !0
|
|
1637
1719
|
}) : t[e] = r, t;
|
|
1638
1720
|
}
|
|
1639
|
-
function
|
|
1721
|
+
function ge(t, e) {
|
|
1640
1722
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1641
1723
|
if (!r) {
|
|
1642
1724
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
1643
1725
|
if (t) {
|
|
1644
|
-
if ("string" == typeof t) return
|
|
1726
|
+
if ("string" == typeof t) return we(t, e);
|
|
1645
1727
|
var r = {}.toString.call(t).slice(8, -1);
|
|
1646
|
-
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) ?
|
|
1728
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? we(t, e) : void 0;
|
|
1647
1729
|
}
|
|
1648
1730
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
1649
1731
|
r && (t = r);
|
|
@@ -1687,20 +1769,20 @@ var OHLCV_INDICATORS;
|
|
|
1687
1769
|
}
|
|
1688
1770
|
};
|
|
1689
1771
|
}
|
|
1690
|
-
function
|
|
1772
|
+
function we(t, e) {
|
|
1691
1773
|
(null == e || e > t.length) && (e = t.length);
|
|
1692
1774
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1693
1775
|
return n;
|
|
1694
1776
|
}
|
|
1695
1777
|
// ./src/moving-averages/bollingerBands.js
|
|
1696
|
-
function
|
|
1697
|
-
return
|
|
1778
|
+
function Oe(t) {
|
|
1779
|
+
return Oe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1698
1780
|
return typeof t;
|
|
1699
1781
|
} : function(t) {
|
|
1700
1782
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1701
|
-
},
|
|
1783
|
+
}, Oe(t);
|
|
1702
1784
|
}
|
|
1703
|
-
function
|
|
1785
|
+
function Se(t, e) {
|
|
1704
1786
|
var r = Object.keys(t);
|
|
1705
1787
|
if (Object.getOwnPropertySymbols) {
|
|
1706
1788
|
var n = Object.getOwnPropertySymbols(t);
|
|
@@ -1710,19 +1792,19 @@ var OHLCV_INDICATORS;
|
|
|
1710
1792
|
}
|
|
1711
1793
|
return r;
|
|
1712
1794
|
}
|
|
1713
|
-
function
|
|
1795
|
+
function je(t, e, r) {
|
|
1714
1796
|
return (e = function(t) {
|
|
1715
1797
|
var e = function(t, e) {
|
|
1716
|
-
if ("object" !=
|
|
1798
|
+
if ("object" != Oe(t) || !t) return t;
|
|
1717
1799
|
var r = t[Symbol.toPrimitive];
|
|
1718
1800
|
if (void 0 !== r) {
|
|
1719
1801
|
var n = r.call(t, e || "default");
|
|
1720
|
-
if ("object" !=
|
|
1802
|
+
if ("object" != Oe(n)) return n;
|
|
1721
1803
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1722
1804
|
}
|
|
1723
1805
|
return ("string" === e ? String : Number)(t);
|
|
1724
1806
|
}(t, "string");
|
|
1725
|
-
return "symbol" ==
|
|
1807
|
+
return "symbol" == Oe(e) ? e : e + "";
|
|
1726
1808
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1727
1809
|
value: r,
|
|
1728
1810
|
enumerable: !0,
|
|
@@ -1730,14 +1812,14 @@ var OHLCV_INDICATORS;
|
|
|
1730
1812
|
writable: !0
|
|
1731
1813
|
}) : t[e] = r, t;
|
|
1732
1814
|
}
|
|
1733
|
-
function
|
|
1815
|
+
function Pe(t, e) {
|
|
1734
1816
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
1735
1817
|
if (!r) {
|
|
1736
1818
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
1737
1819
|
if (t) {
|
|
1738
|
-
if ("string" == typeof t) return
|
|
1820
|
+
if ("string" == typeof t) return _e(t, e);
|
|
1739
1821
|
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) ?
|
|
1822
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _e(t, e) : void 0;
|
|
1741
1823
|
}
|
|
1742
1824
|
}(t)) || e && t && "number" == typeof t.length) {
|
|
1743
1825
|
r && (t = r);
|
|
@@ -1781,60 +1863,21 @@ var OHLCV_INDICATORS;
|
|
|
1781
1863
|
}
|
|
1782
1864
|
};
|
|
1783
1865
|
}
|
|
1784
|
-
function
|
|
1866
|
+
function _e(t, e) {
|
|
1785
1867
|
(null == e || e > t.length) && (e = t.length);
|
|
1786
1868
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1787
1869
|
return n;
|
|
1788
1870
|
}
|
|
1789
1871
|
// ./src/utilities/numberUtilities.js
|
|
1790
|
-
function
|
|
1791
|
-
return
|
|
1872
|
+
function Ne(t) {
|
|
1873
|
+
return Ne = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1792
1874
|
return typeof t;
|
|
1793
1875
|
} : function(t) {
|
|
1794
1876
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1795
|
-
},
|
|
1796
|
-
}
|
|
1797
|
-
function Pe(t, e) {
|
|
1798
|
-
return function(t) {
|
|
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
|
-
}();
|
|
1877
|
+
}, Ne(t);
|
|
1831
1878
|
}
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1835
|
-
return n;
|
|
1836
|
-
}
|
|
1837
|
-
var Ne = {
|
|
1879
|
+
// Helper to clean non-numeric characters (except "-" at the start and decimal point)
|
|
1880
|
+
var Te = {
|
|
1838
1881
|
number: function(t) {
|
|
1839
1882
|
return t;
|
|
1840
1883
|
},
|
|
@@ -1859,17 +1902,17 @@ var OHLCV_INDICATORS;
|
|
|
1859
1902
|
if (o && n.test(o)) return "numberDirtyString";
|
|
1860
1903
|
}
|
|
1861
1904
|
if (e) throw new TypeError("Invalid input: expected a number or numeric string");
|
|
1862
|
-
return
|
|
1905
|
+
return Ne(t);
|
|
1863
1906
|
};
|
|
1864
1907
|
// ./src/utilities/dateUtilities.js
|
|
1865
|
-
function
|
|
1866
|
-
return
|
|
1908
|
+
function Ee(t) {
|
|
1909
|
+
return Ee = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1867
1910
|
return typeof t;
|
|
1868
1911
|
} : function(t) {
|
|
1869
1912
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1870
|
-
},
|
|
1913
|
+
}, Ee(t);
|
|
1871
1914
|
}
|
|
1872
|
-
var
|
|
1915
|
+
var xe = {
|
|
1873
1916
|
dateObject: function(t) {
|
|
1874
1917
|
return t;
|
|
1875
1918
|
},
|
|
@@ -1885,9 +1928,31 @@ var OHLCV_INDICATORS;
|
|
|
1885
1928
|
dateCompleteDateString: function(t) {
|
|
1886
1929
|
return new Date(t);
|
|
1887
1930
|
}
|
|
1931
|
+
}, ke = function(t) {
|
|
1932
|
+
// Regex for a UTC Time Format where the string ends with "Z".
|
|
1933
|
+
var e = [ "Date -> object", "Milliseconds Timestamp -> integer", "Seconds Timestamp -> integer", "UTC Time Format (ISO 8601) -> string", "Including a Timezone Offset (ISO 8601) -> string", "Local Time Format (ISO 8601) -> string", "YYYY/MM/DD or YYYY-MM-DD -> string" ], r = function() {
|
|
1934
|
+
throw new Error('Invalid "'.concat(Ee(t), '" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")));
|
|
1935
|
+
};
|
|
1936
|
+
// Regex for a Timezone Offset Format,
|
|
1937
|
+
// which includes a plus or minus sign followed by HH:MM at the end.
|
|
1938
|
+
if ("object" === Ee(t)) {
|
|
1939
|
+
if (t instanceof Date && !isNaN(t.valueOf())) return "dateObject";
|
|
1940
|
+
r();
|
|
1941
|
+
} else {
|
|
1942
|
+
if ("number" == typeof t)
|
|
1943
|
+
// Use a numeric threshold based on the absolute value: typically,
|
|
1944
|
+
// if the absolute value is below 1e11, then it's a seconds timestamp.
|
|
1945
|
+
// Otherwise, it's a milliseconds timestamp.
|
|
1946
|
+
return Math.abs(t) < 1e11 ? "dateSeconds" : "dateMillseconds";
|
|
1947
|
+
if ("string" == typeof t) {
|
|
1948
|
+
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";
|
|
1949
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) return "dateIncompleteDayString";
|
|
1950
|
+
r();
|
|
1951
|
+
} else r();
|
|
1952
|
+
}
|
|
1888
1953
|
};
|
|
1889
1954
|
// ./src/utilities/assignTypes.js
|
|
1890
|
-
function
|
|
1955
|
+
function Ie(t, e) {
|
|
1891
1956
|
return function(t) {
|
|
1892
1957
|
if (Array.isArray(t)) return t;
|
|
1893
1958
|
}(t) || function(t, e) {
|
|
@@ -1912,62 +1977,21 @@ var OHLCV_INDICATORS;
|
|
|
1912
1977
|
}
|
|
1913
1978
|
}(t, e) || function(t, e) {
|
|
1914
1979
|
if (t) {
|
|
1915
|
-
if ("string" == typeof t) return
|
|
1980
|
+
if ("string" == typeof t) return Me(t, e);
|
|
1916
1981
|
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) ?
|
|
1982
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Me(t, e) : void 0;
|
|
1918
1983
|
}
|
|
1919
1984
|
}(t, e) || function() {
|
|
1920
1985
|
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
1986
|
}();
|
|
1922
1987
|
}
|
|
1923
|
-
function
|
|
1988
|
+
function Me(t, e) {
|
|
1924
1989
|
(null == e || e > t.length) && (e = t.length);
|
|
1925
1990
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
1926
1991
|
return n;
|
|
1927
1992
|
}
|
|
1928
|
-
var
|
|
1993
|
+
var De = new Set([ "open", "high", "low", "close" ]), Re = function(t, e) {
|
|
1929
1994
|
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
1995
|
};
|
|
1972
1996
|
// ./src/studies/lag.js
|
|
1973
1997
|
function Ce(t, e) {
|
|
@@ -1997,7 +2021,7 @@ var OHLCV_INDICATORS;
|
|
|
1997
2021
|
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
2022
|
}();
|
|
1999
2023
|
}
|
|
2000
|
-
function
|
|
2024
|
+
function Fe(t, e) {
|
|
2001
2025
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2002
2026
|
if (!r) {
|
|
2003
2027
|
if (Array.isArray(t) || (r = Le(t)) || e && t && "number" == typeof t.length) {
|
|
@@ -2054,83 +2078,75 @@ var OHLCV_INDICATORS;
|
|
|
2054
2078
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2055
2079
|
return n;
|
|
2056
2080
|
}
|
|
2057
|
-
function
|
|
2058
|
-
return Fe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2059
|
-
return typeof t;
|
|
2060
|
-
} : function(t) {
|
|
2061
|
-
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2062
|
-
}, Fe(t);
|
|
2063
|
-
}
|
|
2064
|
-
var Ve = function(t, e) {
|
|
2081
|
+
var He = function(t, e) {
|
|
2065
2082
|
var r = t.instances, n = t.verticalOhlcv, o = t.len, i = t.arrayTypes, a = t.priceBased;
|
|
2066
2083
|
if (0 === e) {
|
|
2067
|
-
var u = t.inputParams
|
|
2068
|
-
return "lag" === t.key;
|
|
2069
|
-
}));
|
|
2070
|
-
if ("object" !== Fe(u)) return;
|
|
2071
|
-
var l, c = u.map((function(t) {
|
|
2072
|
-
return t.params;
|
|
2073
|
-
})), s = Re(c);
|
|
2084
|
+
var u, l = [], c = Fe(t.inputParams);
|
|
2074
2085
|
try {
|
|
2075
|
-
for (
|
|
2076
|
-
var
|
|
2077
|
-
|
|
2078
|
-
for (v.s(); !(f = v.n()).done; ) {
|
|
2079
|
-
var d = f.value;
|
|
2080
|
-
if (a.includes(d)) for (var m = 1; m <= y; m++) a.push("".concat(d, "_lag_").concat(m));
|
|
2081
|
-
}
|
|
2082
|
-
} catch (t) {
|
|
2083
|
-
v.e(t);
|
|
2084
|
-
} finally {
|
|
2085
|
-
v.f();
|
|
2086
|
-
}
|
|
2086
|
+
for (c.s(); !(u = c.n()).done; ) {
|
|
2087
|
+
var s = u.value;
|
|
2088
|
+
"lag" === s.key && l.push(s.params);
|
|
2087
2089
|
}
|
|
2088
2090
|
} catch (t) {
|
|
2089
|
-
|
|
2091
|
+
c.e(t);
|
|
2090
2092
|
} finally {
|
|
2091
|
-
|
|
2093
|
+
c.f();
|
|
2094
|
+
}
|
|
2095
|
+
for (var f = 0, y = l; f < y.length; f++) {
|
|
2096
|
+
var h, p = Ce(y[f], 2), v = p[0], m = p[1], d = Fe(v);
|
|
2097
|
+
try {
|
|
2098
|
+
for (d.s(); !(h = d.n()).done; ) {
|
|
2099
|
+
var b = h.value;
|
|
2100
|
+
if (a.has(b)) for (var g = 1; g <= m; g++) a.add("".concat(b, "_lag_").concat(g));
|
|
2101
|
+
}
|
|
2102
|
+
} catch (t) {
|
|
2103
|
+
d.e(t);
|
|
2104
|
+
} finally {
|
|
2105
|
+
d.f();
|
|
2106
|
+
}
|
|
2092
2107
|
}
|
|
2093
2108
|
r.lag = {
|
|
2094
|
-
lagParams:
|
|
2109
|
+
lagParams: l
|
|
2095
2110
|
};
|
|
2096
2111
|
}
|
|
2097
|
-
var
|
|
2112
|
+
var w, O = Fe(r.lag.lagParams);
|
|
2098
2113
|
try {
|
|
2099
|
-
for (
|
|
2100
|
-
var
|
|
2114
|
+
for (O.s(); !(w = O.n()).done; ) {
|
|
2115
|
+
var S, j = Ce(w.value, 2), P = j[0], _ = j[1], N = Fe(P);
|
|
2101
2116
|
try {
|
|
2102
|
-
for (
|
|
2103
|
-
var
|
|
2117
|
+
for (N.s(); !(S = N.n()).done; ) {
|
|
2118
|
+
var T = S.value, A = n[T];
|
|
2104
2119
|
// Initialize lagged arrays only on the first index
|
|
2105
|
-
if (0 === e) for (var
|
|
2106
|
-
var x = "".concat(
|
|
2107
|
-
i.hasOwnProperty(
|
|
2120
|
+
if (0 === e) for (var E = 1; E <= _; E++) {
|
|
2121
|
+
var x = "".concat(T, "_lag_").concat(E);
|
|
2122
|
+
if (!i.hasOwnProperty(T)) throw new Error('Lag processing invoked by "'.concat(T, '" expected arrayTypes to have a "').concat(T, '" property, but it wasn’t found.'));
|
|
2123
|
+
n[x] = Re(i[T], o), i[x] = i[T];
|
|
2108
2124
|
}
|
|
2109
2125
|
// Populate lagged values
|
|
2110
|
-
for (var
|
|
2111
|
-
var
|
|
2126
|
+
for (var k = 1; k <= _; k++) {
|
|
2127
|
+
var I = "".concat(T, "_lag_").concat(k), M = e - k, D = M <= 0 || void 0 === A[M] ? null : A[M];
|
|
2112
2128
|
t.pushToMain({
|
|
2113
2129
|
index: e,
|
|
2114
|
-
key:
|
|
2115
|
-
value:
|
|
2130
|
+
key: I,
|
|
2131
|
+
value: D
|
|
2116
2132
|
});
|
|
2117
2133
|
}
|
|
2118
2134
|
}
|
|
2119
2135
|
} catch (t) {
|
|
2120
|
-
|
|
2136
|
+
N.e(t);
|
|
2121
2137
|
} finally {
|
|
2122
|
-
|
|
2138
|
+
N.f();
|
|
2123
2139
|
}
|
|
2124
2140
|
}
|
|
2125
2141
|
} catch (t) {
|
|
2126
|
-
|
|
2142
|
+
O.e(t);
|
|
2127
2143
|
} finally {
|
|
2128
|
-
|
|
2144
|
+
O.f();
|
|
2129
2145
|
}
|
|
2130
2146
|
return !0;
|
|
2131
2147
|
};
|
|
2132
2148
|
// ./src/studies/findCrosses.js
|
|
2133
|
-
function
|
|
2149
|
+
function Ve(t, e) {
|
|
2134
2150
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2135
2151
|
if (!r) {
|
|
2136
2152
|
if (Array.isArray(t) || (r = function(t, e) {
|
|
@@ -2224,12 +2240,11 @@ var OHLCV_INDICATORS;
|
|
|
2224
2240
|
}(this, t), Object.assign(this, {
|
|
2225
2241
|
interval: 0,
|
|
2226
2242
|
prevState: .5,
|
|
2227
|
-
prevFast:
|
|
2228
|
-
prevSlow:
|
|
2229
|
-
prevHigh:
|
|
2230
|
-
prevLow:
|
|
2243
|
+
prevFast: NaN,
|
|
2244
|
+
prevSlow: NaN,
|
|
2245
|
+
prevHigh: NaN,
|
|
2246
|
+
prevLow: NaN,
|
|
2231
2247
|
areHighAndLowUndefined: !1,
|
|
2232
|
-
index: 0,
|
|
2233
2248
|
crossIndexes: {
|
|
2234
2249
|
up: [],
|
|
2235
2250
|
down: []
|
|
@@ -2237,25 +2252,24 @@ var OHLCV_INDICATORS;
|
|
|
2237
2252
|
});
|
|
2238
2253
|
}, (e = [ {
|
|
2239
2254
|
key: "update",
|
|
2240
|
-
value: function(t) {
|
|
2241
|
-
var
|
|
2242
|
-
this.areHighAndLowUndefined || void 0 !==
|
|
2243
|
-
|
|
2255
|
+
value: function(t, e) {
|
|
2256
|
+
var r = e.fast, n = e.high, o = e.slow, i = e.low, a = this.prevState;
|
|
2257
|
+
this.areHighAndLowUndefined || void 0 !== n && void 0 !== i || (this.areHighAndLowUndefined = !0),
|
|
2258
|
+
Number.isNaN(r) || Number.isNaN(o) || function(t, e) {
|
|
2244
2259
|
return t === e;
|
|
2245
|
-
}(
|
|
2246
|
-
return
|
|
2247
|
-
})) && Ye(
|
|
2248
|
-
return
|
|
2249
|
-
})) && Ge(
|
|
2250
|
-
1 === this.interval && this.crossIndexes.up.push(
|
|
2260
|
+
}(r, o) ? a = .5 : Ge(r, o) ? a = this.areHighAndLowUndefined ? 1 : [ i, o, this.prevLow, this.prevSlow ].every((function(t) {
|
|
2261
|
+
return !Number.isNaN(t);
|
|
2262
|
+
})) && Ye(i, o) && Ge(this.prevLow, this.prevSlow) ? 0 : 1 : Ye(r, o) && (a = this.areHighAndLowUndefined ? 0 : [ n, o, this.prevHigh, this.prevSlow ].every((function(t) {
|
|
2263
|
+
return !Number.isNaN(t);
|
|
2264
|
+
})) && Ge(n, o) && Ye(this.prevHigh, this.prevSlow) ? 1 : 0), .5 === a ? this.interval = 0 : 1 === a ? this.prevState <= .5 ? this.interval = 1 : this.interval++ : 0 === a && (this.prevState >= .5 ? this.interval = -1 : this.interval--),
|
|
2265
|
+
1 === this.interval && this.crossIndexes.up.push(t), -1 === this.interval && this.crossIndexes.down.push(t),
|
|
2251
2266
|
//save prev state
|
|
2252
2267
|
Object.assign(this, {
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
prevLow: o
|
|
2268
|
+
prevState: a,
|
|
2269
|
+
prevFast: r,
|
|
2270
|
+
prevSlow: o,
|
|
2271
|
+
prevHigh: n,
|
|
2272
|
+
prevLow: i
|
|
2259
2273
|
});
|
|
2260
2274
|
}
|
|
2261
2275
|
}, {
|
|
@@ -2268,49 +2282,68 @@ var OHLCV_INDICATORS;
|
|
|
2268
2282
|
}), t;
|
|
2269
2283
|
var t, e, r;
|
|
2270
2284
|
}(), Je = function(t, e) {
|
|
2271
|
-
var r = t.verticalOhlcv, n = t.instances, o = t.len;
|
|
2285
|
+
var r = t.verticalOhlcv, n = t.instances, o = t.len, i = t.arrayTypes, a = t.verticalOhlcvTempCols;
|
|
2272
2286
|
if (0 === e) {
|
|
2273
|
-
var
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2287
|
+
var u = t.inputParams;
|
|
2288
|
+
n.crossPairsList = u.reduce((function(t, e) {
|
|
2289
|
+
var r = e.key, n = e.params;
|
|
2290
|
+
if ("crossPairs" === r) {
|
|
2291
|
+
var o, i = Ve(n);
|
|
2292
|
+
try {
|
|
2293
|
+
for (i.s(); !(o = i.n()).done; ) {
|
|
2294
|
+
var a, u = Ve(o.value);
|
|
2295
|
+
try {
|
|
2296
|
+
for (u.s(); !(a = u.n()).done; ) {
|
|
2297
|
+
var l = a.value;
|
|
2298
|
+
t.push(l);
|
|
2299
|
+
}
|
|
2300
|
+
} catch (t) {
|
|
2301
|
+
u.e(t);
|
|
2302
|
+
} finally {
|
|
2303
|
+
u.f();
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
} catch (t) {
|
|
2307
|
+
i.e(t);
|
|
2308
|
+
} finally {
|
|
2309
|
+
i.f();
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
return t;
|
|
2313
|
+
}), []);
|
|
2282
2314
|
}
|
|
2283
|
-
var
|
|
2315
|
+
var l, c = Ve(n.crossPairsList);
|
|
2284
2316
|
try {
|
|
2285
|
-
for (
|
|
2286
|
-
var
|
|
2287
|
-
if (null !=
|
|
2288
|
-
var
|
|
2317
|
+
for (c.s(); !(l = c.n()).done; ) {
|
|
2318
|
+
var s = l.value, f = s.fast, y = s.slow;
|
|
2319
|
+
if (null != f && null != y) {
|
|
2320
|
+
var h = "".concat(f, "_x_").concat(y);
|
|
2289
2321
|
if (0 === e) {
|
|
2290
|
-
if ("number" == typeof
|
|
2291
|
-
|
|
2292
|
-
|
|
2322
|
+
if ("number" == typeof y && (a.add(y.toString()), r[y.toString()] = new Int32Array(o).fill(y)),
|
|
2323
|
+
"price" !== f && !r.hasOwnProperty(f)) throw Error('fast "'.concat(f, ' not found in crossPairs"'));
|
|
2324
|
+
if (!r.hasOwnProperty(y)) throw Error('slow "'.concat(y, ' not found in crossPairs"'));
|
|
2325
|
+
n[h] = new Ke, r[h] = new Int32Array(o).fill(NaN), i[h] = "Int32Array";
|
|
2293
2326
|
}
|
|
2294
|
-
var
|
|
2295
|
-
"price" ===
|
|
2327
|
+
var p = void 0, v = void 0, m = void 0, d = void 0, b = void 0;
|
|
2328
|
+
"price" === f ? (v = r.close[e], m = r.high[e], d = r.low[e], b = r[y][e], n[h].update(e, {
|
|
2329
|
+
fast: v,
|
|
2330
|
+
slow: b,
|
|
2331
|
+
high: m,
|
|
2332
|
+
low: d
|
|
2333
|
+
})) : (p = r[f][e], b = r[y][e], n[h].update(e, {
|
|
2296
2334
|
fast: p,
|
|
2297
|
-
slow:
|
|
2298
|
-
high: y,
|
|
2299
|
-
low: v
|
|
2300
|
-
})) : (h = r[c][e], d = r[s][e], n[f].update({
|
|
2301
|
-
fast: h,
|
|
2302
|
-
slow: d
|
|
2335
|
+
slow: b
|
|
2303
2336
|
})), t.pushToMain({
|
|
2304
2337
|
index: e,
|
|
2305
|
-
key:
|
|
2306
|
-
value: n[
|
|
2338
|
+
key: h,
|
|
2339
|
+
value: n[h].getResult()
|
|
2307
2340
|
});
|
|
2308
2341
|
}
|
|
2309
2342
|
}
|
|
2310
2343
|
} catch (t) {
|
|
2311
|
-
|
|
2344
|
+
c.e(t);
|
|
2312
2345
|
} finally {
|
|
2313
|
-
|
|
2346
|
+
c.f();
|
|
2314
2347
|
}
|
|
2315
2348
|
};
|
|
2316
2349
|
// ./src/studies/dateTime.js
|
|
@@ -2558,8 +2591,8 @@ var OHLCV_INDICATORS;
|
|
|
2558
2591
|
dateTime: function(t, e, r) {
|
|
2559
2592
|
var n = r.lag, o = t.instances, i = t.verticalOhlcv;
|
|
2560
2593
|
if (0 === e) {
|
|
2561
|
-
var a = t.len;
|
|
2562
|
-
if (!
|
|
2594
|
+
var a = t.len, u = t.dateType, l = t.arrayTypes;
|
|
2595
|
+
if (!u) throw Error('dateTime method found and invalid "date" in input ohlcv');
|
|
2563
2596
|
Object.assign(o, {
|
|
2564
2597
|
dateTime: {
|
|
2565
2598
|
prevDateStr: i.date[0],
|
|
@@ -2568,7 +2601,9 @@ var OHLCV_INDICATORS;
|
|
|
2568
2601
|
cachedDayInfo: i.date[0]
|
|
2569
2602
|
}
|
|
2570
2603
|
});
|
|
2571
|
-
var
|
|
2604
|
+
for (var c = [ "day_of_the_week", "day_of_the_month", "week_of_the_month", "hour", "month", "year", "session_daily_index", "session_intraday_index" ], s = 0, f = c; s < f.length; s++) {
|
|
2605
|
+
l[f[s]] = "Int32Array";
|
|
2606
|
+
}
|
|
2572
2607
|
Object.assign(i, function(t) {
|
|
2573
2608
|
for (var e = 1; e < arguments.length; e++) {
|
|
2574
2609
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
@@ -2579,12 +2614,12 @@ var OHLCV_INDICATORS;
|
|
|
2579
2614
|
}));
|
|
2580
2615
|
}
|
|
2581
2616
|
return t;
|
|
2582
|
-
}({}, Object.fromEntries(
|
|
2617
|
+
}({}, Object.fromEntries(c.map((function(t) {
|
|
2583
2618
|
return [ t, new Int32Array(a).fill(NaN) ];
|
|
2584
|
-
}))))), n > 0 && t.lag(
|
|
2619
|
+
}))))), n > 0 && t.lag(c, n);
|
|
2585
2620
|
}
|
|
2586
|
-
var
|
|
2587
|
-
|
|
2621
|
+
var y = i.date[e], h = Xe(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;
|
|
2622
|
+
w !== o.dateTime.prevDateStr && (o.dateTime.prevDateStr = w, o.dateTime.sessionDailyIndexCount++,
|
|
2588
2623
|
o.dateTime.sessionIntradayIndexCount = 0), t.pushToMain({
|
|
2589
2624
|
index: e,
|
|
2590
2625
|
key: "session_daily_index",
|
|
@@ -2596,455 +2631,498 @@ var OHLCV_INDICATORS;
|
|
|
2596
2631
|
}), t.pushToMain({
|
|
2597
2632
|
index: e,
|
|
2598
2633
|
key: "day_of_the_week",
|
|
2599
|
-
value:
|
|
2634
|
+
value: p
|
|
2600
2635
|
}), t.pushToMain({
|
|
2601
2636
|
index: e,
|
|
2602
2637
|
key: "day_of_the_month",
|
|
2603
|
-
value:
|
|
2638
|
+
value: v
|
|
2604
2639
|
}), t.pushToMain({
|
|
2605
2640
|
index: e,
|
|
2606
2641
|
key: "week_of_the_month",
|
|
2607
|
-
value:
|
|
2642
|
+
value: m
|
|
2608
2643
|
}), t.pushToMain({
|
|
2609
2644
|
index: e,
|
|
2610
2645
|
key: "month",
|
|
2611
|
-
value:
|
|
2646
|
+
value: d
|
|
2612
2647
|
}), t.pushToMain({
|
|
2613
2648
|
index: e,
|
|
2614
2649
|
key: "year",
|
|
2615
|
-
value:
|
|
2650
|
+
value: b
|
|
2616
2651
|
}), t.pushToMain({
|
|
2617
2652
|
index: e,
|
|
2618
2653
|
key: "hour",
|
|
2619
|
-
value:
|
|
2654
|
+
value: g
|
|
2620
2655
|
}), o.dateTime.sessionIntradayIndexCount++;
|
|
2621
2656
|
},
|
|
2622
2657
|
rsi: function(t, e, r, n) {
|
|
2623
|
-
var o = n.target, i = n.lag, a = t.verticalOhlcv, u = t.instances, l =
|
|
2658
|
+
var o = n.target, i = n.lag, a = t.verticalOhlcv, u = t.instances, l = "close" === o ? "" : "_".concat(o), c = "rsi_".concat(r).concat(l), s = "rsi_sma_".concat(r).concat(l);
|
|
2624
2659
|
// Initialization on the first index.
|
|
2625
2660
|
if (0 === e) {
|
|
2626
|
-
var
|
|
2661
|
+
var f = t.crossPairsList, y = t.len, h = t.arrayTypes;
|
|
2627
2662
|
if (!a.hasOwnProperty(o)) throw new Error("Target property ".concat(o, " not found in verticalOhlcv for rsi."));
|
|
2628
|
-
|
|
2629
|
-
fast:
|
|
2630
|
-
slow:
|
|
2663
|
+
f.push({
|
|
2664
|
+
fast: c,
|
|
2665
|
+
slow: s,
|
|
2631
2666
|
isDefault: !0
|
|
2632
|
-
}), Object.assign(u,
|
|
2633
|
-
|
|
2667
|
+
}), Object.assign(u, le(le({}, c, new ae(r)), s, new ct(r))), Object.assign(a, le(le({}, c, new Float64Array(y).fill(NaN)), s, new Float64Array(y).fill(NaN)));
|
|
2668
|
+
var p = [ c, s ];
|
|
2669
|
+
i > 0 && t.lag(p, i);
|
|
2670
|
+
for (var v = 0, m = p; v < m.length; v++) {
|
|
2671
|
+
h[m[v]] = "Float64Array";
|
|
2672
|
+
}
|
|
2634
2673
|
}
|
|
2635
|
-
var
|
|
2674
|
+
var d = a[o][e], b = NaN, g = NaN;
|
|
2636
2675
|
// Update the RSI indicator.
|
|
2637
|
-
u[
|
|
2676
|
+
u[c].update(d);
|
|
2638
2677
|
try {
|
|
2639
|
-
|
|
2678
|
+
b = u[c].getResult();
|
|
2640
2679
|
} catch (t) {
|
|
2641
|
-
|
|
2680
|
+
b = NaN;
|
|
2642
2681
|
}
|
|
2643
2682
|
// Always push the RSI value, using NaN as a fallback.
|
|
2644
2683
|
t.pushToMain({
|
|
2645
2684
|
index: e,
|
|
2646
|
-
key:
|
|
2647
|
-
value:
|
|
2685
|
+
key: c,
|
|
2686
|
+
value: b
|
|
2648
2687
|
}),
|
|
2649
2688
|
// Update the SMA indicator only if a valid RSI value is available.
|
|
2650
|
-
Number.isNaN(
|
|
2689
|
+
Number.isNaN(b) || u[s].update(b);
|
|
2651
2690
|
try {
|
|
2652
|
-
|
|
2691
|
+
g = u[s].getResult();
|
|
2653
2692
|
} catch (t) {
|
|
2654
|
-
|
|
2693
|
+
g = NaN;
|
|
2655
2694
|
}
|
|
2656
2695
|
// Always push the smoothed RSI value.
|
|
2657
2696
|
t.pushToMain({
|
|
2658
2697
|
index: e,
|
|
2659
|
-
key:
|
|
2660
|
-
value:
|
|
2698
|
+
key: s,
|
|
2699
|
+
value: g
|
|
2661
2700
|
});
|
|
2662
2701
|
},
|
|
2663
|
-
ema:
|
|
2664
|
-
sma:
|
|
2702
|
+
ema: se,
|
|
2703
|
+
sma: se,
|
|
2665
2704
|
macd: function(t, e, r, n, o, i) {
|
|
2666
|
-
var a = i.target, u = i.lag, l = t.verticalOhlcv, c = t.instances, s =
|
|
2705
|
+
var a = i.target, u = i.lag, l = t.verticalOhlcv, c = t.instances, s = "".concat(r, "_").concat(n, "_").concat(o).concat(a === ve ? "" : "_".concat(a));
|
|
2667
2706
|
// Initialization on the first index.
|
|
2668
2707
|
if (0 === e) {
|
|
2669
|
-
var
|
|
2708
|
+
var f = t.inputParams, y = t.crossPairsList, h = t.priceBased, p = t.len, v = t.arrayTypes;
|
|
2670
2709
|
if (!l.hasOwnProperty(a)) throw new Error("Target property ".concat(a, " not found in verticalOhlcv for macd."));
|
|
2671
|
-
var d =
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2710
|
+
var m, d = 0, b = he(f);
|
|
2711
|
+
try {
|
|
2712
|
+
for (b.s(); !(m = b.n()).done; ) {
|
|
2713
|
+
"macd" === m.value.key && d++;
|
|
2714
|
+
}
|
|
2715
|
+
// Choose a display prefix based on the number of indicators.
|
|
2716
|
+
} catch (t) {
|
|
2717
|
+
b.e(t);
|
|
2718
|
+
} finally {
|
|
2719
|
+
b.f();
|
|
2720
|
+
}
|
|
2721
|
+
var g = d > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", w = a === ve ? "".concat(g, "_diff") : "".concat(g, "_diff_").concat(a), O = a === ve ? "".concat(g, "_dea") : "".concat(g, "_dea_").concat(a), S = a === ve ? "".concat(g, "_histogram") : "".concat(g, "_histogram_").concat(a);
|
|
2722
|
+
// Build the keys.
|
|
2723
|
+
y.push({
|
|
2724
|
+
fast: w,
|
|
2725
|
+
slow: O,
|
|
2678
2726
|
isDefault: !0
|
|
2679
2727
|
}), c.hasOwnProperty("macd") || (c.macd = {
|
|
2680
2728
|
numberOfIndicators: d,
|
|
2681
2729
|
settings: {}
|
|
2682
|
-
}), c.macd.settings[
|
|
2683
|
-
|
|
2730
|
+
}), c.macd.settings[s] = new Kt(new Vt(r), new Vt(n), new Vt(o)), Object.assign(l, ye(ye(ye({}, w, new Float64Array(p).fill(NaN)), O, new Float64Array(p).fill(NaN)), S, new Float64Array(p).fill(NaN))),
|
|
2731
|
+
[ w, O, S ].forEach((function(t) {
|
|
2732
|
+
h.add(t);
|
|
2733
|
+
}));
|
|
2734
|
+
var j = [ w, O, S ];
|
|
2735
|
+
u > 0 && t.lag(j, u);
|
|
2736
|
+
for (var P = 0, _ = j; P < _.length; P++) {
|
|
2737
|
+
v[_[P]] = "Float64Array";
|
|
2738
|
+
}
|
|
2684
2739
|
}
|
|
2685
|
-
var
|
|
2686
|
-
|
|
2687
|
-
var
|
|
2740
|
+
var N = c.macd, T = N.numberOfIndicators, A = N.settings, E = T > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", x = a === ve ? "".concat(E, "_diff") : "".concat(E, "_diff_").concat(a), k = a === ve ? "".concat(E, "_dea") : "".concat(E, "_dea_").concat(a), I = a === ve ? "".concat(E, "_histogram") : "".concat(E, "_histogram_").concat(a), M = A[s], D = l[a][e];
|
|
2741
|
+
M.update(D);
|
|
2742
|
+
var R = {};
|
|
2688
2743
|
try {
|
|
2689
|
-
|
|
2744
|
+
R = M.getResult();
|
|
2690
2745
|
} catch (t) {
|
|
2691
2746
|
// If the result is unavailable, macdResult remains NaN.
|
|
2692
2747
|
}
|
|
2693
2748
|
// Always push values; use NaN as fallback when macdResult is missing.
|
|
2694
2749
|
return t.pushToMain({
|
|
2695
2750
|
index: e,
|
|
2696
|
-
key:
|
|
2697
|
-
value:
|
|
2751
|
+
key: x,
|
|
2752
|
+
value: R ? R.macd : NaN
|
|
2698
2753
|
}), t.pushToMain({
|
|
2699
2754
|
index: e,
|
|
2700
|
-
key:
|
|
2701
|
-
value:
|
|
2755
|
+
key: k,
|
|
2756
|
+
value: R ? R.signal : NaN
|
|
2702
2757
|
}), t.pushToMain({
|
|
2703
2758
|
index: e,
|
|
2704
|
-
key:
|
|
2705
|
-
value:
|
|
2759
|
+
key: I,
|
|
2760
|
+
value: R ? R.histogram : NaN
|
|
2706
2761
|
}), !0;
|
|
2707
2762
|
},
|
|
2708
2763
|
relativeVolume: function(t, e, r, n) {
|
|
2709
|
-
var o = n.lag, i = "relative_volume_".concat(r), a = t.instances, u = t.verticalOhlcv
|
|
2764
|
+
var o = n.lag, i = "relative_volume_".concat(r), a = t.instances, u = t.verticalOhlcv;
|
|
2710
2765
|
if (0 === e) {
|
|
2711
|
-
var c = t.
|
|
2766
|
+
var l = t.len, c = t.arrayTypes;
|
|
2712
2767
|
a[i] = {
|
|
2713
|
-
instance: new
|
|
2768
|
+
instance: new ct(r),
|
|
2714
2769
|
prevRelativeVolumeSma: NaN
|
|
2715
|
-
}, u[i] = new Float64Array(
|
|
2770
|
+
}, u[i] = new Float64Array(l).fill(NaN), o > 0 && t.lag([ i ], o), c[i] = "Float64Array";
|
|
2716
2771
|
}
|
|
2717
2772
|
var s = u.volume[e], f = a[i].instance;
|
|
2718
|
-
f.update(s
|
|
2719
|
-
var
|
|
2773
|
+
f.update(s);
|
|
2774
|
+
var y = NaN;
|
|
2720
2775
|
try {
|
|
2721
|
-
|
|
2776
|
+
y = f.getResult();
|
|
2722
2777
|
} catch (t) {}
|
|
2723
|
-
var
|
|
2778
|
+
var h = a[i].prevRelativeVolumeSma, p = NaN;
|
|
2724
2779
|
// Only calculate relative volume if both current SMA and previous SMA are valid numbers and prevSma is not zero.
|
|
2725
|
-
return Number.isNaN(
|
|
2780
|
+
return Number.isNaN(y) || Number.isNaN(h) || (p = s / h), t.pushToMain({
|
|
2726
2781
|
index: e,
|
|
2727
2782
|
key: i,
|
|
2728
|
-
value:
|
|
2729
|
-
}), a[i].prevRelativeVolumeSma =
|
|
2783
|
+
value: p
|
|
2784
|
+
}), a[i].prevRelativeVolumeSma = y, !0;
|
|
2730
2785
|
},
|
|
2731
2786
|
donchianChannels: function(t, e, r, n, o) {
|
|
2732
2787
|
var i = o.height, a = o.range, u = o.lag, l = "".concat(r, "_").concat(n), c = t.verticalOhlcv, s = t.instances, f = t.len;
|
|
2733
|
-
t.lastIndexReplace;
|
|
2734
2788
|
// Initialization: create output arrays and indicator instance on the first call.
|
|
2735
2789
|
if (0 === e) {
|
|
2736
|
-
var h = t.inputParams, p = t.priceBased,
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2790
|
+
var y, h = t.inputParams, p = t.priceBased, v = t.arrayTypes, m = 0, d = ge(h);
|
|
2791
|
+
try {
|
|
2792
|
+
for (d.s(); !(y = d.n()).done; ) {
|
|
2793
|
+
"donchianChannels" === y.value.key && m++;
|
|
2794
|
+
}
|
|
2795
|
+
} catch (t) {
|
|
2796
|
+
d.e(t);
|
|
2797
|
+
} finally {
|
|
2798
|
+
d.f();
|
|
2799
|
+
}
|
|
2800
|
+
var b = m > 1 ? "donchian_channel_".concat(l) : "donchian_channel", g = [ "".concat(b, "_upper"), "".concat(b, "_basis"), "".concat(b, "_lower") ];
|
|
2801
|
+
i && g.push("".concat(b, "_height")), s.hasOwnProperty("donchian_channel") || (s.donchian_channel = {
|
|
2802
|
+
numberOfIndicators: m,
|
|
2741
2803
|
settings: {}
|
|
2742
2804
|
});
|
|
2743
2805
|
// Set up additional arrays for each range property.
|
|
2744
|
-
var
|
|
2806
|
+
var w, O = ge(a);
|
|
2745
2807
|
try {
|
|
2746
|
-
for (
|
|
2747
|
-
var
|
|
2748
|
-
if (!(
|
|
2749
|
-
|
|
2808
|
+
for (O.s(); !(w = O.n()).done; ) {
|
|
2809
|
+
var S = w.value;
|
|
2810
|
+
if (!(S in c) || !p.has(S)) throw new Error('Invalid range item value "'.concat(S, '" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(p)));
|
|
2811
|
+
g.push("".concat(b, "_range_").concat(S));
|
|
2750
2812
|
}
|
|
2751
2813
|
} catch (t) {
|
|
2752
|
-
|
|
2814
|
+
O.e(t);
|
|
2753
2815
|
} finally {
|
|
2754
|
-
|
|
2816
|
+
O.f();
|
|
2755
2817
|
}
|
|
2756
|
-
var
|
|
2818
|
+
var j = Object.fromEntries(g.map((function(t) {
|
|
2757
2819
|
return [ t, new Float64Array(f).fill(NaN) ];
|
|
2758
2820
|
})));
|
|
2759
2821
|
Object.assign(c, function(t) {
|
|
2760
2822
|
for (var e = 1; e < arguments.length; e++) {
|
|
2761
2823
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2762
|
-
e % 2 ?
|
|
2763
|
-
|
|
2764
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2824
|
+
e % 2 ? de(Object(r), !0).forEach((function(e) {
|
|
2825
|
+
be(t, e, r[e]);
|
|
2826
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach((function(e) {
|
|
2765
2827
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2766
2828
|
}));
|
|
2767
2829
|
}
|
|
2768
2830
|
return t;
|
|
2769
|
-
}({},
|
|
2770
|
-
|
|
2831
|
+
}({}, j)), u > 0 && t.lag(g, u), [ "".concat(b, "_upper"), "".concat(b, "_basis"), "".concat(b, "_lower") ].forEach((function(t) {
|
|
2832
|
+
p.add(t);
|
|
2833
|
+
})), s.donchian_channel.settings[l] = {
|
|
2771
2834
|
maxDeque: [],
|
|
2772
2835
|
// will hold indices for highs in descending order
|
|
2773
2836
|
minDeque: []
|
|
2774
2837
|
};
|
|
2838
|
+
for (var P = 0, _ = g; P < _.length; P++) {
|
|
2839
|
+
v[_[P]] = "Float64Array";
|
|
2840
|
+
}
|
|
2775
2841
|
}
|
|
2776
|
-
var
|
|
2842
|
+
var N = s.donchian_channel.numberOfIndicators > 1 ? "donchian_channel_".concat(l) : "donchian_channel", T = s.donchian_channel.settings[l], A = T.maxDeque, E = T.minDeque, x = e - n, k = x + 1, I = k - r;
|
|
2777
2843
|
// window: [startIdx, endIdx)
|
|
2778
2844
|
// If the window is not fully available, push NaN values for all computed outputs.
|
|
2779
|
-
if (
|
|
2845
|
+
if (I < 0 || k > f) {
|
|
2780
2846
|
t.pushToMain({
|
|
2781
2847
|
index: e,
|
|
2782
|
-
key: "".concat(
|
|
2848
|
+
key: "".concat(N, "_upper"),
|
|
2783
2849
|
value: NaN
|
|
2784
2850
|
}), t.pushToMain({
|
|
2785
2851
|
index: e,
|
|
2786
|
-
key: "".concat(
|
|
2852
|
+
key: "".concat(N, "_basis"),
|
|
2787
2853
|
value: NaN
|
|
2788
2854
|
}), t.pushToMain({
|
|
2789
2855
|
index: e,
|
|
2790
|
-
key: "".concat(
|
|
2856
|
+
key: "".concat(N, "_lower"),
|
|
2791
2857
|
value: NaN
|
|
2792
2858
|
}), i && t.pushToMain({
|
|
2793
2859
|
index: e,
|
|
2794
|
-
key: "".concat(
|
|
2860
|
+
key: "".concat(N, "_height"),
|
|
2795
2861
|
value: NaN
|
|
2796
2862
|
});
|
|
2797
|
-
var
|
|
2863
|
+
var M, D = ge(a);
|
|
2798
2864
|
try {
|
|
2799
|
-
for (
|
|
2800
|
-
var
|
|
2865
|
+
for (D.s(); !(M = D.n()).done; ) {
|
|
2866
|
+
var R = M.value;
|
|
2801
2867
|
t.pushToMain({
|
|
2802
2868
|
index: e,
|
|
2803
|
-
key: "".concat(
|
|
2869
|
+
key: "".concat(N, "_range_").concat(R),
|
|
2804
2870
|
value: NaN
|
|
2805
2871
|
});
|
|
2806
2872
|
}
|
|
2807
2873
|
} catch (t) {
|
|
2808
|
-
|
|
2874
|
+
D.e(t);
|
|
2809
2875
|
} finally {
|
|
2810
|
-
|
|
2876
|
+
D.f();
|
|
2811
2877
|
}
|
|
2812
2878
|
return !0;
|
|
2813
2879
|
}
|
|
2814
2880
|
// **Update the maximum deque:**
|
|
2815
|
-
for (var
|
|
2816
|
-
for (;
|
|
2881
|
+
for (var C = c.high, F = c.low; A.length && A[0] < I; ) A.shift();
|
|
2882
|
+
for (;A.length && C[A[A.length - 1]] <= C[x]; ) A.pop();
|
|
2817
2883
|
// **Update the minimum deque:**
|
|
2818
|
-
for (
|
|
2819
|
-
for (;
|
|
2820
|
-
|
|
2884
|
+
for (A.push(x); E.length && E[0] < I; ) E.shift();
|
|
2885
|
+
for (;E.length && F[E[E.length - 1]] >= F[x]; ) E.pop();
|
|
2886
|
+
E.push(x);
|
|
2821
2887
|
// Retrieve computed values with safety checks.
|
|
2822
|
-
var
|
|
2888
|
+
var L = A.length ? C[A[0]] : NaN, B = E.length ? F[E[0]] : NaN, H = Number.isNaN(L) || Number.isNaN(B) ? NaN : (L + B) / 2;
|
|
2823
2889
|
// Process height if enabled.
|
|
2824
2890
|
if (
|
|
2825
2891
|
// Always push the main indicator values.
|
|
2826
2892
|
t.pushToMain({
|
|
2827
2893
|
index: e,
|
|
2828
|
-
key: "".concat(
|
|
2829
|
-
value:
|
|
2894
|
+
key: "".concat(N, "_upper"),
|
|
2895
|
+
value: L
|
|
2830
2896
|
}), t.pushToMain({
|
|
2831
2897
|
index: e,
|
|
2832
|
-
key: "".concat(
|
|
2833
|
-
value:
|
|
2898
|
+
key: "".concat(N, "_basis"),
|
|
2899
|
+
value: H
|
|
2834
2900
|
}), t.pushToMain({
|
|
2835
2901
|
index: e,
|
|
2836
|
-
key: "".concat(
|
|
2837
|
-
value:
|
|
2902
|
+
key: "".concat(N, "_lower"),
|
|
2903
|
+
value: B
|
|
2838
2904
|
}), i) {
|
|
2839
|
-
var
|
|
2840
|
-
Number.isNaN(
|
|
2905
|
+
var V = NaN;
|
|
2906
|
+
Number.isNaN(L) || Number.isNaN(B) || (V = (L - B) / B), t.pushToMain({
|
|
2841
2907
|
index: e,
|
|
2842
|
-
key: "".concat(
|
|
2843
|
-
value:
|
|
2908
|
+
key: "".concat(N, "_height"),
|
|
2909
|
+
value: V
|
|
2844
2910
|
});
|
|
2845
2911
|
}
|
|
2846
2912
|
// Process each range property.
|
|
2847
|
-
var
|
|
2913
|
+
var U, $ = ge(a);
|
|
2848
2914
|
try {
|
|
2849
|
-
for (
|
|
2850
|
-
var
|
|
2851
|
-
Number.isNaN(
|
|
2915
|
+
for ($.s(); !(U = $.n()).done; ) {
|
|
2916
|
+
var q = U.value, z = NaN, G = c[q][e];
|
|
2917
|
+
Number.isNaN(G) || Number.isNaN(L) || Number.isNaN(B) || (z = (G - B) / (L - B)),
|
|
2852
2918
|
t.pushToMain({
|
|
2853
2919
|
index: e,
|
|
2854
|
-
key: "".concat(
|
|
2855
|
-
value:
|
|
2920
|
+
key: "".concat(N, "_range_").concat(q),
|
|
2921
|
+
value: z
|
|
2856
2922
|
});
|
|
2857
2923
|
}
|
|
2858
2924
|
} catch (t) {
|
|
2859
|
-
|
|
2925
|
+
$.e(t);
|
|
2860
2926
|
} finally {
|
|
2861
|
-
|
|
2927
|
+
$.f();
|
|
2862
2928
|
}
|
|
2863
2929
|
return !0;
|
|
2864
2930
|
},
|
|
2865
2931
|
bollingerBands: function(t, e, r, n, o) {
|
|
2866
|
-
var i, a, u, l, c, s, f,
|
|
2932
|
+
var i, a, u, l, c, s, f, y = o.height, h = o.range, p = void 0 === h ? [] : h, v = o.target, m = o.lag, d = t.verticalOhlcv, b = t.instances, g = "close" === v ? "" : "_".concat(v), w = "".concat(r, "_").concat(n).concat(g);
|
|
2867
2933
|
// Initialization on the first call.
|
|
2868
2934
|
if (0 === e) {
|
|
2869
|
-
var
|
|
2870
|
-
if (!(v in
|
|
2871
|
-
var N =
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2935
|
+
var O = t.priceBased, S = t.inputParams, j = t.verticalOhlcv, P = t.len, _ = t.arrayTypes;
|
|
2936
|
+
if (!(v in j)) throw new Error('bollingerBands could not find target "'.concat(v, '"'));
|
|
2937
|
+
var N, T = 0, A = Pe(S);
|
|
2938
|
+
try {
|
|
2939
|
+
for (A.s(); !(N = A.n()).done; ) {
|
|
2940
|
+
"bollingerBands" === N.value.key && T++;
|
|
2941
|
+
}
|
|
2942
|
+
} catch (t) {
|
|
2943
|
+
A.e(t);
|
|
2944
|
+
} finally {
|
|
2945
|
+
A.f();
|
|
2946
|
+
}
|
|
2947
|
+
f = T > 1 ? "bollinger_bands_".concat(w) : "bollinger_bands".concat(g),
|
|
2875
2948
|
// Only create the container if it doesn't already exist.
|
|
2876
2949
|
b.bollinger_bands || (b.bollinger_bands = {
|
|
2877
|
-
numberOfIndicators:
|
|
2950
|
+
numberOfIndicators: T,
|
|
2878
2951
|
settings: {}
|
|
2879
2952
|
}),
|
|
2880
2953
|
// Add (or override) the indicator instance keyed by indicatorKey.
|
|
2881
|
-
b.bollinger_bands.settings[
|
|
2882
|
-
var
|
|
2883
|
-
|
|
2954
|
+
b.bollinger_bands.settings[w] = new Et(r, n);
|
|
2955
|
+
var E = [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ];
|
|
2956
|
+
y && E.push("".concat(f, "_height"));
|
|
2884
2957
|
// Set up additional arrays for each range property.
|
|
2885
|
-
var x,
|
|
2958
|
+
var x, k = Pe(p);
|
|
2886
2959
|
try {
|
|
2887
|
-
for (
|
|
2888
|
-
var
|
|
2889
|
-
if (!(
|
|
2890
|
-
|
|
2960
|
+
for (k.s(); !(x = k.n()).done; ) {
|
|
2961
|
+
var I = x.value;
|
|
2962
|
+
if (!(I in j) || !O.has(I)) throw new Error('Invalid range item value "'.concat(I, '" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(O)));
|
|
2963
|
+
E.push("".concat(f, "_range_").concat(I));
|
|
2891
2964
|
}
|
|
2892
2965
|
} catch (t) {
|
|
2893
|
-
|
|
2966
|
+
k.e(t);
|
|
2894
2967
|
} finally {
|
|
2895
|
-
|
|
2968
|
+
k.f();
|
|
2896
2969
|
}
|
|
2897
|
-
var
|
|
2898
|
-
return [ t, new Float64Array(
|
|
2970
|
+
var M = Object.fromEntries(E.map((function(t) {
|
|
2971
|
+
return [ t, new Float64Array(P).fill(NaN) ];
|
|
2899
2972
|
})));
|
|
2900
|
-
Object.assign(
|
|
2973
|
+
Object.assign(j, function(t) {
|
|
2901
2974
|
for (var e = 1; e < arguments.length; e++) {
|
|
2902
2975
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2903
|
-
e % 2 ?
|
|
2904
|
-
|
|
2905
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
2976
|
+
e % 2 ? Se(Object(r), !0).forEach((function(e) {
|
|
2977
|
+
je(t, e, r[e]);
|
|
2978
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Se(Object(r)).forEach((function(e) {
|
|
2906
2979
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2907
2980
|
}));
|
|
2908
2981
|
}
|
|
2909
2982
|
return t;
|
|
2910
|
-
}({},
|
|
2983
|
+
}({}, M)), m > 0 && t.lag(E, m), [ "".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower") ].forEach((function(t) {
|
|
2984
|
+
O.add(t);
|
|
2985
|
+
}));
|
|
2986
|
+
for (var D = 0, R = E; D < R.length; D++) {
|
|
2987
|
+
_[R[D]] = "Float64Array";
|
|
2988
|
+
}
|
|
2911
2989
|
}
|
|
2912
2990
|
// Derive prefix for subsequent calls if not set.
|
|
2913
|
-
f || (f = b.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(
|
|
2914
|
-
var
|
|
2991
|
+
f || (f = b.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(w) : "bollinger_bands".concat(g));
|
|
2992
|
+
var C = f, F = b.bollinger_bands.settings[w], L = d[v][e];
|
|
2915
2993
|
// Update the indicator with the current value.
|
|
2916
|
-
|
|
2994
|
+
F.update(L);
|
|
2917
2995
|
// Attempt to retrieve the result.
|
|
2918
|
-
var
|
|
2996
|
+
var B = {};
|
|
2919
2997
|
try {
|
|
2920
|
-
|
|
2998
|
+
B = F.getResult();
|
|
2921
2999
|
} catch (t) {
|
|
2922
3000
|
// If not available, result stays {}.
|
|
2923
3001
|
}
|
|
2924
3002
|
// Use NaN fallbacks for the primary values.
|
|
2925
|
-
var
|
|
3003
|
+
var H = null !== (i = null === (a = B) || void 0 === a ? void 0 : a.upper) && void 0 !== i ? i : NaN, V = null !== (u = null === (l = B) || void 0 === l ? void 0 : l.middle) && void 0 !== u ? u : NaN, U = null !== (c = null === (s = B) || void 0 === s ? void 0 : s.lower) && void 0 !== c ? c : NaN;
|
|
2926
3004
|
// Process height if requested.
|
|
2927
3005
|
if (
|
|
2928
3006
|
// Always push the indicator outputs.
|
|
2929
3007
|
t.pushToMain({
|
|
2930
3008
|
index: e,
|
|
2931
|
-
key: "".concat(
|
|
2932
|
-
value:
|
|
3009
|
+
key: "".concat(C, "_upper"),
|
|
3010
|
+
value: H
|
|
2933
3011
|
}), t.pushToMain({
|
|
2934
3012
|
index: e,
|
|
2935
|
-
key: "".concat(
|
|
2936
|
-
value:
|
|
3013
|
+
key: "".concat(C, "_middle"),
|
|
3014
|
+
value: V
|
|
2937
3015
|
}), t.pushToMain({
|
|
2938
3016
|
index: e,
|
|
2939
|
-
key: "".concat(
|
|
2940
|
-
value:
|
|
2941
|
-
}),
|
|
2942
|
-
var
|
|
2943
|
-
Number.isNaN(
|
|
3017
|
+
key: "".concat(C, "_lower"),
|
|
3018
|
+
value: U
|
|
3019
|
+
}), y) {
|
|
3020
|
+
var $ = NaN;
|
|
3021
|
+
Number.isNaN(U) || Number.isNaN(H) || ($ = (H - U) / U), t.pushToMain({
|
|
2944
3022
|
index: e,
|
|
2945
|
-
key: "".concat(
|
|
2946
|
-
value:
|
|
3023
|
+
key: "".concat(C, "_height"),
|
|
3024
|
+
value: $
|
|
2947
3025
|
});
|
|
2948
3026
|
}
|
|
2949
3027
|
// Process each range property.
|
|
2950
|
-
var
|
|
3028
|
+
var q, z = Pe(p);
|
|
2951
3029
|
try {
|
|
2952
|
-
for (
|
|
2953
|
-
var
|
|
2954
|
-
Number.isNaN(
|
|
3030
|
+
for (z.s(); !(q = z.n()).done; ) {
|
|
3031
|
+
var G = q.value, Y = NaN, K = d[G][e];
|
|
3032
|
+
Number.isNaN(K) || Number.isNaN(U) || Number.isNaN(H) || (Y = (K - U) / (H - U)),
|
|
2955
3033
|
t.pushToMain({
|
|
2956
3034
|
index: e,
|
|
2957
|
-
key: "".concat(
|
|
2958
|
-
value:
|
|
3035
|
+
key: "".concat(C, "_range_").concat(G),
|
|
3036
|
+
value: Y
|
|
2959
3037
|
});
|
|
2960
3038
|
}
|
|
2961
3039
|
} catch (t) {
|
|
2962
|
-
|
|
3040
|
+
z.e(t);
|
|
2963
3041
|
} finally {
|
|
2964
|
-
|
|
3042
|
+
z.f();
|
|
2965
3043
|
}
|
|
2966
3044
|
return !0;
|
|
2967
3045
|
},
|
|
2968
3046
|
volumeOscillator: function(t, e, r, n, o) {
|
|
2969
|
-
var i = o.lag, a = t.verticalOhlcv, u = t.instances, l =
|
|
3047
|
+
var i = o.lag, a = t.verticalOhlcv, u = t.instances, l = a.volume[e], c = "volume_oscillator";
|
|
2970
3048
|
if (0 === e) {
|
|
2971
|
-
var
|
|
3049
|
+
var s = t.crossPairsList, f = t.len, y = t.arrayTypes;
|
|
2972
3050
|
Object.assign(u, {
|
|
2973
3051
|
volume_oscillator: {
|
|
2974
3052
|
fastEMA: new Vt(r),
|
|
2975
3053
|
slowEMA: new Vt(n)
|
|
2976
3054
|
}
|
|
2977
|
-
}), a[
|
|
2978
|
-
fast:
|
|
3055
|
+
}), a[c] = new Float64Array(f).fill(NaN), s.push({
|
|
3056
|
+
fast: c,
|
|
2979
3057
|
slow: 0,
|
|
2980
3058
|
isDefault: !0
|
|
2981
|
-
}), i > 0 && t.lag([
|
|
3059
|
+
}), i > 0 && t.lag([ c ], i), y[c] = "Float64Array";
|
|
2982
3060
|
}
|
|
2983
|
-
var
|
|
2984
|
-
|
|
2985
|
-
var
|
|
3061
|
+
var h = u[c], p = h.fastEMA, v = h.slowEMA;
|
|
3062
|
+
p.update(l), v.update(l);
|
|
3063
|
+
var m = NaN, d = NaN;
|
|
2986
3064
|
try {
|
|
2987
|
-
|
|
3065
|
+
m = p.getResult();
|
|
2988
3066
|
} catch (t) {}
|
|
2989
3067
|
try {
|
|
2990
|
-
|
|
3068
|
+
d = v.getResult();
|
|
2991
3069
|
} catch (t) {}
|
|
2992
3070
|
var b = NaN;
|
|
2993
|
-
return Number.isNaN(
|
|
3071
|
+
return Number.isNaN(m) || Number.isNaN(d) || (b = 100 * (m - d) / d), t.pushToMain({
|
|
2994
3072
|
index: e,
|
|
2995
|
-
key:
|
|
3073
|
+
key: c,
|
|
2996
3074
|
value: b
|
|
2997
3075
|
}), !0;
|
|
2998
3076
|
},
|
|
2999
3077
|
Scaler: function(t, e, r, n, o, i, a,
|
|
3000
3078
|
// used for minmax: [validMin, validMax]
|
|
3001
3079
|
u) {
|
|
3002
|
-
var l = t.verticalOhlcv, c = t.instances, s = t.
|
|
3080
|
+
var l = t.verticalOhlcv, c = t.instances, s = t.arrayTypes, f = "".concat(o, "_").concat(r), y = "";
|
|
3003
3081
|
if (0 === e) {
|
|
3004
|
-
var
|
|
3082
|
+
var h = t.len, p = t.priceBased;
|
|
3005
3083
|
t.groups;
|
|
3006
|
-
|
|
3084
|
+
y = "".concat(f, "_group_").concat(n.join("_")), c.scaler = {
|
|
3007
3085
|
groupKeyLen: n.length,
|
|
3008
|
-
groupKey:
|
|
3086
|
+
groupKey: y,
|
|
3009
3087
|
windows: {}
|
|
3010
3088
|
};
|
|
3011
|
-
var v,
|
|
3089
|
+
var v, m = er(n);
|
|
3012
3090
|
try {
|
|
3013
|
-
var
|
|
3091
|
+
var d = function() {
|
|
3014
3092
|
var e = v.value;
|
|
3015
3093
|
if (!l.hasOwnProperty(e)) throw new Error('Target property "'.concat(e, '" not found in verticalOhlcv'));
|
|
3016
|
-
if (!
|
|
3094
|
+
if (!p.has(e)) throw new Error('Column "'.concat(e, '" is not priceBased and cannot be scaled.'));
|
|
3017
3095
|
var r = "".concat(f, "_").concat(e);
|
|
3018
|
-
l[r] = new Float64Array(
|
|
3019
|
-
var n = i ?
|
|
3020
|
-
if (c.scaler.windows[n] = [], i && (t.ScaledGroups[
|
|
3021
|
-
t.ScaledGroups[
|
|
3096
|
+
l[r] = new Float64Array(h).fill(NaN), s[r] = "Float64Array";
|
|
3097
|
+
var n = i ? y : e;
|
|
3098
|
+
if (c.scaler.windows[n] = [], i && (t.ScaledGroups[y] || (t.ScaledGroups[y] = []),
|
|
3099
|
+
t.ScaledGroups[y].push(r)), u > 0) {
|
|
3022
3100
|
if (i) {
|
|
3023
3101
|
var o, a = Array.from({
|
|
3024
3102
|
length: u
|
|
3025
3103
|
}).map((function(t, e) {
|
|
3026
3104
|
return "".concat(r, "_lag_").concat(e + 1);
|
|
3027
3105
|
}));
|
|
3028
|
-
(o = t.ScaledGroups[
|
|
3106
|
+
(o = t.ScaledGroups[y]).push.apply(o, tr(a));
|
|
3029
3107
|
}
|
|
3030
3108
|
t.lag([ r ], u);
|
|
3031
3109
|
}
|
|
3032
3110
|
};
|
|
3033
|
-
for (
|
|
3111
|
+
for (m.s(); !(v = m.n()).done; ) d();
|
|
3034
3112
|
} catch (t) {
|
|
3035
|
-
|
|
3113
|
+
m.e(t);
|
|
3036
3114
|
} finally {
|
|
3037
|
-
|
|
3115
|
+
m.f();
|
|
3038
3116
|
}
|
|
3039
3117
|
}
|
|
3040
3118
|
var b = c.scaler.windows;
|
|
3041
|
-
|
|
3119
|
+
y = c.scaler.groupKey;
|
|
3042
3120
|
// update windows with current values
|
|
3043
3121
|
var g, w = er(n);
|
|
3044
3122
|
try {
|
|
3045
3123
|
for (w.s(); !(g = w.n()).done; ) {
|
|
3046
|
-
var O = g.value, S = l[O][e], j = b[i ?
|
|
3047
|
-
|
|
3124
|
+
var O = g.value, S = l[O][e], j = b[i ? y : O];
|
|
3125
|
+
j.push(S), j.length > (i ? r * c.scaler.groupKeyLen : r) && j.shift();
|
|
3048
3126
|
}
|
|
3049
3127
|
} catch (t) {
|
|
3050
3128
|
w.e(t);
|
|
@@ -3054,13 +3132,13 @@ var OHLCV_INDICATORS;
|
|
|
3054
3132
|
var P, _ = e + 1 >= r, N = er(n);
|
|
3055
3133
|
// scale values once enough data
|
|
3056
3134
|
try {
|
|
3057
|
-
var
|
|
3058
|
-
var r, n, u, c, s,
|
|
3135
|
+
var T = function() {
|
|
3136
|
+
var r, n, u, c, s, h, p = P.value, v = l[p][e], m = "".concat(f, "_").concat(p), d = null;
|
|
3059
3137
|
if (_) {
|
|
3060
|
-
var g = b[i ?
|
|
3138
|
+
var g = b[i ? y : p];
|
|
3061
3139
|
if ("minmax" === o) {
|
|
3062
3140
|
var w = Math.min.apply(Math, tr(g)), O = Math.max.apply(Math, tr(g));
|
|
3063
|
-
r = v, n = w, u = O, c = rr(a, 2), s = c[0],
|
|
3141
|
+
r = v, n = w, u = O, c = rr(a, 2), s = c[0], h = c[1], d = (Math.min(Math.max(r, n), u) - n) / (u - n) * (h - s) + s;
|
|
3064
3142
|
} else {
|
|
3065
3143
|
if ("zscore" !== o) throw new Error('Unknown scaler type "'.concat(o, '"'));
|
|
3066
3144
|
var S = g.reduce((function(t, e) {
|
|
@@ -3068,18 +3146,18 @@ var OHLCV_INDICATORS;
|
|
|
3068
3146
|
}), 0) / g.length, j = g.reduce((function(t, e) {
|
|
3069
3147
|
return t + Math.pow(e - S, 2);
|
|
3070
3148
|
}), 0) / g.length, N = Math.sqrt(j);
|
|
3071
|
-
|
|
3149
|
+
d = function(t, e, r) {
|
|
3072
3150
|
return 0 === r ? 0 : (t - e) / r;
|
|
3073
3151
|
}(v, S, N);
|
|
3074
3152
|
}
|
|
3075
3153
|
}
|
|
3076
3154
|
t.pushToMain({
|
|
3077
3155
|
index: e,
|
|
3078
|
-
key:
|
|
3079
|
-
value:
|
|
3156
|
+
key: m,
|
|
3157
|
+
value: d
|
|
3080
3158
|
});
|
|
3081
3159
|
};
|
|
3082
|
-
for (N.s(); !(P = N.n()).done; )
|
|
3160
|
+
for (N.s(); !(P = N.n()).done; ) T();
|
|
3083
3161
|
} catch (t) {
|
|
3084
3162
|
N.e(t);
|
|
3085
3163
|
} finally {
|
|
@@ -3087,120 +3165,110 @@ var OHLCV_INDICATORS;
|
|
|
3087
3165
|
}
|
|
3088
3166
|
}
|
|
3089
3167
|
}, fr = function(t, e) {
|
|
3090
|
-
var r =
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
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();
|
|
3168
|
+
var r = e.len, n = e.inputParams, i = e.priceBased, a = e.precisionMultiplier, u = e.arrayTypes, l = e.verticalOhlcv, c = e.verticalOhlcvKeyNames, s = e.inputTypes;
|
|
3169
|
+
!function(t, e) {
|
|
3170
|
+
if (!Array.isArray(t)) throw new Error('Property "inputParams" must be an "Array" or "Set".');
|
|
3171
|
+
var r, n = o(t);
|
|
3172
|
+
try {
|
|
3173
|
+
for (n.s(); !(r = n.n()).done; ) {
|
|
3174
|
+
var i, a = o(r.value.params);
|
|
3175
|
+
try {
|
|
3176
|
+
for (a.s(); !(i = a.n()).done; ) {
|
|
3177
|
+
var u = i.value;
|
|
3178
|
+
if ("number" == typeof u && u > e) throw console.log(u, e), new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.");
|
|
3107
3179
|
}
|
|
3180
|
+
} catch (t) {
|
|
3181
|
+
a.e(t);
|
|
3182
|
+
} finally {
|
|
3183
|
+
a.f();
|
|
3108
3184
|
}
|
|
3109
|
-
} catch (t) {
|
|
3110
|
-
i.e(t);
|
|
3111
|
-
} finally {
|
|
3112
|
-
i.f();
|
|
3113
3185
|
}
|
|
3114
|
-
}(
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3186
|
+
} catch (t) {
|
|
3187
|
+
n.e(t);
|
|
3188
|
+
} finally {
|
|
3189
|
+
n.f();
|
|
3118
3190
|
}
|
|
3191
|
+
}(n, r);
|
|
3192
|
+
for (var f = 0, y = Object.keys(s); f < y.length; f++) {
|
|
3193
|
+
var h = y[f];
|
|
3194
|
+
l[h] = Re(u[h], r);
|
|
3119
3195
|
}
|
|
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({
|
|
3196
|
+
// Process each row in the input
|
|
3197
|
+
for (var p = 0; p < r; p++) {
|
|
3198
|
+
for (var v = t[p], m = 0, d = Object.entries(s); m < d.length; m++) {
|
|
3199
|
+
var b = ur(d[m], 2), g = b[0], w = b[1], O = v[g];
|
|
3200
|
+
if (Te.hasOwnProperty(w)) {
|
|
3201
|
+
var S = Te[w](O);
|
|
3202
|
+
a > 1 && i.has(g) && (S *= a), e.pushToMain({
|
|
3137
3203
|
index: p,
|
|
3138
|
-
key:
|
|
3139
|
-
value:
|
|
3204
|
+
key: g,
|
|
3205
|
+
value: S
|
|
3140
3206
|
});
|
|
3141
|
-
} else
|
|
3207
|
+
} else xe.hasOwnProperty(w) ? e.pushToMain({
|
|
3142
3208
|
index: p,
|
|
3143
|
-
key:
|
|
3144
|
-
value:
|
|
3209
|
+
key: g,
|
|
3210
|
+
value: xe[w](O)
|
|
3145
3211
|
}) : e.pushToMain({
|
|
3146
3212
|
index: p,
|
|
3147
|
-
key:
|
|
3148
|
-
value:
|
|
3213
|
+
key: g,
|
|
3214
|
+
value: O
|
|
3149
3215
|
});
|
|
3150
3216
|
}
|
|
3151
3217
|
// Run all indicator functions except for the ones processed later
|
|
3152
|
-
var
|
|
3218
|
+
var j, P = ar(n);
|
|
3153
3219
|
try {
|
|
3154
|
-
for (
|
|
3155
|
-
var
|
|
3156
|
-
|
|
3220
|
+
for (P.s(); !(j = P.n()).done; ) {
|
|
3221
|
+
var _ = j.value, N = _.key, T = _.params;
|
|
3222
|
+
"lag" !== N && "crossPairs" !== N &&
|
|
3223
|
+
// resolve fn on-demand, no per-item object allocation here
|
|
3224
|
+
sr[N].apply(sr, [ e, p ].concat(ir(T)));
|
|
3157
3225
|
}
|
|
3158
3226
|
// Process these indicators separately (ensuring their execution order)
|
|
3159
3227
|
} catch (t) {
|
|
3160
|
-
|
|
3228
|
+
P.e(t);
|
|
3161
3229
|
} finally {
|
|
3162
|
-
|
|
3230
|
+
P.f();
|
|
3163
3231
|
}
|
|
3164
|
-
|
|
3232
|
+
He(e, p), Je(e, p);
|
|
3165
3233
|
}
|
|
3166
|
-
|
|
3167
|
-
|
|
3234
|
+
c.push.apply(c, ir(Object.keys(l)));
|
|
3235
|
+
}, yr = function(t, e) {
|
|
3236
|
+
for (var r = t.length, n = new ct(e), o = new Array(r), i = 0, a = 0, u = 0, l = 0; l < r; l++) if (n.update(t[l]),
|
|
3168
3237
|
n.isStable) {
|
|
3169
3238
|
var c = n.getResult();
|
|
3170
3239
|
o[l] = c, i += c, a += c * c, u++;
|
|
3171
3240
|
} else o[l] = null;
|
|
3172
|
-
var s = i / u, f = a / u - s * s,
|
|
3241
|
+
var s = i / u, f = a / u - s * s, y = Math.sqrt(f);
|
|
3173
3242
|
return o.map((function(t) {
|
|
3174
|
-
return null !== t ? (t - s) /
|
|
3243
|
+
return null !== t ? (t - s) / y : null;
|
|
3175
3244
|
}));
|
|
3176
|
-
},
|
|
3245
|
+
}, hr = function(t, e) {
|
|
3177
3246
|
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5;
|
|
3178
3247
|
if (t.length !== e.length) throw new Error("Both arrays must have the same length");
|
|
3179
|
-
for (var n =
|
|
3180
|
-
if (null !== n[
|
|
3181
|
-
|
|
3248
|
+
for (var n = yr(t, r), o = yr(e, r), i = t.length, a = [], u = 0, l = 0, c = 0, s = 0, f = 0, y = 0, h = -1, p = 0; p < i; p++) {
|
|
3249
|
+
if (null !== n[p] && null !== o[p]) {
|
|
3250
|
+
h = p;
|
|
3182
3251
|
break;
|
|
3183
3252
|
}
|
|
3184
3253
|
a.push(0);
|
|
3185
3254
|
}
|
|
3186
|
-
if (-1 ===
|
|
3255
|
+
if (-1 === h)
|
|
3187
3256
|
// No valid data points
|
|
3188
3257
|
return new Array(i).fill(0);
|
|
3189
|
-
for (var v =
|
|
3190
|
-
var
|
|
3191
|
-
if (null !==
|
|
3192
|
-
++
|
|
3193
|
-
var b =
|
|
3258
|
+
for (var v = h; v < i; v++) {
|
|
3259
|
+
var m = n[v], d = o[v];
|
|
3260
|
+
if (null !== m && null !== d) if (u += m, l += d, c += m * d, s += m * m, f += d * d,
|
|
3261
|
+
++y < 2) a.push(0); else {
|
|
3262
|
+
var b = y * c - u * l, g = Math.sqrt((y * s - u * u) * (y * f - l * l)), w = 0 === g ? 0 : b / g;
|
|
3194
3263
|
a.push(w);
|
|
3195
3264
|
} else
|
|
3196
3265
|
// Reset sums and counts when encountering null values
|
|
3197
|
-
u = l = c = s = f =
|
|
3266
|
+
u = l = c = s = f = y = 0, a.push(0);
|
|
3198
3267
|
}
|
|
3199
3268
|
return a;
|
|
3200
3269
|
};
|
|
3201
|
-
//
|
|
3202
|
-
|
|
3203
|
-
function yr(t, e) {
|
|
3270
|
+
// ./src/utilities/verticalToHorizontal.js
|
|
3271
|
+
function pr(t, e) {
|
|
3204
3272
|
return function(t) {
|
|
3205
3273
|
if (Array.isArray(t)) return t;
|
|
3206
3274
|
}(t) || function(t, e) {
|
|
@@ -3238,6 +3306,19 @@ var OHLCV_INDICATORS;
|
|
|
3238
3306
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3239
3307
|
return n;
|
|
3240
3308
|
}
|
|
3309
|
+
var mr = function() {
|
|
3310
|
+
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, l = e.len, c = e.verticalOhlcvKeyNames, s = e.verticalOhlcvTempCols;
|
|
3311
|
+
if (0 === c.length) return [];
|
|
3312
|
+
for (var f = t && u >= 0 ? u + 1 : 0, y = Math.max(f, r), h = l - y, p = Array.from({
|
|
3313
|
+
length: h
|
|
3314
|
+
}, (function() {
|
|
3315
|
+
return {};
|
|
3316
|
+
})), v = 0, m = Object.entries(a); v < m.length; v++) {
|
|
3317
|
+
var d = pr(m[v], 2), b = d[0], g = d[1];
|
|
3318
|
+
if (!s.has(b)) for (var w = o.has(b) && i, O = y; O < l; O++) p[O - y][b] = w ? g[O] / n : g[O];
|
|
3319
|
+
}
|
|
3320
|
+
return p;
|
|
3321
|
+
};
|
|
3241
3322
|
function dr(t, e) {
|
|
3242
3323
|
return function(t) {
|
|
3243
3324
|
if (Array.isArray(t)) return t;
|
|
@@ -3261,30 +3342,30 @@ var OHLCV_INDICATORS;
|
|
|
3261
3342
|
}
|
|
3262
3343
|
return u;
|
|
3263
3344
|
}
|
|
3264
|
-
}(t, e) ||
|
|
3345
|
+
}(t, e) || br(t, e) || function() {
|
|
3265
3346
|
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
3347
|
}();
|
|
3267
3348
|
}
|
|
3268
|
-
function
|
|
3349
|
+
function br(t, e) {
|
|
3269
3350
|
if (t) {
|
|
3270
|
-
if ("string" == typeof t) return
|
|
3351
|
+
if ("string" == typeof t) return gr(t, e);
|
|
3271
3352
|
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) ?
|
|
3353
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? gr(t, e) : void 0;
|
|
3273
3354
|
}
|
|
3274
3355
|
}
|
|
3275
|
-
function
|
|
3356
|
+
function gr(t, e) {
|
|
3276
3357
|
(null == e || e > t.length) && (e = t.length);
|
|
3277
3358
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3278
3359
|
return n;
|
|
3279
3360
|
}
|
|
3280
|
-
var
|
|
3361
|
+
var wr = function(t, e) {
|
|
3281
3362
|
var r = t.precision, n = t.priceBased;
|
|
3282
3363
|
if (!1 === r) return 1;
|
|
3283
3364
|
var o, i = 1, a = // ./src/utilities/precisionMultiplier.js
|
|
3284
3365
|
function(t, e) {
|
|
3285
3366
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3286
3367
|
if (!r) {
|
|
3287
|
-
if (Array.isArray(t) || (r =
|
|
3368
|
+
if (Array.isArray(t) || (r = br(t)) || e && t && "number" == typeof t.length) {
|
|
3288
3369
|
r && (t = r);
|
|
3289
3370
|
var n = 0, o = function() {};
|
|
3290
3371
|
return {
|
|
@@ -3328,7 +3409,7 @@ var OHLCV_INDICATORS;
|
|
|
3328
3409
|
}(Object.entries(e).filter((function(t) {
|
|
3329
3410
|
var e = dr(t, 2), r = e[0];
|
|
3330
3411
|
e[1];
|
|
3331
|
-
return n.
|
|
3412
|
+
return n.has(r);
|
|
3332
3413
|
})).map((function(t) {
|
|
3333
3414
|
var e = dr(t, 2);
|
|
3334
3415
|
e[0];
|
|
@@ -3347,15 +3428,6 @@ var OHLCV_INDICATORS;
|
|
|
3347
3428
|
return i;
|
|
3348
3429
|
};
|
|
3349
3430
|
// ./index.js
|
|
3350
|
-
function wr(t) {
|
|
3351
|
-
return function(t) {
|
|
3352
|
-
if (Array.isArray(t)) return Pr(t);
|
|
3353
|
-
}(t) || function(t) {
|
|
3354
|
-
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
3355
|
-
}(t) || jr(t) || function() {
|
|
3356
|
-
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
|
-
}();
|
|
3358
|
-
}
|
|
3359
3431
|
function Or(t) {
|
|
3360
3432
|
return Or = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
3361
3433
|
return typeof t;
|
|
@@ -3363,7 +3435,16 @@ var OHLCV_INDICATORS;
|
|
|
3363
3435
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
3364
3436
|
}, Or(t);
|
|
3365
3437
|
}
|
|
3366
|
-
function Sr(t
|
|
3438
|
+
function Sr(t) {
|
|
3439
|
+
return function(t) {
|
|
3440
|
+
if (Array.isArray(t)) return _r(t);
|
|
3441
|
+
}(t) || function(t) {
|
|
3442
|
+
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
3443
|
+
}(t) || Pr(t) || function() {
|
|
3444
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3445
|
+
}();
|
|
3446
|
+
}
|
|
3447
|
+
function jr(t, e) {
|
|
3367
3448
|
return function(t) {
|
|
3368
3449
|
if (Array.isArray(t)) return t;
|
|
3369
3450
|
}(t) || function(t, e) {
|
|
@@ -3386,30 +3467,30 @@ var OHLCV_INDICATORS;
|
|
|
3386
3467
|
}
|
|
3387
3468
|
return u;
|
|
3388
3469
|
}
|
|
3389
|
-
}(t, e) ||
|
|
3470
|
+
}(t, e) || Pr(t, e) || function() {
|
|
3390
3471
|
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
3472
|
}();
|
|
3392
3473
|
}
|
|
3393
|
-
function
|
|
3474
|
+
function Pr(t, e) {
|
|
3394
3475
|
if (t) {
|
|
3395
|
-
if ("string" == typeof t) return
|
|
3476
|
+
if ("string" == typeof t) return _r(t, e);
|
|
3396
3477
|
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) ?
|
|
3478
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _r(t, e) : void 0;
|
|
3398
3479
|
}
|
|
3399
3480
|
}
|
|
3400
|
-
function
|
|
3481
|
+
function _r(t, e) {
|
|
3401
3482
|
(null == e || e > t.length) && (e = t.length);
|
|
3402
3483
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3403
3484
|
return n;
|
|
3404
3485
|
}
|
|
3405
|
-
function
|
|
3486
|
+
function Nr(t, e) {
|
|
3406
3487
|
for (var r = 0; r < e.length; r++) {
|
|
3407
3488
|
var n = e[r];
|
|
3408
3489
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
3409
|
-
Object.defineProperty(t,
|
|
3490
|
+
Object.defineProperty(t, Tr(n.key), n);
|
|
3410
3491
|
}
|
|
3411
3492
|
}
|
|
3412
|
-
function
|
|
3493
|
+
function Tr(t) {
|
|
3413
3494
|
var e = function(t, e) {
|
|
3414
3495
|
if ("object" != Or(t) || !t) return t;
|
|
3415
3496
|
var r = t[Symbol.toPrimitive];
|
|
@@ -3432,52 +3513,40 @@ var OHLCV_INDICATORS;
|
|
|
3432
3513
|
}
|
|
3433
3514
|
var Ar = function() {
|
|
3434
3515
|
return t = function t(e) {
|
|
3435
|
-
var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, a = e.precision,
|
|
3516
|
+
var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, a = e.precision, u = void 0 === a || a, c = e.inputParams, f = void 0 === c ? null : c;
|
|
3436
3517
|
if (function(t, e) {
|
|
3437
3518
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
3438
|
-
}(this, t),
|
|
3519
|
+
}(this, t), l(n, "input", null !== i ? "contructor ".concat(i) : "constuctor"),
|
|
3439
3520
|
0 === n.length) throw Error("input OHLCV must not be empty: " + i);
|
|
3440
|
-
|
|
3441
|
-
var
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
}(y, v);
|
|
3464
|
-
var d = De(v, this.targetCols), m = d.inputTypes, b = d.arrayTypes;
|
|
3465
|
-
this.inputTypes = m, this.arrayTypes = b, console.log(b);
|
|
3466
|
-
var g, w, O = this.targetCols, S = O.open, j = O.high, P = O.low, _ = O.close, N = O.volume;
|
|
3467
|
-
if (O.date, !v.hasOwnProperty(_)) throw Error('input OHLCV array objects require at least "'.concat(_, '" property: ').concat(i));
|
|
3468
|
-
return this.hasVolume = N && (g = v[N], w = this.inputTypes[N], Ne[w](g) > 0), this.isComputed = !1,
|
|
3469
|
-
this.lastComputedIndex = 0, this.input = n, this.priceBased = [ S, j, P, _ ], this.len = n.length,
|
|
3470
|
-
this.lastIndexReplace = !1, this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {},
|
|
3471
|
-
this.studies = {}, this.utilities = {
|
|
3472
|
-
correlation: pr
|
|
3473
|
-
}, this.invalidValueIndex = -1, this.precision = s, this.precisionMultiplier = gr(this, v),
|
|
3474
|
-
this.ScaledGroups = {}, null !== h && (u(h, "inputParams", "constructor"), this.inputParams = h,
|
|
3521
|
+
s(u, "precision", "constructor"), this.firstRow = n[0];
|
|
3522
|
+
var y = function(t) {
|
|
3523
|
+
for (var e = {}, r = {}, n = 0, o = Object.entries(t); n < o.length; n++) {
|
|
3524
|
+
var i = Ie(o[n], 2), a = i[0], u = i[1];
|
|
3525
|
+
if ("date" === a) e[a] = ke(u), r[a] = "Array"; else if ("volume" === a) e[a] = Ae(u, !0),
|
|
3526
|
+
r[a] = "Int32Array"; else if (De.has(a)) e[a] = Ae(u, !0), r[a] = "Float64Array"; else {
|
|
3527
|
+
var l = Ae(u, !1);
|
|
3528
|
+
e[a] = l, r[a] = "number" === l ? "Float64Array" : "Array";
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
return {
|
|
3532
|
+
inputTypes: e,
|
|
3533
|
+
arrayTypes: r
|
|
3534
|
+
};
|
|
3535
|
+
}(this.firstRow), h = y.inputTypes, p = y.arrayTypes;
|
|
3536
|
+
if (this.inputTypes = h, this.arrayTypes = p, !this.firstRow.hasOwnProperty("close")) throw Error('input OHLCV array objects require at least "close" property: '.concat(i));
|
|
3537
|
+
return this.dateType = this.inputTypes.date ? this.inputTypes.date : null, this.isComputed = !1,
|
|
3538
|
+
this.input = n, this.priceBased = new Set([ "open", "high", "low", "close" ]), this.len = n.length,
|
|
3539
|
+
this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {}, this.verticalOhlcvKeyNames = [],
|
|
3540
|
+
this.verticalOhlcvTempCols = new Set, this.utilities = {
|
|
3541
|
+
correlation: hr
|
|
3542
|
+
}, this.invalidValueIndex = -1, this.precision = u, this.precisionMultiplier = wr(this, this.firstRow),
|
|
3543
|
+
this.ScaledGroups = {}, null !== f && (validateInputParams(f, this.len), this.inputParams = f,
|
|
3475
3544
|
this.compute()), this.inputParams = [], this.pushToMain = function(t) {
|
|
3476
3545
|
var e = t.index, n = t.key, o = t.value;
|
|
3477
3546
|
return function(t) {
|
|
3478
3547
|
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
|
-
!
|
|
3548
|
+
return null == o || Number.isNaN(o) ? (e.invalidValueIndex = r, i[n][r] = o, !1) : (i[n][r] = o,
|
|
3549
|
+
!0);
|
|
3481
3550
|
}({
|
|
3482
3551
|
main: r,
|
|
3483
3552
|
index: e,
|
|
@@ -3490,91 +3559,47 @@ var OHLCV_INDICATORS;
|
|
|
3490
3559
|
value: function() {
|
|
3491
3560
|
var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
|
3492
3561
|
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
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
}
|
|
3562
|
+
for (var e = this.precisionMultiplier, r = this.precision, n = this.invalidValueIndex, o = this.len, i = this.verticalOhlcv, a = this.priceBased, u = this.arrayTypes, l = this.verticalOhlcvTempCols, c = {}, s = t ? n + 1 : 0, f = o - s, y = 0, h = Object.entries(i); y < h.length; y++) {
|
|
3563
|
+
var p = jr(h[y], 2), v = p[0], m = p[1];
|
|
3564
|
+
if (!l.has(v)) {
|
|
3565
|
+
var d = a.has(v) && r;
|
|
3566
|
+
c[v] = Re(u[v], f);
|
|
3567
|
+
for (var b = s; b < o; b++) c[v][b] = d ? m[b] / e : m[b];
|
|
3568
|
+
}
|
|
3500
3569
|
}
|
|
3501
|
-
return
|
|
3570
|
+
return c;
|
|
3502
3571
|
}
|
|
3503
3572
|
}, {
|
|
3504
3573
|
key: "getData",
|
|
3505
3574
|
value: function() {
|
|
3506
3575
|
var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
|
3507
3576
|
//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);
|
|
3577
|
+
return this.compute(), mr(t, this, 0);
|
|
3522
3578
|
}
|
|
3523
3579
|
}, {
|
|
3524
3580
|
key: "getLastValues",
|
|
3525
3581
|
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;
|
|
3582
|
+
return this.compute(), mr(!1, this, this.len - 1)[0];
|
|
3542
3583
|
}
|
|
3543
3584
|
}, {
|
|
3544
3585
|
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;
|
|
3586
|
+
value: function() {
|
|
3587
|
+
// If we've already computed, bail out immediately
|
|
3588
|
+
return this.isComputed || (
|
|
3589
|
+
// Mark as “in progress”
|
|
3590
|
+
this.isComputed = !1,
|
|
3591
|
+
// Figure out whether there’s a date field in the inputs
|
|
3592
|
+
// Only run the full loop once (or when new data appears later,
|
|
3593
|
+
// if you extend this to reset isComputed elsewhere)
|
|
3594
|
+
this.len > 0 && (fr(this.input, this), this.isComputed = !0,
|
|
3595
|
+
//flushing after mainLoop
|
|
3596
|
+
this.input = [], this.instances = {}, this.firstRow = [])), this;
|
|
3572
3597
|
}
|
|
3573
3598
|
}, {
|
|
3574
3599
|
key: "crossPairs",
|
|
3575
3600
|
value: function() {
|
|
3576
3601
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = "crossPairs";
|
|
3577
|
-
return
|
|
3602
|
+
return u(this), l(t, "arr", e), this.crossPairsList = [].concat(Sr(this.crossPairsList), Sr(t)),
|
|
3578
3603
|
this.inputParams.push({
|
|
3579
3604
|
key: e,
|
|
3580
3605
|
params: [ this.crossPairsList ]
|
|
@@ -3583,39 +3608,88 @@ var OHLCV_INDICATORS;
|
|
|
3583
3608
|
}, {
|
|
3584
3609
|
key: "lag",
|
|
3585
3610
|
value: function() {
|
|
3586
|
-
var t =
|
|
3587
|
-
|
|
3611
|
+
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ "close" ], e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, r = "lag";
|
|
3612
|
+
u(this), l(t, "colKeys", r), f(e, {
|
|
3588
3613
|
min: 1,
|
|
3589
3614
|
max: this.len,
|
|
3590
3615
|
allowDecimals: !1
|
|
3591
|
-
}, "lookback",
|
|
3592
|
-
key:
|
|
3593
|
-
params: [
|
|
3616
|
+
}, "lookback", r), this.inputParams.push({
|
|
3617
|
+
key: r,
|
|
3618
|
+
params: [ t, e ]
|
|
3594
3619
|
});
|
|
3595
|
-
|
|
3596
|
-
var r =
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3620
|
+
var n, o = function(t, e) {
|
|
3621
|
+
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
3622
|
+
if (!r) {
|
|
3623
|
+
if (Array.isArray(t) || (r = Pr(t)) || e && t && "number" == typeof t.length) {
|
|
3624
|
+
r && (t = r);
|
|
3625
|
+
var n = 0, o = function() {};
|
|
3626
|
+
return {
|
|
3627
|
+
s: o,
|
|
3628
|
+
n: function() {
|
|
3629
|
+
return n >= t.length ? {
|
|
3630
|
+
done: !0
|
|
3631
|
+
} : {
|
|
3632
|
+
done: !1,
|
|
3633
|
+
value: t[n++]
|
|
3634
|
+
};
|
|
3635
|
+
},
|
|
3636
|
+
e: function(t) {
|
|
3637
|
+
throw t;
|
|
3638
|
+
},
|
|
3639
|
+
f: o
|
|
3640
|
+
};
|
|
3641
|
+
}
|
|
3642
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3643
|
+
}
|
|
3644
|
+
var i, a = !0, u = !1;
|
|
3645
|
+
return {
|
|
3646
|
+
s: function() {
|
|
3647
|
+
r = r.call(t);
|
|
3648
|
+
},
|
|
3649
|
+
n: function() {
|
|
3650
|
+
var t = r.next();
|
|
3651
|
+
return a = t.done, t;
|
|
3652
|
+
},
|
|
3653
|
+
e: function(t) {
|
|
3654
|
+
u = !0, i = t;
|
|
3655
|
+
},
|
|
3656
|
+
f: function() {
|
|
3657
|
+
try {
|
|
3658
|
+
a || null == r.return || r.return();
|
|
3659
|
+
} finally {
|
|
3660
|
+
if (u) throw i;
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
};
|
|
3664
|
+
}(t);
|
|
3665
|
+
try {
|
|
3666
|
+
for (o.s(); !(n = o.n()).done; ) {
|
|
3667
|
+
var i = n.value;
|
|
3668
|
+
this.priceBased.has(i) && this.priceBased.add(i);
|
|
3669
|
+
}
|
|
3670
|
+
} catch (t) {
|
|
3671
|
+
o.e(t);
|
|
3672
|
+
} finally {
|
|
3673
|
+
o.f();
|
|
3674
|
+
}
|
|
3601
3675
|
return this;
|
|
3602
3676
|
}
|
|
3603
3677
|
}, {
|
|
3604
3678
|
key: "relativeVolume",
|
|
3605
3679
|
value: function() {
|
|
3606
3680
|
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
|
-
|
|
3681
|
+
if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
|
|
3682
|
+
u(this), f(t, {
|
|
3609
3683
|
min: 1,
|
|
3610
3684
|
max: this.len,
|
|
3611
3685
|
allowDecimals: !1
|
|
3612
|
-
}, "size", r),
|
|
3686
|
+
}, "size", r), c(e, "options", r);
|
|
3613
3687
|
var n = e.lag, o = void 0 === n ? 0 : n;
|
|
3614
|
-
return
|
|
3688
|
+
return f(o, {
|
|
3615
3689
|
min: 0,
|
|
3616
3690
|
max: this.len,
|
|
3617
3691
|
allowDecimals: !1
|
|
3618
|
-
}, "lag", r), this.inputParams.push({
|
|
3692
|
+
}, "options.lag", r), this.inputParams.push({
|
|
3619
3693
|
key: r,
|
|
3620
3694
|
params: [ t, {
|
|
3621
3695
|
lag: o
|
|
@@ -3626,21 +3700,21 @@ var OHLCV_INDICATORS;
|
|
|
3626
3700
|
key: "ema",
|
|
3627
3701
|
value: function() {
|
|
3628
3702
|
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
|
-
|
|
3703
|
+
u(this), f(t, {
|
|
3630
3704
|
min: 1,
|
|
3631
3705
|
max: this.len,
|
|
3632
3706
|
allowDecimals: !1
|
|
3633
|
-
}, "size", r),
|
|
3634
|
-
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag,
|
|
3635
|
-
return
|
|
3707
|
+
}, "size", r), c(e, "options", r);
|
|
3708
|
+
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
|
|
3709
|
+
return f(a, {
|
|
3636
3710
|
min: 0,
|
|
3637
3711
|
max: this.len,
|
|
3638
3712
|
allowDecimals: !1
|
|
3639
|
-
}, "lag", r), this.inputParams.push({
|
|
3713
|
+
}, "options.lag", r), this.inputParams.push({
|
|
3640
3714
|
key: r,
|
|
3641
3715
|
params: [ r, t, {
|
|
3642
3716
|
target: o,
|
|
3643
|
-
lag:
|
|
3717
|
+
lag: a
|
|
3644
3718
|
} ]
|
|
3645
3719
|
}), this;
|
|
3646
3720
|
}
|
|
@@ -3648,21 +3722,21 @@ var OHLCV_INDICATORS;
|
|
|
3648
3722
|
key: "sma",
|
|
3649
3723
|
value: function() {
|
|
3650
3724
|
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
|
-
|
|
3725
|
+
u(this), f(t, {
|
|
3652
3726
|
min: 1,
|
|
3653
3727
|
max: this.len,
|
|
3654
3728
|
allowDecimals: !1
|
|
3655
|
-
}, "size", r),
|
|
3656
|
-
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag,
|
|
3657
|
-
return
|
|
3729
|
+
}, "size", r), c(e, "options", r);
|
|
3730
|
+
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
|
|
3731
|
+
return f(a, {
|
|
3658
3732
|
min: 0,
|
|
3659
3733
|
max: this.len,
|
|
3660
3734
|
allowDecimals: !1
|
|
3661
|
-
}, "lag", r), this.inputParams.push({
|
|
3735
|
+
}, "options.lag", r), this.inputParams.push({
|
|
3662
3736
|
key: r,
|
|
3663
3737
|
params: [ r, t, {
|
|
3664
3738
|
target: o,
|
|
3665
|
-
lag:
|
|
3739
|
+
lag: a
|
|
3666
3740
|
} ]
|
|
3667
3741
|
}), this;
|
|
3668
3742
|
}
|
|
@@ -3670,29 +3744,29 @@ var OHLCV_INDICATORS;
|
|
|
3670
3744
|
key: "macd",
|
|
3671
3745
|
value: function() {
|
|
3672
3746
|
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
|
-
|
|
3747
|
+
u(this), f(t, {
|
|
3674
3748
|
min: 1,
|
|
3675
3749
|
max: this.len,
|
|
3676
3750
|
allowDecimals: !1
|
|
3677
|
-
}, "fast", o),
|
|
3751
|
+
}, "fast", o), f(e, {
|
|
3678
3752
|
min: 1,
|
|
3679
3753
|
max: this.len,
|
|
3680
3754
|
allowDecimals: !1
|
|
3681
|
-
}, "slow", o),
|
|
3755
|
+
}, "slow", o), f(r, {
|
|
3682
3756
|
min: 1,
|
|
3683
3757
|
max: this.len,
|
|
3684
3758
|
allowDecimals: !1
|
|
3685
|
-
}, "signal", o),
|
|
3686
|
-
var i = n.target,
|
|
3687
|
-
return s
|
|
3759
|
+
}, "signal", o), c(n, "options", o);
|
|
3760
|
+
var i = n.target, a = void 0 === i ? "close" : i, l = n.lag, s = void 0 === l ? 0 : l;
|
|
3761
|
+
return f(s, {
|
|
3688
3762
|
min: 0,
|
|
3689
3763
|
max: this.len,
|
|
3690
3764
|
allowDecimals: !1
|
|
3691
|
-
}, "lag", o), this.inputParams.push({
|
|
3765
|
+
}, "options.lag", o), this.inputParams.push({
|
|
3692
3766
|
key: o,
|
|
3693
3767
|
params: [ t, e, r, {
|
|
3694
|
-
target:
|
|
3695
|
-
lag:
|
|
3768
|
+
target: a,
|
|
3769
|
+
lag: s
|
|
3696
3770
|
} ]
|
|
3697
3771
|
}), this;
|
|
3698
3772
|
}
|
|
@@ -3700,27 +3774,27 @@ var OHLCV_INDICATORS;
|
|
|
3700
3774
|
key: "bollingerBands",
|
|
3701
3775
|
value: function() {
|
|
3702
3776
|
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
|
-
|
|
3777
|
+
u(this), f(t, {
|
|
3704
3778
|
min: 1,
|
|
3705
3779
|
max: this.len,
|
|
3706
3780
|
allowDecimals: !1
|
|
3707
|
-
}, "size", n),
|
|
3781
|
+
}, "size", n), f(e, {
|
|
3708
3782
|
min: .01,
|
|
3709
3783
|
max: 50,
|
|
3710
3784
|
allowDecimals: !0
|
|
3711
|
-
}, "stdDev", n),
|
|
3712
|
-
var o = r.target, i = void 0 === o ? "close" : o,
|
|
3713
|
-
return
|
|
3785
|
+
}, "stdDev", n), c(r, "options", n);
|
|
3786
|
+
var o = r.target, i = void 0 === o ? "close" : o, a = r.height, y = void 0 !== a && a, h = r.range, p = void 0 === h ? [] : h, v = r.lag, m = void 0 === v ? 0 : v;
|
|
3787
|
+
return l(p, "options.range", n), f(m, {
|
|
3714
3788
|
min: 0,
|
|
3715
3789
|
max: this.len,
|
|
3716
3790
|
allowDecimals: !1
|
|
3717
|
-
}, "lag", n),
|
|
3791
|
+
}, "options.lag", n), s(y, "options.height", n), this.inputParams.push({
|
|
3718
3792
|
key: n,
|
|
3719
3793
|
params: [ t, e, {
|
|
3720
3794
|
target: i,
|
|
3721
|
-
height:
|
|
3722
|
-
range:
|
|
3723
|
-
lag:
|
|
3795
|
+
height: y,
|
|
3796
|
+
range: p,
|
|
3797
|
+
lag: m
|
|
3724
3798
|
} ]
|
|
3725
3799
|
}), this;
|
|
3726
3800
|
}
|
|
@@ -3728,21 +3802,21 @@ var OHLCV_INDICATORS;
|
|
|
3728
3802
|
key: "rsi",
|
|
3729
3803
|
value: function() {
|
|
3730
3804
|
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
|
-
|
|
3805
|
+
u(this), f(t, {
|
|
3732
3806
|
min: 1,
|
|
3733
3807
|
max: this.len,
|
|
3734
3808
|
allowDecimals: !1
|
|
3735
|
-
}, "size", r),
|
|
3736
|
-
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag,
|
|
3737
|
-
return
|
|
3809
|
+
}, "size", r), c(e, "options", r);
|
|
3810
|
+
var n = e.target, o = void 0 === n ? "close" : n, i = e.lag, a = void 0 === i ? 0 : i;
|
|
3811
|
+
return f(a, {
|
|
3738
3812
|
min: 0,
|
|
3739
3813
|
max: this.len,
|
|
3740
3814
|
allowDecimals: !1
|
|
3741
|
-
}, "lag", r), this.inputParams.push({
|
|
3815
|
+
}, "options.lag", r), this.inputParams.push({
|
|
3742
3816
|
key: r,
|
|
3743
3817
|
params: [ t, {
|
|
3744
3818
|
target: o,
|
|
3745
|
-
lag:
|
|
3819
|
+
lag: a
|
|
3746
3820
|
} ]
|
|
3747
3821
|
}), this;
|
|
3748
3822
|
}
|
|
@@ -3750,26 +3824,26 @@ var OHLCV_INDICATORS;
|
|
|
3750
3824
|
key: "donchianChannels",
|
|
3751
3825
|
value: function() {
|
|
3752
3826
|
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
|
-
|
|
3827
|
+
u(this), f(t, {
|
|
3754
3828
|
min: 1,
|
|
3755
3829
|
max: this.len,
|
|
3756
3830
|
allowDecimals: !1
|
|
3757
|
-
}, "size", n),
|
|
3831
|
+
}, "size", n), f(e, {
|
|
3758
3832
|
min: 0,
|
|
3759
3833
|
max: this.len,
|
|
3760
3834
|
allowDecimals: !1
|
|
3761
|
-
}, "offset", n),
|
|
3762
|
-
var o = r.height, i = void 0 !== o && o,
|
|
3763
|
-
return
|
|
3835
|
+
}, "offset", n), c(r, "options", n);
|
|
3836
|
+
var o = r.height, i = void 0 !== o && o, a = r.range, y = void 0 === a ? [] : a, h = r.lag, p = void 0 === h ? 0 : h;
|
|
3837
|
+
return l(y, "options.range", n), f(p, {
|
|
3764
3838
|
min: 0,
|
|
3765
3839
|
max: this.len,
|
|
3766
3840
|
allowDecimals: !1
|
|
3767
|
-
}, "lag", n),
|
|
3841
|
+
}, "options.lag", n), s(i, "options.height", n), this.inputParams.push({
|
|
3768
3842
|
key: n,
|
|
3769
3843
|
params: [ t, e, {
|
|
3770
3844
|
height: i,
|
|
3771
|
-
range:
|
|
3772
|
-
lag:
|
|
3845
|
+
range: y,
|
|
3846
|
+
lag: p
|
|
3773
3847
|
} ]
|
|
3774
3848
|
}), this;
|
|
3775
3849
|
}
|
|
@@ -3777,22 +3851,22 @@ var OHLCV_INDICATORS;
|
|
|
3777
3851
|
key: "volumeOscillator",
|
|
3778
3852
|
value: function() {
|
|
3779
3853
|
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
|
-
|
|
3854
|
+
if (!this.inputTypes.hasOwnProperty("volume")) throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');
|
|
3855
|
+
u(this), f(t, {
|
|
3782
3856
|
min: 1,
|
|
3783
3857
|
max: this.len,
|
|
3784
3858
|
allowDecimals: !1
|
|
3785
|
-
}, "fastSize", n),
|
|
3859
|
+
}, "fastSize", n), f(e, {
|
|
3786
3860
|
min: t,
|
|
3787
3861
|
max: this.len,
|
|
3788
3862
|
allowDecimals: !1
|
|
3789
|
-
}, "slowSize", n),
|
|
3863
|
+
}, "slowSize", n), c(r, "options", n);
|
|
3790
3864
|
var o = r.lag, i = void 0 === o ? 0 : o;
|
|
3791
|
-
return
|
|
3865
|
+
return f(i, {
|
|
3792
3866
|
min: 0,
|
|
3793
3867
|
max: this.len,
|
|
3794
3868
|
allowDecimals: !1
|
|
3795
|
-
}, "lag", n), this.inputParams.push({
|
|
3869
|
+
}, "options.lag", n), this.inputParams.push({
|
|
3796
3870
|
key: n,
|
|
3797
3871
|
params: [ t, e, {
|
|
3798
3872
|
lag: i
|
|
@@ -3803,13 +3877,13 @@ var OHLCV_INDICATORS;
|
|
|
3803
3877
|
key: "dateTime",
|
|
3804
3878
|
value: function() {
|
|
3805
3879
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = "dateTime";
|
|
3806
|
-
|
|
3880
|
+
u(this), c(t, "options", e);
|
|
3807
3881
|
var r = t.lag, n = void 0 === r ? 0 : r;
|
|
3808
|
-
return
|
|
3882
|
+
return f(n, {
|
|
3809
3883
|
min: 0,
|
|
3810
3884
|
max: this.len,
|
|
3811
3885
|
allowDecimals: !1
|
|
3812
|
-
}, "lag", e), this.inputParams.push({
|
|
3886
|
+
}, "options.lag", e), this.inputParams.push({
|
|
3813
3887
|
key: e,
|
|
3814
3888
|
params: [ {
|
|
3815
3889
|
lag: n
|
|
@@ -3818,26 +3892,38 @@ var OHLCV_INDICATORS;
|
|
|
3818
3892
|
}
|
|
3819
3893
|
}, {
|
|
3820
3894
|
key: "Scaler",
|
|
3821
|
-
value: function(t, e,
|
|
3822
|
-
var
|
|
3823
|
-
|
|
3895
|
+
value: function(t, e, n) {
|
|
3896
|
+
var o = "Scaler";
|
|
3897
|
+
u(this), f(t, {
|
|
3824
3898
|
min: 1,
|
|
3825
3899
|
max: this.len,
|
|
3826
3900
|
allowDecimals: !1
|
|
3827
|
-
}, "size",
|
|
3828
|
-
var
|
|
3829
|
-
return
|
|
3830
|
-
if (
|
|
3901
|
+
}, "size", o), l(e, "colKeys", o);
|
|
3902
|
+
var i = n.group, a = void 0 !== i && i, c = n.range, y = void 0 === c ? [ 0, 1 ] : c, h = n.lag, p = void 0 === h ? 0 : h, v = n.type, m = void 0 === v ? "minmax" : v;
|
|
3903
|
+
return s(a, "options.group", o), function(t, e, n) {
|
|
3904
|
+
if (l(t, e, n), 2 !== t.length) throw new Error('Invalid "'.concat(e, '" array length: expected 2 items, but got ').concat(t.length, ' in "').concat(n, ".").concat(e, '".'));
|
|
3905
|
+
var o = r(t, 2), i = o[0], a = o[1];
|
|
3906
|
+
if (f(i, {
|
|
3907
|
+
min: -100,
|
|
3908
|
+
max: a,
|
|
3909
|
+
allowDecimals: !1
|
|
3910
|
+
}, "min", n), f(a, {
|
|
3911
|
+
min: i,
|
|
3912
|
+
max: 100,
|
|
3913
|
+
allowDecimals: !1
|
|
3914
|
+
}, "max", n), i === a) throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(n, ".").concat(e, '".'));
|
|
3915
|
+
}(y, "options.range", o), function(t, e, r, n) {
|
|
3916
|
+
if (l(t, "arrayOptions", "".concat(n, ".").concat(r, ".validateArrayOptions")),
|
|
3831
3917
|
!t.includes(e.toString())) throw new Error('Param "'.concat(r, '" must be any of the following values [').concat(t.join(", "), '] in "').concat(n, '".'));
|
|
3832
|
-
}([ "minmax", "zscore" ],
|
|
3833
|
-
key:
|
|
3834
|
-
params: [ t, e,
|
|
3918
|
+
}([ "minmax", "zscore" ], m, "options.type", o), this.inputParams.push({
|
|
3919
|
+
key: o,
|
|
3920
|
+
params: [ t, e, m, a, y, p ]
|
|
3835
3921
|
}), this;
|
|
3836
3922
|
}
|
|
3837
|
-
} ], e &&
|
|
3923
|
+
} ], e && Nr(t.prototype, e), n && Nr(t, n), Object.defineProperty(t, "prototype", {
|
|
3838
3924
|
writable: !1
|
|
3839
3925
|
}), t;
|
|
3840
|
-
var t, e,
|
|
3926
|
+
var t, e, n;
|
|
3841
3927
|
}();
|
|
3842
3928
|
})(), OHLCV_INDICATORS = e;
|
|
3843
3929
|
})
|