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