ohlcv-indicators 3.2.7 → 3.2.8
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 +329 -324
- package/index.js +3 -3
- package/package.json +1 -1
- package/src/studies/candleVectors.js +46 -36
- package/src/utilities/pushToMain.js +1 -1
|
@@ -95,7 +95,7 @@ var OHLCV_INDICATORS;
|
|
|
95
95
|
t.r(e),
|
|
96
96
|
// EXPORTS
|
|
97
97
|
t.d(e, {
|
|
98
|
-
default: () => /* binding */
|
|
98
|
+
default: () => /* binding */ Hr
|
|
99
99
|
});
|
|
100
100
|
var o = function(t) {
|
|
101
101
|
return "string" == typeof t && /^\d{4}-\d{2}-\d{2}/.test(t);
|
|
@@ -119,7 +119,7 @@ var OHLCV_INDICATORS;
|
|
|
119
119
|
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
120
120
|
* [more] {boolean} Whether the result of division was truncated.
|
|
121
121
|
*/
|
|
122
|
-
function
|
|
122
|
+
function d(t, e, r, n) {
|
|
123
123
|
var o = t.c;
|
|
124
124
|
if (r === p && (r = t.constructor.RM), 0 !== r && 1 !== r && 2 !== r && 3 !== r) throw Error(f);
|
|
125
125
|
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] !== p))),
|
|
@@ -147,7 +147,7 @@ var OHLCV_INDICATORS;
|
|
|
147
147
|
/*
|
|
148
148
|
* Return a string representing the value of Big x in normal or exponential notation.
|
|
149
149
|
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
150
|
-
*/ function
|
|
150
|
+
*/ function b(t, e, r) {
|
|
151
151
|
var n = t.e, o = t.c.join(""), i = o.length;
|
|
152
152
|
// Exponential notation?
|
|
153
153
|
if (e) o = o.charAt(0) + (i > 1 ? "." + o.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
|
|
@@ -196,14 +196,14 @@ var OHLCV_INDICATORS;
|
|
|
196
196
|
if (!o[0]) throw Error(h);
|
|
197
197
|
// Dividend is 0? Return +-0.
|
|
198
198
|
if (!n[0]) return t.s = i, t.c = [ t.e = 0 ], t;
|
|
199
|
-
var l, c, f, y, v,
|
|
199
|
+
var l, c, f, y, v, b = o.slice(), m = l = o.length, g = n.length, w = n.slice(0, l), // remainder
|
|
200
200
|
O = w.length, S = t, // quotient
|
|
201
201
|
_ = S.c = [], j = 0, P = u + (S.e = e.e - t.e) + 1;
|
|
202
202
|
// precision of the result
|
|
203
203
|
// Add zeros to make remainder as long as divisor.
|
|
204
204
|
for (S.s = i, i = P < 0 ? 0 : P,
|
|
205
205
|
// Create version of divisor with leading zero.
|
|
206
|
-
|
|
206
|
+
b.unshift(0); O++ < l; ) w.push(0);
|
|
207
207
|
do {
|
|
208
208
|
// n is how many times the divisor goes into current remainder.
|
|
209
209
|
for (f = 0; f < 10; f++) {
|
|
@@ -216,7 +216,7 @@ var OHLCV_INDICATORS;
|
|
|
216
216
|
if (!(y < 0)) break;
|
|
217
217
|
// Remainder can't be more than 1 digit longer than divisor.
|
|
218
218
|
// Equalise lengths using divisor with extra leading zero?
|
|
219
|
-
for (c = O == l ? o :
|
|
219
|
+
for (c = O == l ? o : b; O; ) {
|
|
220
220
|
if (w[--O] < c[O]) {
|
|
221
221
|
for (v = O; v && !w[--v]; ) w[v] = 9;
|
|
222
222
|
--w[v], w[O] += 10;
|
|
@@ -235,7 +235,7 @@ var OHLCV_INDICATORS;
|
|
|
235
235
|
// There can't be more than one zero.
|
|
236
236
|
_.shift(), S.e--, P--),
|
|
237
237
|
// Round?
|
|
238
|
-
j > P &&
|
|
238
|
+
j > P && d(S, P, r.RM, w[0] !== p), S;
|
|
239
239
|
},
|
|
240
240
|
/*
|
|
241
241
|
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
@@ -378,7 +378,7 @@ var OHLCV_INDICATORS;
|
|
|
378
378
|
*/
|
|
379
379
|
y.prec = function(t, e) {
|
|
380
380
|
if (t !== ~~t || t < 1 || t > a) throw Error(c + "precision");
|
|
381
|
-
return
|
|
381
|
+
return d(new this.constructor(this), t, e);
|
|
382
382
|
},
|
|
383
383
|
/*
|
|
384
384
|
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
@@ -391,7 +391,7 @@ var OHLCV_INDICATORS;
|
|
|
391
391
|
*/
|
|
392
392
|
y.round = function(t, e) {
|
|
393
393
|
if (t === p) t = 0; else if (t !== ~~t || t < -a || t > a) throw Error(s);
|
|
394
|
-
return
|
|
394
|
+
return d(new this.constructor(this), t + this.e + 1, e);
|
|
395
395
|
},
|
|
396
396
|
/*
|
|
397
397
|
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
@@ -413,7 +413,7 @@ var OHLCV_INDICATORS;
|
|
|
413
413
|
do {
|
|
414
414
|
r = t, t = u.times(r.plus(n.div(r)));
|
|
415
415
|
} while (r.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
|
|
416
|
-
return
|
|
416
|
+
return d(t, (o.DP -= 4) + t.e + 1, o.RM);
|
|
417
417
|
},
|
|
418
418
|
/*
|
|
419
419
|
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
@@ -455,9 +455,9 @@ var OHLCV_INDICATORS;
|
|
|
455
455
|
var r = this, n = r.c[0];
|
|
456
456
|
if (t !== p) {
|
|
457
457
|
if (t !== ~~t || t < 0 || t > a) throw Error(s);
|
|
458
|
-
for (r =
|
|
458
|
+
for (r = d(new r.constructor(r), ++t, e); r.c.length < t; ) r.c.push(0);
|
|
459
459
|
}
|
|
460
|
-
return
|
|
460
|
+
return b(r, !0, !!n);
|
|
461
461
|
},
|
|
462
462
|
/*
|
|
463
463
|
* Return a string representing the value of this Big in normal notation rounded to dp fixed
|
|
@@ -474,9 +474,9 @@ var OHLCV_INDICATORS;
|
|
|
474
474
|
if (t !== p) {
|
|
475
475
|
if (t !== ~~t || t < 0 || t > a) throw Error(s);
|
|
476
476
|
// x.e may have changed if the value is rounded up.
|
|
477
|
-
for (t = t + (r =
|
|
477
|
+
for (t = t + (r = d(new r.constructor(r), t + r.e + 1, e)).e + 1; r.c.length < t; ) r.c.push(0);
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return b(r, !1, !!n);
|
|
480
480
|
},
|
|
481
481
|
/*
|
|
482
482
|
* Return a string representing the value of this Big.
|
|
@@ -486,13 +486,13 @@ var OHLCV_INDICATORS;
|
|
|
486
486
|
*/
|
|
487
487
|
y[Symbol.for("nodejs.util.inspect.custom")] = y.toJSON = y.toString = function() {
|
|
488
488
|
var t = this, e = t.constructor;
|
|
489
|
-
return
|
|
489
|
+
return b(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
|
|
490
490
|
},
|
|
491
491
|
/*
|
|
492
492
|
* Return the value of this Big as a primitve number.
|
|
493
493
|
*/
|
|
494
494
|
y.toNumber = function() {
|
|
495
|
-
var t = Number(
|
|
495
|
+
var t = Number(b(this, !0, !0));
|
|
496
496
|
if (!0 === this.constructor.strict && !this.eq(t.toString())) throw Error(l + "Imprecise conversion");
|
|
497
497
|
return t;
|
|
498
498
|
},
|
|
@@ -509,9 +509,9 @@ var OHLCV_INDICATORS;
|
|
|
509
509
|
var r = this, n = r.constructor, o = r.c[0];
|
|
510
510
|
if (t !== p) {
|
|
511
511
|
if (t !== ~~t || t < 1 || t > a) throw Error(c + "precision");
|
|
512
|
-
for (r =
|
|
512
|
+
for (r = d(new n(r), t, e); r.c.length < t; ) r.c.push(0);
|
|
513
513
|
}
|
|
514
|
-
return
|
|
514
|
+
return b(r, t <= r.e || r.e <= n.NE || r.e >= n.PE, !!o);
|
|
515
515
|
},
|
|
516
516
|
/*
|
|
517
517
|
* Return a string representing the value of this Big.
|
|
@@ -522,7 +522,7 @@ var OHLCV_INDICATORS;
|
|
|
522
522
|
y.valueOf = function() {
|
|
523
523
|
var t = this, e = t.constructor;
|
|
524
524
|
if (!0 === e.strict) throw Error(l + "valueOf disallowed");
|
|
525
|
-
return
|
|
525
|
+
return b(t, t.e <= e.NE || t.e >= e.PE, !0);
|
|
526
526
|
};
|
|
527
527
|
// Export
|
|
528
528
|
(
|
|
@@ -744,7 +744,7 @@ var OHLCV_INDICATORS;
|
|
|
744
744
|
}(t, "string");
|
|
745
745
|
return "symbol" == E(e) ? e : e + "";
|
|
746
746
|
}
|
|
747
|
-
var
|
|
747
|
+
var C = function() {
|
|
748
748
|
return k((function t() {
|
|
749
749
|
M(this, t), T(this, "previousHighest", void 0), T(this, "highest", void 0), T(this, "previousLowest", void 0),
|
|
750
750
|
T(this, "lowest", void 0), T(this, "previousResult", void 0), T(this, "result", void 0);
|
|
@@ -776,12 +776,12 @@ var OHLCV_INDICATORS;
|
|
|
776
776
|
} ]);
|
|
777
777
|
}();
|
|
778
778
|
// ./node_modules/trading-signals/dist/MA/MovingAverage.js
|
|
779
|
-
function
|
|
780
|
-
return
|
|
779
|
+
function R(t) {
|
|
780
|
+
return R = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
781
781
|
return typeof t;
|
|
782
782
|
} : function(t) {
|
|
783
783
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
784
|
-
},
|
|
784
|
+
}, R(t);
|
|
785
785
|
}
|
|
786
786
|
function D(t, e) {
|
|
787
787
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -800,7 +800,7 @@ var OHLCV_INDICATORS;
|
|
|
800
800
|
}
|
|
801
801
|
function N(t, e, r) {
|
|
802
802
|
return e = H(e), function(t, e) {
|
|
803
|
-
if (e && ("object" ==
|
|
803
|
+
if (e && ("object" == R(e) || "function" == typeof e)) return e;
|
|
804
804
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
805
805
|
return function(t) {
|
|
806
806
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -831,14 +831,14 @@ var OHLCV_INDICATORS;
|
|
|
831
831
|
}
|
|
832
832
|
}), Object.defineProperty(t, "prototype", {
|
|
833
833
|
writable: !1
|
|
834
|
-
}), e &&
|
|
834
|
+
}), e && q(t, e);
|
|
835
835
|
}
|
|
836
|
-
function
|
|
837
|
-
return
|
|
836
|
+
function q(t, e) {
|
|
837
|
+
return q = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
838
838
|
return t.__proto__ = e, t;
|
|
839
|
-
},
|
|
839
|
+
}, q(t, e);
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function z(t, e, r) {
|
|
842
842
|
return (e = $(e)) in t ? Object.defineProperty(t, e, {
|
|
843
843
|
value: r,
|
|
844
844
|
enumerable: !0,
|
|
@@ -848,21 +848,21 @@ var OHLCV_INDICATORS;
|
|
|
848
848
|
}
|
|
849
849
|
function $(t) {
|
|
850
850
|
var e = function(t, e) {
|
|
851
|
-
if ("object" !=
|
|
851
|
+
if ("object" != R(t) || !t) return t;
|
|
852
852
|
var r = t[Symbol.toPrimitive];
|
|
853
853
|
if (void 0 !== r) {
|
|
854
854
|
var n = r.call(t, e || "default");
|
|
855
|
-
if ("object" !=
|
|
855
|
+
if ("object" != R(n)) return n;
|
|
856
856
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
857
857
|
}
|
|
858
858
|
return ("string" === e ? String : Number)(t);
|
|
859
859
|
}(t, "string");
|
|
860
|
-
return "symbol" ==
|
|
860
|
+
return "symbol" == R(e) ? e : e + "";
|
|
861
861
|
}
|
|
862
862
|
var F = function(t) {
|
|
863
863
|
function e(t) {
|
|
864
864
|
var r;
|
|
865
|
-
return D(this, e),
|
|
865
|
+
return D(this, e), z(r = N(this, e), "interval", void 0), r.interval = t, r;
|
|
866
866
|
}
|
|
867
867
|
return U(e, t), B(e, [ {
|
|
868
868
|
key: "updates",
|
|
@@ -878,7 +878,7 @@ var OHLCV_INDICATORS;
|
|
|
878
878
|
return this.update(t, !0);
|
|
879
879
|
}
|
|
880
880
|
} ]);
|
|
881
|
-
}(
|
|
881
|
+
}(C);
|
|
882
882
|
// ./node_modules/trading-signals/dist/SMA/SMA.js
|
|
883
883
|
function K(t) {
|
|
884
884
|
return K = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
@@ -1098,19 +1098,19 @@ var OHLCV_INDICATORS;
|
|
|
1098
1098
|
if (void 0 === this.result && void 0 !== r) return this.setResult(r, e);
|
|
1099
1099
|
}
|
|
1100
1100
|
} ]);
|
|
1101
|
-
}(
|
|
1102
|
-
function
|
|
1101
|
+
}(C);
|
|
1102
|
+
function dt(t) {
|
|
1103
1103
|
return t.length ? t.reduce((function(t, e) {
|
|
1104
1104
|
return t + e;
|
|
1105
1105
|
}), 0) / t.length : 0;
|
|
1106
1106
|
}
|
|
1107
1107
|
// ./node_modules/trading-signals/dist/BBANDS/BollingerBands.js
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1108
|
+
function bt(t) {
|
|
1109
|
+
return bt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1110
1110
|
return typeof t;
|
|
1111
1111
|
} : function(t) {
|
|
1112
1112
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1113
|
-
},
|
|
1113
|
+
}, bt(t);
|
|
1114
1114
|
}
|
|
1115
1115
|
function mt(t, e) {
|
|
1116
1116
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -1137,16 +1137,16 @@ var OHLCV_INDICATORS;
|
|
|
1137
1137
|
}
|
|
1138
1138
|
function St(t) {
|
|
1139
1139
|
var e = function(t, e) {
|
|
1140
|
-
if ("object" !=
|
|
1140
|
+
if ("object" != bt(t) || !t) return t;
|
|
1141
1141
|
var r = t[Symbol.toPrimitive];
|
|
1142
1142
|
if (void 0 !== r) {
|
|
1143
1143
|
var n = r.call(t, e || "default");
|
|
1144
|
-
if ("object" !=
|
|
1144
|
+
if ("object" != bt(n)) return n;
|
|
1145
1145
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1146
1146
|
}
|
|
1147
1147
|
return ("string" === e ? String : Number)(t);
|
|
1148
1148
|
}(t, "string");
|
|
1149
|
-
return "symbol" ==
|
|
1149
|
+
return "symbol" == bt(e) ? e : e + "";
|
|
1150
1150
|
}
|
|
1151
1151
|
var _t = function() {
|
|
1152
1152
|
return wt((function t(e) {
|
|
@@ -1158,8 +1158,8 @@ var OHLCV_INDICATORS;
|
|
|
1158
1158
|
value: function(t) {
|
|
1159
1159
|
if (this.prices.push(t), this.prices.length > this.interval) {
|
|
1160
1160
|
this.prices.shift();
|
|
1161
|
-
var e =
|
|
1162
|
-
var r = e ||
|
|
1161
|
+
var e = dt(this.prices), r = function(t, e) {
|
|
1162
|
+
var r = e || dt(t), n = dt(t.map((function(t) {
|
|
1163
1163
|
return t - r;
|
|
1164
1164
|
})).map((function(t) {
|
|
1165
1165
|
return t * t;
|
|
@@ -1201,7 +1201,7 @@ var OHLCV_INDICATORS;
|
|
|
1201
1201
|
for (var r = 0; r < e.length; r++) {
|
|
1202
1202
|
var n = e[r];
|
|
1203
1203
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
1204
|
-
Object.defineProperty(t,
|
|
1204
|
+
Object.defineProperty(t, Rt(n.key), n);
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
1207
|
function Et(t, e, r) {
|
|
@@ -1249,15 +1249,15 @@ var OHLCV_INDICATORS;
|
|
|
1249
1249
|
return t.__proto__ = e, t;
|
|
1250
1250
|
}, It(t, e);
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return (e =
|
|
1252
|
+
function Ct(t, e, r) {
|
|
1253
|
+
return (e = Rt(e)) in t ? Object.defineProperty(t, e, {
|
|
1254
1254
|
value: r,
|
|
1255
1255
|
enumerable: !0,
|
|
1256
1256
|
configurable: !0,
|
|
1257
1257
|
writable: !0
|
|
1258
1258
|
}) : t[e] = r, t;
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1260
|
+
function Rt(t) {
|
|
1261
1261
|
var e = function(t, e) {
|
|
1262
1262
|
if ("object" != jt(t) || !t) return t;
|
|
1263
1263
|
var r = t[Symbol.toPrimitive];
|
|
@@ -1273,8 +1273,8 @@ var OHLCV_INDICATORS;
|
|
|
1273
1273
|
var Dt = function(t) {
|
|
1274
1274
|
function e(t) {
|
|
1275
1275
|
var r;
|
|
1276
|
-
return Pt(this, e),
|
|
1277
|
-
|
|
1276
|
+
return Pt(this, e), Ct(r = Mt(this, e, [ t ]), "interval", void 0), Ct(r, "pricesCounter", 0),
|
|
1277
|
+
Ct(r, "weightFactor", void 0), r.interval = t, r.weightFactor = 2 / (r.interval + 1),
|
|
1278
1278
|
r;
|
|
1279
1279
|
}
|
|
1280
1280
|
return Tt(e, t), Et(e, [ {
|
|
@@ -1345,7 +1345,7 @@ var OHLCV_INDICATORS;
|
|
|
1345
1345
|
}(t, "string");
|
|
1346
1346
|
return "symbol" == Vt(e) ? e : e + "";
|
|
1347
1347
|
}
|
|
1348
|
-
var
|
|
1348
|
+
var qt = function() {
|
|
1349
1349
|
return Lt((function t(e, r, n) {
|
|
1350
1350
|
Bt(this, t), Ht(this, "short", void 0), Ht(this, "long", void 0), Ht(this, "signal", void 0),
|
|
1351
1351
|
Ht(this, "prices", []), Ht(this, "result", void 0), this.short = e, this.long = r,
|
|
@@ -1379,12 +1379,12 @@ var OHLCV_INDICATORS;
|
|
|
1379
1379
|
} ]);
|
|
1380
1380
|
}();
|
|
1381
1381
|
// ./node_modules/trading-signals/dist/RSI/RSI.js
|
|
1382
|
-
function
|
|
1383
|
-
return
|
|
1382
|
+
function zt(t) {
|
|
1383
|
+
return zt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1384
1384
|
return typeof t;
|
|
1385
1385
|
} : function(t) {
|
|
1386
1386
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1387
|
-
},
|
|
1387
|
+
}, zt(t);
|
|
1388
1388
|
}
|
|
1389
1389
|
function $t(t, e) {
|
|
1390
1390
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -1403,7 +1403,7 @@ var OHLCV_INDICATORS;
|
|
|
1403
1403
|
}
|
|
1404
1404
|
function Gt(t, e, r) {
|
|
1405
1405
|
return e = Wt(e), function(t, e) {
|
|
1406
|
-
if (e && ("object" ==
|
|
1406
|
+
if (e && ("object" == zt(e) || "function" == typeof e)) return e;
|
|
1407
1407
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1408
1408
|
return function(t) {
|
|
1409
1409
|
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -1451,16 +1451,16 @@ var OHLCV_INDICATORS;
|
|
|
1451
1451
|
}
|
|
1452
1452
|
function Zt(t) {
|
|
1453
1453
|
var e = function(t, e) {
|
|
1454
|
-
if ("object" !=
|
|
1454
|
+
if ("object" != zt(t) || !t) return t;
|
|
1455
1455
|
var r = t[Symbol.toPrimitive];
|
|
1456
1456
|
if (void 0 !== r) {
|
|
1457
1457
|
var n = r.call(t, e || "default");
|
|
1458
|
-
if ("object" !=
|
|
1458
|
+
if ("object" != zt(n)) return n;
|
|
1459
1459
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1460
1460
|
}
|
|
1461
1461
|
return ("string" === e ? String : Number)(t);
|
|
1462
1462
|
}(t, "string");
|
|
1463
|
-
return "symbol" ==
|
|
1463
|
+
return "symbol" == zt(e) ? e : e + "";
|
|
1464
1464
|
}
|
|
1465
1465
|
var te = function(t) {
|
|
1466
1466
|
function e(t) {
|
|
@@ -1486,7 +1486,7 @@ var OHLCV_INDICATORS;
|
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
} ]);
|
|
1489
|
-
}(
|
|
1489
|
+
}(C);
|
|
1490
1490
|
// ./src/utilities/numberUtilities.js
|
|
1491
1491
|
function ee(t, e) {
|
|
1492
1492
|
return function(t) {
|
|
@@ -1665,7 +1665,7 @@ var OHLCV_INDICATORS;
|
|
|
1665
1665
|
var ve = {
|
|
1666
1666
|
ema: Dt,
|
|
1667
1667
|
sma: nt
|
|
1668
|
-
},
|
|
1668
|
+
}, de = function(t, e, r, n) {
|
|
1669
1669
|
if (!r || "object" !== se(r)) throw new Error('"options" must be an object in '.concat(t, ". eg: {target, height, range}"));
|
|
1670
1670
|
var o = r.target, i = void 0 === o ? "close" : o, a = r.diff, u = void 0 === a ? null : a;
|
|
1671
1671
|
if ("string" != typeof i) throw new Error('"target" must be a valid keyName '.concat(t, "."));
|
|
@@ -1676,17 +1676,17 @@ var OHLCV_INDICATORS;
|
|
|
1676
1676
|
diff: null
|
|
1677
1677
|
};
|
|
1678
1678
|
if (null !== u && ("object" === se(u) || "boolean" == typeof u && !0 === u)) {
|
|
1679
|
-
var c = u = !0 === u ? {} : u, s = c.stdDev, f = void 0 === s ? 2 : s, h = c.scale, y = void 0 === h ? .05 : h, p = c.targets, v = void 0 === p ? [ "close" ] : p,
|
|
1679
|
+
var c = u = !0 === u ? {} : u, s = c.stdDev, f = void 0 === s ? 2 : s, h = c.scale, y = void 0 === h ? .05 : h, p = c.targets, v = void 0 === p ? [ "close" ] : p, d = c.size, b = void 0 === d ? e : d, m = c.lag, g = void 0 === m ? 0 : m, w = c.autoMinMax, O = void 0 !== w && w;
|
|
1680
1680
|
if ("number" != typeof f || f <= 0) throw new Error('"diff.stdDev" must be a number greater than 0 in '.concat(t, "."));
|
|
1681
1681
|
if ("number" != typeof y || !n.includes(y)) throw new Error('"diff.scale" must be a number between 0.01 and 1 in '.concat(t, "."));
|
|
1682
|
-
if ("number" != typeof
|
|
1682
|
+
if ("number" != typeof b || !Number.isInteger(b) || b <= 0) throw new Error('"diff.size" must be an integer greater than or equal to size in '.concat(t, "."));
|
|
1683
1683
|
if (!Array.isArray(v)) throw new Error('"diff.targest" must be an array of keyNames with at least 1 item in '.concat(t, "."));
|
|
1684
1684
|
if ("number" != typeof g || !Number.isInteger(g) || g < 0) throw new Error('"diff.lag" must be an integer greater than 0 in '.concat(t, "."));
|
|
1685
1685
|
if ("boolean" != typeof O) throw new Error('"diff.autoMinMax" must be an boolean in '.concat(t, "."));
|
|
1686
1686
|
l.diff = {
|
|
1687
1687
|
stdDev: f,
|
|
1688
1688
|
scale: y,
|
|
1689
|
-
size:
|
|
1689
|
+
size: b,
|
|
1690
1690
|
targets: v,
|
|
1691
1691
|
lag: g,
|
|
1692
1692
|
autoMinMax: O
|
|
@@ -1695,26 +1695,26 @@ var OHLCV_INDICATORS;
|
|
|
1695
1695
|
return l;
|
|
1696
1696
|
};
|
|
1697
1697
|
// ./src/moving-averages/macd.js
|
|
1698
|
-
function
|
|
1699
|
-
return
|
|
1698
|
+
function be(t) {
|
|
1699
|
+
return be = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
1700
1700
|
return typeof t;
|
|
1701
1701
|
} : function(t) {
|
|
1702
1702
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1703
|
-
},
|
|
1703
|
+
}, be(t);
|
|
1704
1704
|
}
|
|
1705
1705
|
function me(t, e, r) {
|
|
1706
1706
|
return (e = function(t) {
|
|
1707
1707
|
var e = function(t, e) {
|
|
1708
|
-
if ("object" !=
|
|
1708
|
+
if ("object" != be(t) || !t) return t;
|
|
1709
1709
|
var r = t[Symbol.toPrimitive];
|
|
1710
1710
|
if (void 0 !== r) {
|
|
1711
1711
|
var n = r.call(t, e || "default");
|
|
1712
|
-
if ("object" !=
|
|
1712
|
+
if ("object" != be(n)) return n;
|
|
1713
1713
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1714
1714
|
}
|
|
1715
1715
|
return ("string" === e ? String : Number)(t);
|
|
1716
1716
|
}(t, "string");
|
|
1717
|
-
return "symbol" ==
|
|
1717
|
+
return "symbol" == be(e) ? e : e + "";
|
|
1718
1718
|
}(e)) in t ? Object.defineProperty(t, e, {
|
|
1719
1719
|
value: r,
|
|
1720
1720
|
enumerable: !0,
|
|
@@ -1886,7 +1886,7 @@ var OHLCV_INDICATORS;
|
|
|
1886
1886
|
}
|
|
1887
1887
|
return r;
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1889
|
+
function Ce(t, e, r) {
|
|
1890
1890
|
return (e = function(t) {
|
|
1891
1891
|
var e = function(t, e) {
|
|
1892
1892
|
if ("object" != Te(t) || !t) return t;
|
|
@@ -1906,7 +1906,7 @@ var OHLCV_INDICATORS;
|
|
|
1906
1906
|
writable: !0
|
|
1907
1907
|
}) : t[e] = r, t;
|
|
1908
1908
|
}
|
|
1909
|
-
function
|
|
1909
|
+
function Re(t) {
|
|
1910
1910
|
return function(t) {
|
|
1911
1911
|
if (Array.isArray(t)) return Be(t);
|
|
1912
1912
|
}(t) || function(t) {
|
|
@@ -2011,18 +2011,18 @@ var OHLCV_INDICATORS;
|
|
|
2011
2011
|
}
|
|
2012
2012
|
return r;
|
|
2013
2013
|
}
|
|
2014
|
-
function
|
|
2014
|
+
function qe(t) {
|
|
2015
2015
|
for (var e = 1; e < arguments.length; e++) {
|
|
2016
2016
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
2017
2017
|
e % 2 ? Ue(Object(r), !0).forEach((function(e) {
|
|
2018
|
-
|
|
2018
|
+
ze(t, e, r[e]);
|
|
2019
2019
|
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ue(Object(r)).forEach((function(e) {
|
|
2020
2020
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
2021
2021
|
}));
|
|
2022
2022
|
}
|
|
2023
2023
|
return t;
|
|
2024
2024
|
}
|
|
2025
|
-
function
|
|
2025
|
+
function ze(t, e, r) {
|
|
2026
2026
|
return (e = function(t) {
|
|
2027
2027
|
var e = function(t, e) {
|
|
2028
2028
|
if ("object" != He(t) || !t) return t;
|
|
@@ -2136,21 +2136,28 @@ var OHLCV_INDICATORS;
|
|
|
2136
2136
|
return n;
|
|
2137
2137
|
}
|
|
2138
2138
|
var We = function(t, e) {
|
|
2139
|
-
return
|
|
2139
|
+
return t - e;
|
|
2140
|
+
}, Ye = function(t, e, r, n, o) {
|
|
2141
|
+
if (o ? t[e][t[e].length - 1] = n : t[e].push(n), t[e].length > r && t[e].shift(),
|
|
2142
|
+
t.length < r) return null;
|
|
2143
|
+
var i = t[e].reduce((function(t, e) {
|
|
2144
|
+
return t + e;
|
|
2145
|
+
}), 0) / r, a = Math.sqrt(t[e].reduce((function(t, e) {
|
|
2146
|
+
return t + Math.pow(e - i, 2);
|
|
2147
|
+
}), 0) / r);
|
|
2148
|
+
return (n - i) / a;
|
|
2140
2149
|
};
|
|
2141
|
-
//
|
|
2142
|
-
|
|
2143
|
-
// ./src/studies/lag.js
|
|
2144
|
-
function Ye(t) {
|
|
2150
|
+
// ./src/studies/lag.js
|
|
2151
|
+
function Qe(t) {
|
|
2145
2152
|
return function(t) {
|
|
2146
|
-
if (Array.isArray(t)) return
|
|
2153
|
+
if (Array.isArray(t)) return er(t);
|
|
2147
2154
|
}(t) || function(t) {
|
|
2148
2155
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2149
|
-
}(t) ||
|
|
2156
|
+
}(t) || tr(t) || function() {
|
|
2150
2157
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2151
2158
|
}();
|
|
2152
2159
|
}
|
|
2153
|
-
function
|
|
2160
|
+
function Xe(t, e) {
|
|
2154
2161
|
return function(t) {
|
|
2155
2162
|
if (Array.isArray(t)) return t;
|
|
2156
2163
|
}(t) || function(t, e) {
|
|
@@ -2173,14 +2180,14 @@ var OHLCV_INDICATORS;
|
|
|
2173
2180
|
}
|
|
2174
2181
|
return u;
|
|
2175
2182
|
}
|
|
2176
|
-
}(t, e) ||
|
|
2183
|
+
}(t, e) || tr(t, e) || function() {
|
|
2177
2184
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2178
2185
|
}();
|
|
2179
2186
|
}
|
|
2180
|
-
function
|
|
2187
|
+
function Ze(t, e) {
|
|
2181
2188
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2182
2189
|
if (!r) {
|
|
2183
|
-
if (Array.isArray(t) || (r =
|
|
2190
|
+
if (Array.isArray(t) || (r = tr(t)) || e && t && "number" == typeof t.length) {
|
|
2184
2191
|
r && (t = r);
|
|
2185
2192
|
var n = 0, o = function() {};
|
|
2186
2193
|
return {
|
|
@@ -2222,42 +2229,42 @@ var OHLCV_INDICATORS;
|
|
|
2222
2229
|
}
|
|
2223
2230
|
};
|
|
2224
2231
|
}
|
|
2225
|
-
function
|
|
2232
|
+
function tr(t, e) {
|
|
2226
2233
|
if (t) {
|
|
2227
|
-
if ("string" == typeof t) return
|
|
2234
|
+
if ("string" == typeof t) return er(t, e);
|
|
2228
2235
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2229
|
-
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) ?
|
|
2236
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? er(t, e) : void 0;
|
|
2230
2237
|
}
|
|
2231
2238
|
}
|
|
2232
|
-
function
|
|
2239
|
+
function er(t, e) {
|
|
2233
2240
|
(null == e || e > t.length) && (e = t.length);
|
|
2234
2241
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2235
2242
|
return n;
|
|
2236
2243
|
}
|
|
2237
|
-
function
|
|
2238
|
-
return
|
|
2244
|
+
function rr(t) {
|
|
2245
|
+
return rr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2239
2246
|
return typeof t;
|
|
2240
2247
|
} : function(t) {
|
|
2241
2248
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2242
|
-
},
|
|
2249
|
+
}, rr(t);
|
|
2243
2250
|
}
|
|
2244
|
-
var
|
|
2251
|
+
var nr = function(t, e) {
|
|
2245
2252
|
var r = t.instances, n = t.verticalOhlcv, o = t.nullArray;
|
|
2246
2253
|
if (0 === e) {
|
|
2247
2254
|
var i = t.inputParams, a = t.priceBased, u = i.filter((function(t) {
|
|
2248
2255
|
return "lag" === t.key;
|
|
2249
2256
|
}));
|
|
2250
|
-
if ("object" !==
|
|
2257
|
+
if ("object" !== rr(u)) return;
|
|
2251
2258
|
var l, c = u.map((function(t) {
|
|
2252
2259
|
return t.params;
|
|
2253
|
-
})), s =
|
|
2260
|
+
})), s = Ze(c);
|
|
2254
2261
|
try {
|
|
2255
2262
|
for (s.s(); !(l = s.n()).done; ) {
|
|
2256
|
-
var f, h =
|
|
2263
|
+
var f, h = Xe(l.value, 2), y = h[0], p = h[1], v = Ze(y);
|
|
2257
2264
|
try {
|
|
2258
2265
|
for (v.s(); !(f = v.n()).done; ) {
|
|
2259
|
-
var
|
|
2260
|
-
if (a.includes(
|
|
2266
|
+
var d = f.value;
|
|
2267
|
+
if (a.includes(d)) for (var b = 1; b <= p; b++) a.push("".concat(d, "_lag_").concat(b));
|
|
2261
2268
|
}
|
|
2262
2269
|
} catch (t) {
|
|
2263
2270
|
v.e(t);
|
|
@@ -2274,16 +2281,16 @@ var OHLCV_INDICATORS;
|
|
|
2274
2281
|
lagParams: c
|
|
2275
2282
|
};
|
|
2276
2283
|
}
|
|
2277
|
-
var m, g =
|
|
2284
|
+
var m, g = Ze(r.lag.lagParams);
|
|
2278
2285
|
try {
|
|
2279
2286
|
for (g.s(); !(m = g.n()).done; ) {
|
|
2280
|
-
var w, O =
|
|
2287
|
+
var w, O = Xe(m.value, 2), S = O[0], _ = O[1], j = Ze(S);
|
|
2281
2288
|
try {
|
|
2282
2289
|
for (j.s(); !(w = j.n()).done; ) {
|
|
2283
2290
|
var P = w.value, A = n[P];
|
|
2284
2291
|
// Initialize lagged arrays only on the first index
|
|
2285
2292
|
if (0 === e) for (var E = 1; E <= _; E++) {
|
|
2286
|
-
n["".concat(P, "_lag_").concat(E)] =
|
|
2293
|
+
n["".concat(P, "_lag_").concat(E)] = Qe(o);
|
|
2287
2294
|
}
|
|
2288
2295
|
// Populate lagged values
|
|
2289
2296
|
for (var M = 1; M <= _; M++) {
|
|
@@ -2309,59 +2316,59 @@ var OHLCV_INDICATORS;
|
|
|
2309
2316
|
return !0;
|
|
2310
2317
|
};
|
|
2311
2318
|
// ./src/studies/findCrosses.js
|
|
2312
|
-
function
|
|
2319
|
+
function or(t) {
|
|
2313
2320
|
return function(t) {
|
|
2314
|
-
if (Array.isArray(t)) return
|
|
2321
|
+
if (Array.isArray(t)) return ar(t);
|
|
2315
2322
|
}(t) || function(t) {
|
|
2316
2323
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2317
|
-
}(t) ||
|
|
2324
|
+
}(t) || ir(t) || function() {
|
|
2318
2325
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2319
2326
|
}();
|
|
2320
2327
|
}
|
|
2321
|
-
function
|
|
2328
|
+
function ir(t, e) {
|
|
2322
2329
|
if (t) {
|
|
2323
|
-
if ("string" == typeof t) return
|
|
2330
|
+
if ("string" == typeof t) return ar(t, e);
|
|
2324
2331
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2325
|
-
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) ?
|
|
2332
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ar(t, e) : void 0;
|
|
2326
2333
|
}
|
|
2327
2334
|
}
|
|
2328
|
-
function
|
|
2335
|
+
function ar(t, e) {
|
|
2329
2336
|
(null == e || e > t.length) && (e = t.length);
|
|
2330
2337
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2331
2338
|
return n;
|
|
2332
2339
|
}
|
|
2333
|
-
function
|
|
2334
|
-
return
|
|
2340
|
+
function ur(t) {
|
|
2341
|
+
return ur = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
2335
2342
|
return typeof t;
|
|
2336
2343
|
} : function(t) {
|
|
2337
2344
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2338
|
-
},
|
|
2345
|
+
}, ur(t);
|
|
2339
2346
|
}
|
|
2340
|
-
function
|
|
2347
|
+
function lr(t, e) {
|
|
2341
2348
|
for (var r = 0; r < e.length; r++) {
|
|
2342
2349
|
var n = e[r];
|
|
2343
2350
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
2344
|
-
Object.defineProperty(t,
|
|
2351
|
+
Object.defineProperty(t, cr(n.key), n);
|
|
2345
2352
|
}
|
|
2346
2353
|
}
|
|
2347
|
-
function
|
|
2354
|
+
function cr(t) {
|
|
2348
2355
|
var e = function(t, e) {
|
|
2349
|
-
if ("object" !=
|
|
2356
|
+
if ("object" != ur(t) || !t) return t;
|
|
2350
2357
|
var r = t[Symbol.toPrimitive];
|
|
2351
2358
|
if (void 0 !== r) {
|
|
2352
2359
|
var n = r.call(t, e || "default");
|
|
2353
|
-
if ("object" !=
|
|
2360
|
+
if ("object" != ur(n)) return n;
|
|
2354
2361
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2355
2362
|
}
|
|
2356
2363
|
return ("string" === e ? String : Number)(t);
|
|
2357
2364
|
}(t, "string");
|
|
2358
|
-
return "symbol" ==
|
|
2365
|
+
return "symbol" == ur(e) ? e : e + "";
|
|
2359
2366
|
}
|
|
2360
|
-
var
|
|
2367
|
+
var sr = function(t, e) {
|
|
2361
2368
|
return t > e;
|
|
2362
|
-
},
|
|
2369
|
+
}, fr = function(t, e) {
|
|
2363
2370
|
return t < e;
|
|
2364
|
-
},
|
|
2371
|
+
}, hr = function() {
|
|
2365
2372
|
return t = function t() {
|
|
2366
2373
|
!function(t, e) {
|
|
2367
2374
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -2386,11 +2393,11 @@ var OHLCV_INDICATORS;
|
|
|
2386
2393
|
this.areHighAndLowUndefined || void 0 !== r && void 0 !== o || (this.areHighAndLowUndefined = !0),
|
|
2387
2394
|
null === e || null === n || function(t, e) {
|
|
2388
2395
|
return t === e;
|
|
2389
|
-
}(e, n) ? i = .5 :
|
|
2396
|
+
}(e, n) ? i = .5 : sr(e, n) ? i = this.areHighAndLowUndefined ? 1 : [ o, n, this.prevLow, this.prevSlow ].every((function(t) {
|
|
2390
2397
|
return null !== t;
|
|
2391
|
-
})) &&
|
|
2398
|
+
})) && fr(o, n) && sr(this.prevLow, this.prevSlow) ? 0 : 1 : fr(e, n) && (i = this.areHighAndLowUndefined ? 0 : [ r, n, this.prevHigh, this.prevSlow ].every((function(t) {
|
|
2392
2399
|
return null !== t;
|
|
2393
|
-
})) &&
|
|
2400
|
+
})) && sr(r, n) && fr(this.prevHigh, this.prevSlow) ? 1 : 0), .5 === i ? this.interval = 0 : 1 === i ? this.prevState <= .5 ? this.interval = 1 : this.interval++ : 0 === i && (this.prevState >= .5 ? this.interval = -1 : this.interval--),
|
|
2394
2401
|
1 === this.interval && this.crossIndexes.up.push(this.index), -1 === this.interval && this.crossIndexes.down.push(this.index),
|
|
2395
2402
|
//save prev state
|
|
2396
2403
|
Object.assign(this, {
|
|
@@ -2407,17 +2414,17 @@ var OHLCV_INDICATORS;
|
|
|
2407
2414
|
value: function() {
|
|
2408
2415
|
return this.interval;
|
|
2409
2416
|
}
|
|
2410
|
-
} ]) &&
|
|
2417
|
+
} ]) && lr(t.prototype, e), r && lr(t, r), Object.defineProperty(t, "prototype", {
|
|
2411
2418
|
writable: !1
|
|
2412
2419
|
}), t;
|
|
2413
2420
|
var t, e, r;
|
|
2414
|
-
}(),
|
|
2421
|
+
}(), yr = function(t, e) {
|
|
2415
2422
|
var r = t.nullArray, n = t.verticalOhlcv, o = t.instances, i = t.len;
|
|
2416
2423
|
if (0 === e) {
|
|
2417
2424
|
var a = t.inputParams.filter((function(t) {
|
|
2418
2425
|
return "crossPairs" === t.key;
|
|
2419
2426
|
}));
|
|
2420
|
-
if ("object" !==
|
|
2427
|
+
if ("object" !== ur(a)) return;
|
|
2421
2428
|
o.crossPairs = {
|
|
2422
2429
|
crossPairsList: a.flatMap((function(t) {
|
|
2423
2430
|
return t.params.flat();
|
|
@@ -2427,7 +2434,7 @@ var OHLCV_INDICATORS;
|
|
|
2427
2434
|
var u, l = function(t, e) {
|
|
2428
2435
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2429
2436
|
if (!r) {
|
|
2430
|
-
if (Array.isArray(t) || (r =
|
|
2437
|
+
if (Array.isArray(t) || (r = ir(t)) || e && t && "number" == typeof t.length) {
|
|
2431
2438
|
r && (t = r);
|
|
2432
2439
|
var n = 0, o = function() {};
|
|
2433
2440
|
return {
|
|
@@ -2477,17 +2484,17 @@ var OHLCV_INDICATORS;
|
|
|
2477
2484
|
if (0 === e) {
|
|
2478
2485
|
if ("number" == typeof f && (n[f] = new Array(i).fill(f)), "price" !== s && !n.hasOwnProperty(s)) throw Error('fast "'.concat(s, ' not found in crossPairs"'));
|
|
2479
2486
|
if (!n.hasOwnProperty(f)) throw Error('slow "'.concat(f, ' not found in crossPairs"'));
|
|
2480
|
-
o[h] = new
|
|
2487
|
+
o[h] = new hr, n[h] = or(r);
|
|
2481
2488
|
}
|
|
2482
|
-
var y = void 0, p = void 0, v = void 0,
|
|
2483
|
-
"price" === s ? (p = n.close[e], v = n.high[e],
|
|
2489
|
+
var y = void 0, p = void 0, v = void 0, d = void 0, b = void 0;
|
|
2490
|
+
"price" === s ? (p = n.close[e], v = n.high[e], d = n.low[e], b = n[f][e], o[h].update({
|
|
2484
2491
|
fast: p,
|
|
2485
|
-
slow:
|
|
2492
|
+
slow: b,
|
|
2486
2493
|
high: v,
|
|
2487
|
-
low:
|
|
2488
|
-
})) : (y = n[s][e],
|
|
2494
|
+
low: d
|
|
2495
|
+
})) : (y = n[s][e], b = n[f][e], o[h].update({
|
|
2489
2496
|
fast: y,
|
|
2490
|
-
slow:
|
|
2497
|
+
slow: b
|
|
2491
2498
|
})), t.pushToMain({
|
|
2492
2499
|
index: e,
|
|
2493
2500
|
key: h,
|
|
@@ -2502,27 +2509,27 @@ var OHLCV_INDICATORS;
|
|
|
2502
2509
|
}
|
|
2503
2510
|
};
|
|
2504
2511
|
// ./src/studies/dateTime.js
|
|
2505
|
-
function
|
|
2512
|
+
function pr(t) {
|
|
2506
2513
|
return function(t) {
|
|
2507
|
-
if (Array.isArray(t)) return
|
|
2514
|
+
if (Array.isArray(t)) return vr(t);
|
|
2508
2515
|
}(t) || function(t) {
|
|
2509
2516
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2510
2517
|
}(t) || function(t, e) {
|
|
2511
2518
|
if (t) {
|
|
2512
|
-
if ("string" == typeof t) return
|
|
2519
|
+
if ("string" == typeof t) return vr(t, e);
|
|
2513
2520
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2514
|
-
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) ?
|
|
2521
|
+
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;
|
|
2515
2522
|
}
|
|
2516
2523
|
}(t) || function() {
|
|
2517
2524
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2518
2525
|
}();
|
|
2519
2526
|
}
|
|
2520
|
-
function
|
|
2527
|
+
function vr(t, e) {
|
|
2521
2528
|
(null == e || e > t.length) && (e = t.length);
|
|
2522
2529
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2523
2530
|
return n;
|
|
2524
2531
|
}
|
|
2525
|
-
var
|
|
2532
|
+
var dr = function(t) {
|
|
2526
2533
|
var e = new Date(t), r = e.getMonth(), n = e.getFullYear(), o = e.getHours(), i = e.getMinutes(), a = e.getDay(), u = e.getDate(), l = new Date(e.getFullYear(), e.getMonth(), 1).getDay();
|
|
2527
2534
|
return {
|
|
2528
2535
|
month: r,
|
|
@@ -2537,29 +2544,29 @@ var OHLCV_INDICATORS;
|
|
|
2537
2544
|
// ./src/studies/priceVariations.js
|
|
2538
2545
|
function br(t) {
|
|
2539
2546
|
return function(t) {
|
|
2540
|
-
if (Array.isArray(t)) return
|
|
2547
|
+
if (Array.isArray(t)) return mr(t);
|
|
2541
2548
|
}(t) || function(t) {
|
|
2542
2549
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2543
2550
|
}(t) || function(t, e) {
|
|
2544
2551
|
if (t) {
|
|
2545
|
-
if ("string" == typeof t) return
|
|
2552
|
+
if ("string" == typeof t) return mr(t, e);
|
|
2546
2553
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2547
|
-
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) ?
|
|
2554
|
+
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) ? mr(t, e) : void 0;
|
|
2548
2555
|
}
|
|
2549
2556
|
}(t) || function() {
|
|
2550
2557
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2551
2558
|
}();
|
|
2552
2559
|
}
|
|
2553
|
-
function
|
|
2560
|
+
function mr(t, e) {
|
|
2554
2561
|
(null == e || e > t.length) && (e = t.length);
|
|
2555
2562
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2556
2563
|
return n;
|
|
2557
2564
|
}
|
|
2558
|
-
var
|
|
2559
|
-
function
|
|
2565
|
+
var gr = [ "open", "high", "low", "close" ];
|
|
2566
|
+
function wr(t, e) {
|
|
2560
2567
|
var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
2561
2568
|
if (!r) {
|
|
2562
|
-
if (Array.isArray(t) || (r =
|
|
2569
|
+
if (Array.isArray(t) || (r = jr(t)) || e && t && "number" == typeof t.length) {
|
|
2563
2570
|
r && (t = r);
|
|
2564
2571
|
var n = 0, o = function() {};
|
|
2565
2572
|
return {
|
|
@@ -2601,7 +2608,7 @@ var OHLCV_INDICATORS;
|
|
|
2601
2608
|
}
|
|
2602
2609
|
};
|
|
2603
2610
|
}
|
|
2604
|
-
function
|
|
2611
|
+
function Or(t, e) {
|
|
2605
2612
|
if (null == t) return {};
|
|
2606
2613
|
var r, n, o = function(t, e) {
|
|
2607
2614
|
if (null == t) return {};
|
|
@@ -2618,16 +2625,16 @@ var OHLCV_INDICATORS;
|
|
|
2618
2625
|
}
|
|
2619
2626
|
return o;
|
|
2620
2627
|
}
|
|
2621
|
-
function
|
|
2628
|
+
function Sr(t) {
|
|
2622
2629
|
return function(t) {
|
|
2623
|
-
if (Array.isArray(t)) return
|
|
2630
|
+
if (Array.isArray(t)) return Pr(t);
|
|
2624
2631
|
}(t) || function(t) {
|
|
2625
2632
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
2626
|
-
}(t) ||
|
|
2633
|
+
}(t) || jr(t) || function() {
|
|
2627
2634
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2628
2635
|
}();
|
|
2629
2636
|
}
|
|
2630
|
-
function
|
|
2637
|
+
function _r(t, e) {
|
|
2631
2638
|
return function(t) {
|
|
2632
2639
|
if (Array.isArray(t)) return t;
|
|
2633
2640
|
}
|
|
@@ -2652,23 +2659,23 @@ var OHLCV_INDICATORS;
|
|
|
2652
2659
|
}
|
|
2653
2660
|
return u;
|
|
2654
2661
|
}
|
|
2655
|
-
}(t, e) ||
|
|
2662
|
+
}(t, e) || jr(t, e) || function() {
|
|
2656
2663
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2657
2664
|
}();
|
|
2658
2665
|
}
|
|
2659
|
-
function
|
|
2666
|
+
function jr(t, e) {
|
|
2660
2667
|
if (t) {
|
|
2661
|
-
if ("string" == typeof t) return
|
|
2668
|
+
if ("string" == typeof t) return Pr(t, e);
|
|
2662
2669
|
var r = {}.toString.call(t).slice(8, -1);
|
|
2663
|
-
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) ?
|
|
2670
|
+
return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Pr(t, e) : void 0;
|
|
2664
2671
|
}
|
|
2665
2672
|
}
|
|
2666
|
-
function
|
|
2673
|
+
function Pr(t, e) {
|
|
2667
2674
|
(null == e || e > t.length) && (e = t.length);
|
|
2668
2675
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
2669
2676
|
return n;
|
|
2670
2677
|
}
|
|
2671
|
-
var
|
|
2678
|
+
var Ar = {
|
|
2672
2679
|
dateTime: function(t, e) {
|
|
2673
2680
|
var r = t.instances, n = t.verticalOhlcv;
|
|
2674
2681
|
if (0 === e) {
|
|
@@ -2683,17 +2690,17 @@ var OHLCV_INDICATORS;
|
|
|
2683
2690
|
cachedDayInfo: i
|
|
2684
2691
|
}
|
|
2685
2692
|
}), Object.assign(n, {
|
|
2686
|
-
day_of_the_week:
|
|
2687
|
-
day_of_the_month:
|
|
2688
|
-
week_of_the_month:
|
|
2689
|
-
hour:
|
|
2690
|
-
month:
|
|
2691
|
-
year:
|
|
2692
|
-
session_daily_index:
|
|
2693
|
-
session_intraday_index:
|
|
2693
|
+
day_of_the_week: pr(o),
|
|
2694
|
+
day_of_the_month: pr(o),
|
|
2695
|
+
week_of_the_month: pr(o),
|
|
2696
|
+
hour: pr(o),
|
|
2697
|
+
month: pr(o),
|
|
2698
|
+
year: pr(o),
|
|
2699
|
+
session_daily_index: pr(o),
|
|
2700
|
+
session_intraday_index: pr(o)
|
|
2694
2701
|
});
|
|
2695
2702
|
}
|
|
2696
|
-
var a = n.date[e], u =
|
|
2703
|
+
var a = n.date[e], u = dr(a), l = u.day_of_the_week, c = u.day_of_the_month, s = u.week_of_the_month, f = u.month, h = u.year, y = u.hour, p = a.slice(0, 10);
|
|
2697
2704
|
p !== r.dateTime.prevDateStr && (r.dateTime.prevDateStr = p, r.dateTime.sessionDailyIndexCount++,
|
|
2698
2705
|
r.dateTime.sessionIntradayIndexCount = 0), t.pushToMain({
|
|
2699
2706
|
index: e,
|
|
@@ -2759,23 +2766,23 @@ var OHLCV_INDICATORS;
|
|
|
2759
2766
|
}), Object.assign(c, le(le({}, h, new te(r)), y, new nt(r))), Object.assign(l, le(le({}, h, ae(v)), y, ae(v))),
|
|
2760
2767
|
a > 0 && t.lag([ h, y ], a), u && t.autoMinMaxKeys.push(h, y);
|
|
2761
2768
|
}
|
|
2762
|
-
var
|
|
2769
|
+
var d = l[i][e], b = null, m = null;
|
|
2763
2770
|
// Update the RSI indicator.
|
|
2764
|
-
c[h].update(
|
|
2771
|
+
c[h].update(d, s);
|
|
2765
2772
|
try {
|
|
2766
|
-
|
|
2773
|
+
b = c[h].getResult();
|
|
2767
2774
|
} catch (t) {
|
|
2768
|
-
|
|
2775
|
+
b = null;
|
|
2769
2776
|
}
|
|
2770
|
-
null !==
|
|
2777
|
+
null !== b && "number" == typeof b && o && (b = ne(b, o)),
|
|
2771
2778
|
// Always push the RSI value, using null as a fallback.
|
|
2772
2779
|
t.pushToMain({
|
|
2773
2780
|
index: e,
|
|
2774
2781
|
key: h,
|
|
2775
|
-
value:
|
|
2782
|
+
value: b
|
|
2776
2783
|
}),
|
|
2777
2784
|
// Update the SMA indicator only if a valid RSI value is available.
|
|
2778
|
-
null !==
|
|
2785
|
+
null !== b && "number" == typeof b && c[y].update(b, s);
|
|
2779
2786
|
try {
|
|
2780
2787
|
m = c[y].getResult();
|
|
2781
2788
|
} catch (t) {
|
|
@@ -2800,19 +2807,19 @@ var OHLCV_INDICATORS;
|
|
|
2800
2807
|
maInstance: new ve[r](n)
|
|
2801
2808
|
}, u[h] = he(p), null !== a) {
|
|
2802
2809
|
l[h].diffInstance = new _t(a.size, a.stdDev);
|
|
2803
|
-
var v,
|
|
2810
|
+
var v, d = [], b = fe(a.targets);
|
|
2804
2811
|
try {
|
|
2805
|
-
for (
|
|
2812
|
+
for (b.s(); !(v = b.n()).done; ) {
|
|
2806
2813
|
var m = v.value;
|
|
2807
2814
|
u["".concat(y, "_").concat(m)] = he(p), a.autoMinMax && t.autoMinMaxKeys.push("".concat(y, "_").concat(m)),
|
|
2808
|
-
a.lag > 0 &&
|
|
2815
|
+
a.lag > 0 && d.push("".concat(y, "_").concat(m));
|
|
2809
2816
|
}
|
|
2810
2817
|
} catch (t) {
|
|
2811
|
-
|
|
2818
|
+
b.e(t);
|
|
2812
2819
|
} finally {
|
|
2813
|
-
|
|
2820
|
+
b.f();
|
|
2814
2821
|
}
|
|
2815
|
-
a.lag > 0 && t.lag(
|
|
2822
|
+
a.lag > 0 && t.lag(d, a.lag);
|
|
2816
2823
|
}
|
|
2817
2824
|
c.push(h);
|
|
2818
2825
|
}
|
|
@@ -2870,17 +2877,17 @@ var OHLCV_INDICATORS;
|
|
|
2870
2877
|
if (!u.hasOwnProperty(a)) throw new Error("Target property ".concat(a, " not found in verticalOhlcv for macd."));
|
|
2871
2878
|
var v = f.filter((function(t) {
|
|
2872
2879
|
return "macd" === t.key;
|
|
2873
|
-
})).length,
|
|
2880
|
+
})).length, d = v > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", b = a === Oe ? "".concat(d, "_diff") : "".concat(d, "_diff_").concat(a), m = a === Oe ? "".concat(d, "_dea") : "".concat(d, "_dea_").concat(a), g = a === Oe ? "".concat(d, "_histogram") : "".concat(d, "_histogram_").concat(a);
|
|
2874
2881
|
// Choose a display prefix based on the number of indicators.
|
|
2875
2882
|
h.push({
|
|
2876
|
-
fast:
|
|
2883
|
+
fast: b,
|
|
2877
2884
|
slow: m,
|
|
2878
2885
|
isDefault: !0
|
|
2879
2886
|
}), l.hasOwnProperty("macd") || (l.macd = {
|
|
2880
2887
|
numberOfIndicators: v,
|
|
2881
2888
|
settings: {}
|
|
2882
|
-
}), l.macd.settings[s] = new
|
|
2883
|
-
p.push(
|
|
2889
|
+
}), l.macd.settings[s] = new qt(new Dt(r), new Dt(n), new Dt(o)), Object.assign(u, me(me(me({}, b, ge(y)), m, ge(y)), g, ge(y))),
|
|
2890
|
+
p.push(b, m, g);
|
|
2884
2891
|
}
|
|
2885
2892
|
var w = l.macd, O = w.numberOfIndicators, S = w.settings, _ = O > 1 ? "macd_".concat(r, "_").concat(n, "_").concat(o) : "macd", j = a === Oe ? "".concat(_, "_diff") : "".concat(_, "_diff_").concat(a), P = a === Oe ? "".concat(_, "_dea") : "".concat(_, "_dea_").concat(a), A = a === Oe ? "".concat(_, "_histogram") : "".concat(_, "_histogram_").concat(a), E = S[s], M = u[a][e];
|
|
2886
2893
|
E.update(M, c);
|
|
@@ -2936,11 +2943,11 @@ var OHLCV_INDICATORS;
|
|
|
2936
2943
|
var i = o.height, a = o.range, u = o.scale, l = o.lag, c = o.autoMinMax, s = "".concat(r, "_").concat(n), f = t.verticalOhlcv, h = t.instances, y = t.len;
|
|
2937
2944
|
// Initialization: create output arrays and indicator instance on the first call.
|
|
2938
2945
|
if (0 === e) {
|
|
2939
|
-
var p = t.inputParams, v = t.priceBased,
|
|
2946
|
+
var p = t.inputParams, v = t.priceBased, d = t.nullArray, b = p.filter((function(t) {
|
|
2940
2947
|
return "donchianChannels" === t.key;
|
|
2941
|
-
})).length, m =
|
|
2948
|
+
})).length, m = b > 1 ? "donchian_channel_".concat(s) : "donchian_channel", g = [ "".concat(m, "_upper"), "".concat(m, "_basis"), "".concat(m, "_lower") ];
|
|
2942
2949
|
i && g.push("".concat(m, "_height")), h.hasOwnProperty("donchian_channel") || (h.donchian_channel = {
|
|
2943
|
-
numberOfIndicators:
|
|
2950
|
+
numberOfIndicators: b,
|
|
2944
2951
|
settings: {}
|
|
2945
2952
|
});
|
|
2946
2953
|
// Set up additional arrays for each range property.
|
|
@@ -2957,7 +2964,7 @@ var OHLCV_INDICATORS;
|
|
|
2957
2964
|
O.f();
|
|
2958
2965
|
}
|
|
2959
2966
|
var _ = Object.fromEntries(g.map((function(t) {
|
|
2960
|
-
return [ t, Ee(
|
|
2967
|
+
return [ t, Ee(d) ];
|
|
2961
2968
|
})));
|
|
2962
2969
|
Object.assign(f, function(t) {
|
|
2963
2970
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -3000,10 +3007,10 @@ var OHLCV_INDICATORS;
|
|
|
3000
3007
|
var T, I = Me(a);
|
|
3001
3008
|
try {
|
|
3002
3009
|
for (I.s(); !(T = I.n()).done; ) {
|
|
3003
|
-
var
|
|
3010
|
+
var C = T.value;
|
|
3004
3011
|
t.pushToMain({
|
|
3005
3012
|
index: e,
|
|
3006
|
-
key: "".concat(j, "_range_").concat(
|
|
3013
|
+
key: "".concat(j, "_range_").concat(C),
|
|
3007
3014
|
value: null
|
|
3008
3015
|
});
|
|
3009
3016
|
}
|
|
@@ -3015,14 +3022,14 @@ var OHLCV_INDICATORS;
|
|
|
3015
3022
|
return !0;
|
|
3016
3023
|
}
|
|
3017
3024
|
// **Update the maximum deque:**
|
|
3018
|
-
for (var
|
|
3019
|
-
for (;A.length &&
|
|
3025
|
+
for (var R = f.high, D = f.low; A.length && A[0] < k; ) A.shift();
|
|
3026
|
+
for (;A.length && R[A[A.length - 1]] <= R[M]; ) A.pop();
|
|
3020
3027
|
// **Update the minimum deque:**
|
|
3021
3028
|
for (A.push(M); E.length && E[0] < k; ) E.shift();
|
|
3022
3029
|
for (;E.length && D[E[E.length - 1]] >= D[M]; ) E.pop();
|
|
3023
3030
|
E.push(M);
|
|
3024
3031
|
// Retrieve computed values with safety checks.
|
|
3025
|
-
var V = A.length ?
|
|
3032
|
+
var V = A.length ? R[A[0]] : null, B = E.length ? D[E[0]] : null, N = "number" == typeof V && "number" == typeof B ? (V + B) / 2 : null;
|
|
3026
3033
|
// Process height if enabled.
|
|
3027
3034
|
if (
|
|
3028
3035
|
// Always push the main indicator values.
|
|
@@ -3051,12 +3058,12 @@ var OHLCV_INDICATORS;
|
|
|
3051
3058
|
var H, U = Me(a);
|
|
3052
3059
|
try {
|
|
3053
3060
|
for (U.s(); !(H = U.n()).done; ) {
|
|
3054
|
-
var
|
|
3055
|
-
"number" == typeof $ && "number" == typeof V && "number" == typeof B && V - B != 0 && (
|
|
3056
|
-
u && (
|
|
3061
|
+
var q = H.value, z = null, $ = f[q][e];
|
|
3062
|
+
"number" == typeof $ && "number" == typeof V && "number" == typeof B && V - B != 0 && (z = c ? Math.max(Math.min(($ - B) / (V - B), 1), 0) : ($ - B) / (V - B),
|
|
3063
|
+
u && (z = ne(z, u))), t.pushToMain({
|
|
3057
3064
|
index: e,
|
|
3058
|
-
key: "".concat(j, "_range_").concat(
|
|
3059
|
-
value:
|
|
3065
|
+
key: "".concat(j, "_range_").concat(q),
|
|
3066
|
+
value: z
|
|
3060
3067
|
});
|
|
3061
3068
|
}
|
|
3062
3069
|
} catch (t) {
|
|
@@ -3067,7 +3074,7 @@ var OHLCV_INDICATORS;
|
|
|
3067
3074
|
return !0;
|
|
3068
3075
|
},
|
|
3069
3076
|
bollingerBands: function(t, e, r, n, o) {
|
|
3070
|
-
var i, a, u, l, c, s, f, h = o.height, y = o.range, p = void 0 === y ? [] : y, v = o.target,
|
|
3077
|
+
var i, a, u, l, c, s, f, h = o.height, y = o.range, p = void 0 === y ? [] : y, v = o.target, d = o.scale, b = o.lag, m = o.autoMinMax, g = t.verticalOhlcv, w = t.instances, O = t.lastIndexReplace, S = "close" === v ? "" : "_".concat(v), _ = "".concat(r, "_").concat(n).concat(S);
|
|
3071
3078
|
// Initialization on the first call.
|
|
3072
3079
|
if (0 === e) {
|
|
3073
3080
|
var j = t.priceBased, P = t.inputParams, A = t.nullArray, E = t.verticalOhlcv;
|
|
@@ -3098,24 +3105,24 @@ var OHLCV_INDICATORS;
|
|
|
3098
3105
|
} finally {
|
|
3099
3106
|
T.f();
|
|
3100
3107
|
}
|
|
3101
|
-
var
|
|
3102
|
-
return [ t,
|
|
3108
|
+
var C = Object.fromEntries(x.map((function(t) {
|
|
3109
|
+
return [ t, Re(A) ];
|
|
3103
3110
|
})));
|
|
3104
3111
|
Object.assign(E, function(t) {
|
|
3105
3112
|
for (var e = 1; e < arguments.length; e++) {
|
|
3106
3113
|
var r = null != arguments[e] ? arguments[e] : {};
|
|
3107
3114
|
e % 2 ? Ie(Object(r), !0).forEach((function(e) {
|
|
3108
|
-
|
|
3115
|
+
Ce(t, e, r[e]);
|
|
3109
3116
|
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ie(Object(r)).forEach((function(e) {
|
|
3110
3117
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
3111
3118
|
}));
|
|
3112
3119
|
}
|
|
3113
3120
|
return t;
|
|
3114
|
-
}({},
|
|
3121
|
+
}({}, C)), b > 0 && t.lag(x, b), j.push("".concat(f, "_upper"), "".concat(f, "_middle"), "".concat(f, "_lower"));
|
|
3115
3122
|
}
|
|
3116
3123
|
// Derive prefix for subsequent calls if not set.
|
|
3117
3124
|
f || (f = w.bollinger_bands.numberOfIndicators > 1 ? "bollinger_bands_".concat(_) : "bollinger_bands".concat(S));
|
|
3118
|
-
var
|
|
3125
|
+
var R = f, D = w.bollinger_bands.settings[_], V = g[v][e];
|
|
3119
3126
|
// Update the indicator with the current value.
|
|
3120
3127
|
D.update(V, O);
|
|
3121
3128
|
// Attempt to retrieve the result.
|
|
@@ -3132,41 +3139,41 @@ var OHLCV_INDICATORS;
|
|
|
3132
3139
|
// Always push the indicator outputs.
|
|
3133
3140
|
t.pushToMain({
|
|
3134
3141
|
index: e,
|
|
3135
|
-
key: "".concat(
|
|
3142
|
+
key: "".concat(R, "_upper"),
|
|
3136
3143
|
value: N
|
|
3137
3144
|
}), t.pushToMain({
|
|
3138
3145
|
index: e,
|
|
3139
|
-
key: "".concat(
|
|
3146
|
+
key: "".concat(R, "_middle"),
|
|
3140
3147
|
value: L
|
|
3141
3148
|
}), t.pushToMain({
|
|
3142
3149
|
index: e,
|
|
3143
|
-
key: "".concat(
|
|
3150
|
+
key: "".concat(R, "_lower"),
|
|
3144
3151
|
value: H
|
|
3145
3152
|
}), h) {
|
|
3146
3153
|
var U = null;
|
|
3147
3154
|
"number" == typeof N && "number" == typeof H && 0 !== H && (U = ne((N - H) / H, .001)),
|
|
3148
3155
|
t.pushToMain({
|
|
3149
3156
|
index: e,
|
|
3150
|
-
key: "".concat(
|
|
3157
|
+
key: "".concat(R, "_height"),
|
|
3151
3158
|
value: U
|
|
3152
3159
|
});
|
|
3153
3160
|
}
|
|
3154
3161
|
// Process each range property.
|
|
3155
|
-
var
|
|
3162
|
+
var q, z = De(p);
|
|
3156
3163
|
try {
|
|
3157
|
-
for (
|
|
3158
|
-
var $ =
|
|
3164
|
+
for (z.s(); !(q = z.n()).done; ) {
|
|
3165
|
+
var $ = q.value, F = null, K = g[$][e];
|
|
3159
3166
|
"number" == typeof K && "number" == typeof H && "number" == typeof N && N - H != 0 && (F = m ? Math.max(Math.min((K - H) / (N - H), 1), 0) : (K - H) / (N - H),
|
|
3160
|
-
|
|
3167
|
+
d && (F = ne(F, d))), t.pushToMain({
|
|
3161
3168
|
index: e,
|
|
3162
|
-
key: "".concat(
|
|
3169
|
+
key: "".concat(R, "_range_").concat($),
|
|
3163
3170
|
value: F
|
|
3164
3171
|
});
|
|
3165
3172
|
}
|
|
3166
3173
|
} catch (t) {
|
|
3167
|
-
|
|
3174
|
+
z.e(t);
|
|
3168
3175
|
} finally {
|
|
3169
|
-
|
|
3176
|
+
z.f();
|
|
3170
3177
|
}
|
|
3171
3178
|
return !0;
|
|
3172
3179
|
},
|
|
@@ -3187,19 +3194,19 @@ var OHLCV_INDICATORS;
|
|
|
3187
3194
|
}
|
|
3188
3195
|
var y = u[s], p = y.fastEMA, v = y.slowEMA;
|
|
3189
3196
|
p.update(c, l), v.update(c, l);
|
|
3190
|
-
var
|
|
3197
|
+
var d = null, b = null;
|
|
3191
3198
|
try {
|
|
3192
|
-
|
|
3199
|
+
d = p.getResult();
|
|
3193
3200
|
} catch (t) {
|
|
3194
|
-
|
|
3201
|
+
d = null;
|
|
3195
3202
|
}
|
|
3196
3203
|
try {
|
|
3197
|
-
|
|
3204
|
+
b = v.getResult();
|
|
3198
3205
|
} catch (t) {
|
|
3199
|
-
|
|
3206
|
+
b = null;
|
|
3200
3207
|
}
|
|
3201
3208
|
var m = null;
|
|
3202
|
-
return "number" == typeof
|
|
3209
|
+
return "number" == typeof d && "number" == typeof b && 0 !== b && (m = 100 * (d - b) / b,
|
|
3203
3210
|
i && (m = ne(m, i))), t.pushToMain({
|
|
3204
3211
|
index: e,
|
|
3205
3212
|
key: s,
|
|
@@ -3207,76 +3214,74 @@ var OHLCV_INDICATORS;
|
|
|
3207
3214
|
}), !0;
|
|
3208
3215
|
},
|
|
3209
3216
|
candleVectors: function(t, e, r, n) {
|
|
3210
|
-
var o = n.
|
|
3211
|
-
return ce(t, e, u, l);
|
|
3212
|
-
};
|
|
3217
|
+
var o = n.patternSize, i = n.lag, a = n.autoMinMax, u = t.verticalOhlcv, l = t.instances, c = t.lastIndexReplace;
|
|
3213
3218
|
if (0 === e) {
|
|
3214
|
-
for (var
|
|
3215
|
-
var
|
|
3219
|
+
for (var s = t.nullArray, f = [ [ "close", "open" ], [ "close", "high" ], [ "close", "low" ], [ "open", "high" ], [ "open", "low" ], [ "high", "low" ] ], h = [ [ "open", "open" ], [ "high", "high" ], [ "low", "low" ], [ "close", "close" ] ].concat(f), y = [], p = {}, v = 0; v < o; v++) {
|
|
3220
|
+
var d, b = Ke(h);
|
|
3216
3221
|
try {
|
|
3217
|
-
for (
|
|
3218
|
-
var
|
|
3219
|
-
|
|
3220
|
-
|
|
3222
|
+
for (b.s(); !(d = b.n()).done; ) {
|
|
3223
|
+
var m = Fe(d.value, 2), g = m[0], w = m[1];
|
|
3224
|
+
y.push("candle_change_".concat(v + 1, "_").concat(g, "_").concat(w)), p["candle_change_".concat(v + 1, "_").concat(g, "_").concat(w)] = $e(s),
|
|
3225
|
+
a && t.autoMinMaxKeys.push("candle_change_".concat(v + 1, "_").concat(g, "_").concat(w));
|
|
3221
3226
|
}
|
|
3222
3227
|
} catch (t) {
|
|
3223
|
-
|
|
3228
|
+
b.e(t);
|
|
3224
3229
|
} finally {
|
|
3225
|
-
|
|
3230
|
+
b.f();
|
|
3226
3231
|
}
|
|
3227
3232
|
}
|
|
3228
|
-
for (var
|
|
3229
|
-
var
|
|
3230
|
-
|
|
3231
|
-
|
|
3233
|
+
for (var O = [], S = {}, _ = 0, j = f; _ < j.length; _++) {
|
|
3234
|
+
var P = Fe(j[_], 2), A = P[0], E = P[1];
|
|
3235
|
+
O.push("candle_body_".concat(A, "_").concat(E)), S["candle_body_".concat(A, "_").concat(E)] = $e(s),
|
|
3236
|
+
a && t.autoMinMaxKeys.push("candle_body_".concat(A, "_").concat(E));
|
|
3232
3237
|
}
|
|
3233
|
-
var
|
|
3234
|
-
Object.assign(
|
|
3238
|
+
var M = [].concat(O, y);
|
|
3239
|
+
Object.assign(u, qe(qe({}, S), p)), Object.assign(l, {
|
|
3235
3240
|
candleVectors: {
|
|
3236
|
-
bodyVectors:
|
|
3237
|
-
lookBackVectors:
|
|
3238
|
-
keyNames:
|
|
3239
|
-
|
|
3241
|
+
bodyVectors: f,
|
|
3242
|
+
lookBackVectors: h,
|
|
3243
|
+
keyNames: M,
|
|
3244
|
+
arrayChunk: qe({}, Object.fromEntries(M.map((function(t) {
|
|
3245
|
+
return [ t, [] ];
|
|
3246
|
+
}))))
|
|
3240
3247
|
}
|
|
3241
|
-
}),
|
|
3242
|
-
}
|
|
3243
|
-
if (0 === e) return !0;
|
|
3244
|
-
var I = s.candleVectors, R = I.bodyVectors, C = I.lookBackVectors, D = I.bodyInstance, V = null, B = c.open[e], N = c.close[e], L = We(N, B);
|
|
3245
|
-
// Update instances with current absolute values
|
|
3246
|
-
D.update(Math.abs(L), f);
|
|
3247
|
-
try {
|
|
3248
|
-
V = D.getResult();
|
|
3249
|
-
} catch (t) {
|
|
3250
|
-
// If there's not enough data, means remain null
|
|
3248
|
+
}), i > 0 && t.lag(M, i);
|
|
3251
3249
|
}
|
|
3252
|
-
for (var
|
|
3253
|
-
var
|
|
3250
|
+
for (var x = l.candleVectors, k = x.bodyVectors, T = x.lookBackVectors, I = x.arrayChunk, C = 0; C < k.length; C++) {
|
|
3251
|
+
var R = Fe(k[C], 2), D = R[0], V = R[1], B = u[D][e], N = u[V][e], L = "candle_body_".concat(D, "_").concat(V), H = We(B, N), U = Ye(I, L, r, H, c);
|
|
3254
3252
|
t.pushToMain({
|
|
3255
3253
|
index: e,
|
|
3256
|
-
key:
|
|
3257
|
-
value:
|
|
3254
|
+
key: L,
|
|
3255
|
+
value: U
|
|
3258
3256
|
});
|
|
3259
3257
|
}
|
|
3260
|
-
for (var
|
|
3261
|
-
var
|
|
3258
|
+
for (var q = 0; q < o; q++) {
|
|
3259
|
+
var z, $ = Ke(T);
|
|
3262
3260
|
try {
|
|
3263
|
-
for (
|
|
3264
|
-
var
|
|
3265
|
-
|
|
3261
|
+
for ($.s(); !(z = $.n()).done; ) {
|
|
3262
|
+
var F = Fe(z.value, 2), K = F[0], G = F[1], J = u[K][e], W = u[G][e - (q + 1)], Y = "candle_change_".concat(q + 1, "_").concat(K, "_").concat(G);
|
|
3263
|
+
if (void 0 !== W) {
|
|
3264
|
+
var Q = We(J, W), X = Ye(I, Y, r, Q, c);
|
|
3265
|
+
t.pushToMain({
|
|
3266
|
+
index: e,
|
|
3267
|
+
key: Y,
|
|
3268
|
+
value: X
|
|
3269
|
+
});
|
|
3270
|
+
} else t.pushToMain({
|
|
3266
3271
|
index: e,
|
|
3267
|
-
key:
|
|
3268
|
-
value:
|
|
3272
|
+
key: Y,
|
|
3273
|
+
value: null
|
|
3269
3274
|
});
|
|
3270
3275
|
}
|
|
3271
3276
|
} catch (t) {
|
|
3272
|
-
|
|
3277
|
+
$.e(t);
|
|
3273
3278
|
} finally {
|
|
3274
|
-
|
|
3279
|
+
$.f();
|
|
3275
3280
|
}
|
|
3276
3281
|
}
|
|
3277
3282
|
return !0;
|
|
3278
3283
|
}
|
|
3279
|
-
},
|
|
3284
|
+
}, Er = function(t, e, r) {
|
|
3280
3285
|
var n = function(t) {
|
|
3281
3286
|
return r > 1 ? t * r : t;
|
|
3282
3287
|
};
|
|
@@ -3287,9 +3292,9 @@ var OHLCV_INDICATORS;
|
|
|
3287
3292
|
}
|
|
3288
3293
|
return 0;
|
|
3289
3294
|
// Optionally: throw an error if type is not recognized
|
|
3290
|
-
},
|
|
3295
|
+
}, Mr = function(t, e) {
|
|
3291
3296
|
return "number" === e ? t : "string" === e ? Number(oe(t)) : 0;
|
|
3292
|
-
},
|
|
3297
|
+
}, xr = function(t, e) {
|
|
3293
3298
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, o = e.len, i = e.inputParams, a = e.hasVolume;
|
|
3294
3299
|
//do not move nullArray from here
|
|
3295
3300
|
e.nullArray = new Array(o).fill(null);
|
|
@@ -3320,14 +3325,14 @@ var OHLCV_INDICATORS;
|
|
|
3320
3325
|
i.f();
|
|
3321
3326
|
}
|
|
3322
3327
|
}(e), u.forEach((function(t) {
|
|
3323
|
-
e.verticalOhlcv[t] =
|
|
3328
|
+
e.verticalOhlcv[t] = Sr(e.nullArray);
|
|
3324
3329
|
}));
|
|
3325
3330
|
// Identify any additional keys from the first input row and initialize them
|
|
3326
3331
|
var c = Object.keys(t[0]).filter((function(t) {
|
|
3327
3332
|
return !l.has(t);
|
|
3328
3333
|
}));
|
|
3329
3334
|
c.forEach((function(t) {
|
|
3330
|
-
e.verticalOhlcv[t] =
|
|
3335
|
+
e.verticalOhlcv[t] = Sr(e.nullArray);
|
|
3331
3336
|
})), e.otherKeys = c,
|
|
3332
3337
|
// Set the input types once using the first row
|
|
3333
3338
|
function(t, e) {
|
|
@@ -3341,7 +3346,7 @@ var OHLCV_INDICATORS;
|
|
|
3341
3346
|
e.inputTypes[o] = "string", i = oe(i);
|
|
3342
3347
|
}
|
|
3343
3348
|
if (0 === e.precisionMultiplier && !0 === e.precision) {
|
|
3344
|
-
var a =
|
|
3349
|
+
var a = _r(String(i).split("."), 2)[1], u = void 0 === a ? "" : a, l = Math.max(4, u.length);
|
|
3345
3350
|
e.precisionMultiplier = l > 1 ? Math.pow(10, l - 1) : 1;
|
|
3346
3351
|
}
|
|
3347
3352
|
}
|
|
@@ -3354,12 +3359,12 @@ var OHLCV_INDICATORS;
|
|
|
3354
3359
|
var e = t.key, r = t.params;
|
|
3355
3360
|
return {
|
|
3356
3361
|
key: e,
|
|
3357
|
-
fn:
|
|
3362
|
+
fn: Ar[e],
|
|
3358
3363
|
args: r
|
|
3359
3364
|
};
|
|
3360
3365
|
})) : [];
|
|
3361
3366
|
}(i), f = n; f < o; f++) {
|
|
3362
|
-
var h = t[f], y = h.open, p = h.high, v = h.low,
|
|
3367
|
+
var h = t[f], y = h.open, p = h.high, v = h.low, d = h.close, b = Or(h, gr), m = e.precisionMultiplier, g = Er(y, e.inputTypes.open, m), w = Er(p, e.inputTypes.high, m), O = Er(v, e.inputTypes.low, m), S = Er(d, e.inputTypes.close, m);
|
|
3363
3368
|
// Destructure the base keys and use the rest for other properties
|
|
3364
3369
|
//sets volume to 0
|
|
3365
3370
|
if (e.pushToMain({
|
|
@@ -3379,22 +3384,22 @@ var OHLCV_INDICATORS;
|
|
|
3379
3384
|
key: "close",
|
|
3380
3385
|
value: S
|
|
3381
3386
|
}), a) {
|
|
3382
|
-
var _ = h.volume, j =
|
|
3387
|
+
var _ = h.volume, j = Mr(_, e.inputTypes.volume);
|
|
3383
3388
|
e.pushToMain({
|
|
3384
3389
|
index: f,
|
|
3385
3390
|
key: "volume",
|
|
3386
3391
|
value: j
|
|
3387
3392
|
});
|
|
3388
|
-
} else delete
|
|
3393
|
+
} else delete b.volume;
|
|
3389
3394
|
// Populate any extra keys identified during initialization
|
|
3390
|
-
var P, A =
|
|
3395
|
+
var P, A = wr(e.otherKeys);
|
|
3391
3396
|
try {
|
|
3392
3397
|
for (A.s(); !(P = A.n()).done; ) {
|
|
3393
3398
|
var E = P.value;
|
|
3394
3399
|
e.pushToMain({
|
|
3395
3400
|
index: f,
|
|
3396
3401
|
key: E,
|
|
3397
|
-
value:
|
|
3402
|
+
value: b[E]
|
|
3398
3403
|
});
|
|
3399
3404
|
}
|
|
3400
3405
|
// Run all indicator functions except for the ones processed later
|
|
@@ -3403,11 +3408,11 @@ var OHLCV_INDICATORS;
|
|
|
3403
3408
|
} finally {
|
|
3404
3409
|
A.f();
|
|
3405
3410
|
}
|
|
3406
|
-
var M, x =
|
|
3411
|
+
var M, x = wr(s);
|
|
3407
3412
|
try {
|
|
3408
3413
|
for (x.s(); !(M = x.n()).done; ) {
|
|
3409
|
-
var k = M.value, T = k.key, I = k.fn,
|
|
3410
|
-
[ "crossPairs", "lag" ].includes(T) || I.apply(void 0, [ e, f ].concat(
|
|
3414
|
+
var k = M.value, T = k.key, I = k.fn, C = k.args;
|
|
3415
|
+
[ "crossPairs", "lag" ].includes(T) || I.apply(void 0, [ e, f ].concat(Sr(C)));
|
|
3411
3416
|
}
|
|
3412
3417
|
// Process these indicators separately (ensuring their execution order)
|
|
3413
3418
|
} catch (t) {
|
|
@@ -3415,9 +3420,9 @@ var OHLCV_INDICATORS;
|
|
|
3415
3420
|
} finally {
|
|
3416
3421
|
x.f();
|
|
3417
3422
|
}
|
|
3418
|
-
|
|
3423
|
+
nr(e, f), yr(e, f), e.lastComputedIndex++;
|
|
3419
3424
|
}
|
|
3420
|
-
},
|
|
3425
|
+
}, kr = function(t, e) {
|
|
3421
3426
|
for (var r = t.length, n = new nt(e), o = new Array(r), i = 0, a = 0, u = 0, l = 0; l < r; l++) if (n.update(t[l]),
|
|
3422
3427
|
n.isStable) {
|
|
3423
3428
|
var c = n.getResult();
|
|
@@ -3427,10 +3432,10 @@ var OHLCV_INDICATORS;
|
|
|
3427
3432
|
return o.map((function(t) {
|
|
3428
3433
|
return null !== t ? (t - s) / h : null;
|
|
3429
3434
|
}));
|
|
3430
|
-
},
|
|
3435
|
+
}, Tr = function(t, e) {
|
|
3431
3436
|
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5;
|
|
3432
3437
|
if (t.length !== e.length) throw new Error("Both arrays must have the same length");
|
|
3433
|
-
for (var n =
|
|
3438
|
+
for (var n = kr(t, r), o = kr(e, r), i = t.length, a = [], u = 0, l = 0, c = 0, s = 0, f = 0, h = 0, y = -1, p = 0; p < i; p++) {
|
|
3434
3439
|
if (null !== n[p] && null !== o[p]) {
|
|
3435
3440
|
y = p;
|
|
3436
3441
|
break;
|
|
@@ -3441,8 +3446,8 @@ var OHLCV_INDICATORS;
|
|
|
3441
3446
|
// No valid data points
|
|
3442
3447
|
return new Array(i).fill(0);
|
|
3443
3448
|
for (var v = y; v < i; v++) {
|
|
3444
|
-
var
|
|
3445
|
-
if (null !==
|
|
3449
|
+
var d = n[v], b = o[v];
|
|
3450
|
+
if (null !== d && null !== b) if (u += d, l += b, c += d * b, s += d * d, f += b * b,
|
|
3446
3451
|
++h < 2) a.push(0); else {
|
|
3447
3452
|
var m = h * c - u * l, g = Math.sqrt((h * s - u * u) * (h * f - l * l)), w = 0 === g ? 0 : m / g;
|
|
3448
3453
|
a.push(w);
|
|
@@ -3454,21 +3459,21 @@ var OHLCV_INDICATORS;
|
|
|
3454
3459
|
};
|
|
3455
3460
|
// Processes the inputParams into a list of indicator calls
|
|
3456
3461
|
// ./index.js
|
|
3457
|
-
function
|
|
3462
|
+
function Ir(t) {
|
|
3458
3463
|
return function(t) {
|
|
3459
|
-
if (Array.isArray(t)) return
|
|
3464
|
+
if (Array.isArray(t)) return Vr(t);
|
|
3460
3465
|
}(t) || function(t) {
|
|
3461
3466
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
|
|
3462
|
-
}(t) ||
|
|
3467
|
+
}(t) || Dr(t) || function() {
|
|
3463
3468
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3464
3469
|
}();
|
|
3465
3470
|
}
|
|
3466
|
-
function
|
|
3467
|
-
return
|
|
3471
|
+
function Cr(t) {
|
|
3472
|
+
return Cr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
3468
3473
|
return typeof t;
|
|
3469
3474
|
} : function(t) {
|
|
3470
3475
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
3471
|
-
},
|
|
3476
|
+
}, Cr(t);
|
|
3472
3477
|
}
|
|
3473
3478
|
function Rr(t, e) {
|
|
3474
3479
|
return function(t) {
|
|
@@ -3493,36 +3498,36 @@ var OHLCV_INDICATORS;
|
|
|
3493
3498
|
}
|
|
3494
3499
|
return u;
|
|
3495
3500
|
}
|
|
3496
|
-
}(t, e) ||
|
|
3501
|
+
}(t, e) || Dr(t, e) || function() {
|
|
3497
3502
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3498
3503
|
}();
|
|
3499
3504
|
}
|
|
3500
|
-
function
|
|
3505
|
+
function Dr(t, e) {
|
|
3501
3506
|
if (t) {
|
|
3502
|
-
if ("string" == typeof t) return
|
|
3507
|
+
if ("string" == typeof t) return Vr(t, e);
|
|
3503
3508
|
var r = {}.toString.call(t).slice(8, -1);
|
|
3504
|
-
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) ?
|
|
3509
|
+
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;
|
|
3505
3510
|
}
|
|
3506
3511
|
}
|
|
3507
|
-
function
|
|
3512
|
+
function Vr(t, e) {
|
|
3508
3513
|
(null == e || e > t.length) && (e = t.length);
|
|
3509
3514
|
for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
|
|
3510
3515
|
return n;
|
|
3511
3516
|
}
|
|
3512
|
-
function
|
|
3517
|
+
function Br(t, e) {
|
|
3513
3518
|
for (var r = 0; r < e.length; r++) {
|
|
3514
3519
|
var n = e[r];
|
|
3515
3520
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
|
|
3516
|
-
Object.defineProperty(t,
|
|
3521
|
+
Object.defineProperty(t, Nr(n.key), n);
|
|
3517
3522
|
}
|
|
3518
3523
|
}
|
|
3519
|
-
function
|
|
3524
|
+
function Nr(t) {
|
|
3520
3525
|
var e = function(t, e) {
|
|
3521
|
-
if ("object" !=
|
|
3526
|
+
if ("object" != Cr(t) || !t) return t;
|
|
3522
3527
|
var r = t[Symbol.toPrimitive];
|
|
3523
3528
|
if (void 0 !== r) {
|
|
3524
3529
|
var n = r.call(t, e || "default");
|
|
3525
|
-
if ("object" !=
|
|
3530
|
+
if ("object" != Cr(n)) return n;
|
|
3526
3531
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3527
3532
|
}
|
|
3528
3533
|
return ("string" === e ? String : Number)(t);
|
|
@@ -3535,9 +3540,9 @@ var OHLCV_INDICATORS;
|
|
|
3535
3540
|
* to parallel compute various technical indicators in 1 single loop.
|
|
3536
3541
|
* OHLCV datasets.
|
|
3537
3542
|
*/ (t, "string");
|
|
3538
|
-
return "symbol" ==
|
|
3543
|
+
return "symbol" == Cr(e) ? e : e + "";
|
|
3539
3544
|
}
|
|
3540
|
-
var
|
|
3545
|
+
var Lr = [ .001, .002, .0025, .005, .01, .02, .025, .05, .1, .2, .25, .5, 1, 2, 2.5, 5, 10 ], Hr = function() {
|
|
3541
3546
|
return t = function t(e) {
|
|
3542
3547
|
var r = this, n = e.input, o = e.ticker, i = void 0 === o ? null : o, a = e.precision, u = void 0 === a || a, l = e.inputParams, c = void 0 === l ? null : l;
|
|
3543
3548
|
if (function(t, e) {
|
|
@@ -3560,7 +3565,7 @@ var OHLCV_INDICATORS;
|
|
|
3560
3565
|
}, this.priceBased = [ "open", "high", "low", "close" ], this.len = n.length, this.lastIndexReplace = !1,
|
|
3561
3566
|
this.instances = {}, this.crossPairsList = [], this.verticalOhlcv = {}, this.studies = {},
|
|
3562
3567
|
this.utilities = {
|
|
3563
|
-
correlation:
|
|
3568
|
+
correlation: Tr
|
|
3564
3569
|
}, this.invalidValueIndex = -1, this.precision = u, this.precisionMultiplier = !0 === this.precision ? 0 : 1,
|
|
3565
3570
|
this.autoMinMaxKeys = [], this.minMaxRanges = {}, Array.isArray(c) && (this.inputParams = c,
|
|
3566
3571
|
this.compute()), this.inputParams = [], this.pushToMain = function(t) {
|
|
@@ -3582,8 +3587,8 @@ var OHLCV_INDICATORS;
|
|
|
3582
3587
|
min: -1,
|
|
3583
3588
|
max: 1
|
|
3584
3589
|
}); else if (n.startsWith("candle_") && y) u[n] = {
|
|
3585
|
-
min: -
|
|
3586
|
-
max:
|
|
3590
|
+
min: -3,
|
|
3591
|
+
max: 3
|
|
3587
3592
|
}; else if (n.includes("_range_") && y) u[n] = {
|
|
3588
3593
|
min: 0,
|
|
3589
3594
|
max: 1
|
|
@@ -3674,7 +3679,7 @@ var OHLCV_INDICATORS;
|
|
|
3674
3679
|
//compute method can be used to process indicators if no arguments are provided
|
|
3675
3680
|
//compute method can be called to access the .verticalOhlcv object
|
|
3676
3681
|
//compute method is called automatically if getLastValues or getDate methods are called
|
|
3677
|
-
this.len > this.lastComputedIndex && !t &&
|
|
3682
|
+
this.len > this.lastComputedIndex && !t && xr(this.input, this, 0), t && "object" === Cr(t)) {
|
|
3678
3683
|
var e;
|
|
3679
3684
|
if (![ "open", "high", "low", "close", "volume", "date" ].every((function(e) {
|
|
3680
3685
|
return Object.keys(t).includes(e);
|
|
@@ -3685,16 +3690,16 @@ var OHLCV_INDICATORS;
|
|
|
3685
3690
|
//fallback if .compute(change) is triggered before .compute() alone
|
|
3686
3691
|
0 === this.lastComputedIndex && this.compute(), i !== r ? (
|
|
3687
3692
|
// Add new item
|
|
3688
|
-
this.len++, this.input.push(t),
|
|
3693
|
+
this.len++, this.input.push(t), xr(this.input, this, this.len)) : (
|
|
3689
3694
|
// Modify the last item
|
|
3690
|
-
this.input[n] = t,
|
|
3695
|
+
this.input[n] = t, xr(this.input, this, n));
|
|
3691
3696
|
}
|
|
3692
3697
|
return this;
|
|
3693
3698
|
}
|
|
3694
3699
|
}, {
|
|
3695
3700
|
key: "crossPairs",
|
|
3696
3701
|
value: function(t) {
|
|
3697
|
-
return i(this), this.crossPairsList = [].concat(
|
|
3702
|
+
return i(this), this.crossPairsList = [].concat(Ir(this.crossPairsList), Ir(t)),
|
|
3698
3703
|
this.inputParams.push({
|
|
3699
3704
|
key: "crossPairs",
|
|
3700
3705
|
params: [ this.crossPairsList ]
|
|
@@ -3725,7 +3730,7 @@ var OHLCV_INDICATORS;
|
|
|
3725
3730
|
if (!1 === this.hasVolume) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
|
|
3726
3731
|
i(this);
|
|
3727
3732
|
var r = e.scale, n = void 0 === r ? null : r;
|
|
3728
|
-
if ("number" == typeof n && !
|
|
3733
|
+
if ("number" == typeof n && !Lr.includes(n)) throw new Error('"scale" value in relativeVolume must be any of the following numbers: '.concat(Lr.join(", ")));
|
|
3729
3734
|
return this.inputParams.push({
|
|
3730
3735
|
key: "relativeVolume",
|
|
3731
3736
|
params: [ t, {
|
|
@@ -3738,7 +3743,7 @@ var OHLCV_INDICATORS;
|
|
|
3738
3743
|
value: function(t) {
|
|
3739
3744
|
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3740
3745
|
i(this);
|
|
3741
|
-
var r =
|
|
3746
|
+
var r = de("ema", t, e, Lr);
|
|
3742
3747
|
return this.inputParams.push({
|
|
3743
3748
|
key: "movingAverages",
|
|
3744
3749
|
params: [ "ema", t, r ]
|
|
@@ -3749,7 +3754,7 @@ var OHLCV_INDICATORS;
|
|
|
3749
3754
|
value: function(t) {
|
|
3750
3755
|
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3751
3756
|
i(this);
|
|
3752
|
-
var r =
|
|
3757
|
+
var r = de("sma", t, e, Lr);
|
|
3753
3758
|
return this.inputParams.push({
|
|
3754
3759
|
key: "movingAverages",
|
|
3755
3760
|
params: [ "sma", t, r ]
|
|
@@ -3762,7 +3767,7 @@ var OHLCV_INDICATORS;
|
|
|
3762
3767
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"fast" must be a positive number in macd.');
|
|
3763
3768
|
if ("number" != typeof e || e <= t) throw new Error('"slow" must be a positive number greater than "fast" in macd.');
|
|
3764
3769
|
if ("number" != typeof r || r <= 0) throw new Error('"signal" must be a positive number in macd.');
|
|
3765
|
-
if ("object" !==
|
|
3770
|
+
if ("object" !== Cr(n)) throw new Error('"options" must be an object in macd. eg: {target}');
|
|
3766
3771
|
var o = n.target, a = void 0 === o ? "close" : o;
|
|
3767
3772
|
return this.inputParams.push({
|
|
3768
3773
|
key: "macd",
|
|
@@ -3775,7 +3780,7 @@ var OHLCV_INDICATORS;
|
|
|
3775
3780
|
key: "bollingerBands",
|
|
3776
3781
|
value: function() {
|
|
3777
3782
|
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] : {};
|
|
3778
|
-
if (i(this), !r || "object" !==
|
|
3783
|
+
if (i(this), !r || "object" !== Cr(r)) throw new Error('"options" must be an object in bollingerBands. eg: {target, height, range}');
|
|
3779
3784
|
var n = r.target, o = void 0 === n ? "close" : n, a = r.height, u = void 0 !== a && a, l = r.range, c = void 0 === l ? [] : l, s = r.scale, f = void 0 === s ? null : s, h = r.lag, y = void 0 === h ? 0 : h, p = r.autoMinMax, v = void 0 !== p && p;
|
|
3780
3785
|
// Validate size and times
|
|
3781
3786
|
if ("number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in bollingerBands.');
|
|
@@ -3784,7 +3789,7 @@ var OHLCV_INDICATORS;
|
|
|
3784
3789
|
if ("number" != typeof y) throw new Error('"lag" value must be a number in bollingerBands.');
|
|
3785
3790
|
if ("boolean" != typeof v) throw new Error('"autoMinMax" value in rsi must be a number in bollingerBands.');
|
|
3786
3791
|
if ("boolean" != typeof u) throw new Error('"height" must be a boolean in bollingerBands.');
|
|
3787
|
-
if ("number" == typeof f && !
|
|
3792
|
+
if ("number" == typeof f && !Lr.includes(f)) throw new Error('"scale" value in bollingerBands must be any of the following numbers: '.concat(Lr.join(", ")));
|
|
3788
3793
|
return this.inputParams.push({
|
|
3789
3794
|
key: "bollingerBands",
|
|
3790
3795
|
params: [ t, e, {
|
|
@@ -3804,7 +3809,7 @@ var OHLCV_INDICATORS;
|
|
|
3804
3809
|
// Validate size and times
|
|
3805
3810
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in rsi.');
|
|
3806
3811
|
var r = e.scale, n = void 0 === r ? null : r, o = e.target, a = void 0 === o ? "close" : o, u = e.lag, l = void 0 === u ? 0 : u, c = e.autoMinMax, s = void 0 !== c && c;
|
|
3807
|
-
if ("number" == typeof n && !
|
|
3812
|
+
if ("number" == typeof n && !Lr.includes(n)) throw new Error('"scale" value in rsi must be any of the following numbers: '.concat(Lr.join(", ")));
|
|
3808
3813
|
if ("number" != typeof l) throw new Error('"lag" value in rsi must be a number in rsi.');
|
|
3809
3814
|
if ("boolean" != typeof s) throw new Error('"autoMinMax" value in rsi must be a number in rsi.');
|
|
3810
3815
|
return this.inputParams.push({
|
|
@@ -3828,7 +3833,7 @@ var OHLCV_INDICATORS;
|
|
|
3828
3833
|
if ("number" != typeof f) throw new Error('"lag" value in rsi must be a number in donchianChannels.');
|
|
3829
3834
|
if ("boolean" != typeof y) throw new Error('"autoMinMax" value in rsi must be a number in donchianChannels.');
|
|
3830
3835
|
if ("boolean" != typeof o) throw new Error('"height" must be a boolean in donchianChannels.');
|
|
3831
|
-
if ("number" == typeof c && !
|
|
3836
|
+
if ("number" == typeof c && !Lr.includes(c)) throw new Error('"scale" value in donchianChannels must be any of the following numbers: '.concat(Lr.join(", ")));
|
|
3832
3837
|
return this.inputParams.push({
|
|
3833
3838
|
key: "donchianChannels",
|
|
3834
3839
|
params: [ t, e, {
|
|
@@ -3845,10 +3850,10 @@ var OHLCV_INDICATORS;
|
|
|
3845
3850
|
value: function() {
|
|
3846
3851
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 200, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3847
3852
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number greater than 0 in candleVectors.');
|
|
3848
|
-
var r = e.stdDev, n = void 0 === r ? 1 : r, o = e.lag, a = void 0 === o ? 0 : o, u = e.scale, l = void 0 === u ? .
|
|
3853
|
+
var r = e.stdDev, n = void 0 === r ? 1 : r, o = e.lag, a = void 0 === o ? 0 : o, u = e.scale, l = void 0 === u ? .001 : u, c = e.patternSize, s = void 0 === c ? 0 : c, f = e.autoMinMax, h = void 0 !== f && f;
|
|
3849
3854
|
if ("number" != typeof n || n <= 0) throw new Error('"stdDev" must be a positive number greater than 0 in candleVectors.');
|
|
3850
|
-
if ("number" == typeof l && !
|
|
3851
|
-
if ("number" != typeof s || !Number.isInteger(s) || s <
|
|
3855
|
+
if ("number" == typeof l && !Lr.includes(l)) throw new Error('"scale" value in candleVectors must be any of the following numbers: '.concat(Lr.join(", ")));
|
|
3856
|
+
if ("number" != typeof s || !Number.isInteger(s) || s < 0) throw new Error('"patternSize" value in candleVectors must be a positive integer.');
|
|
3852
3857
|
if ("boolean" != typeof h) throw new Error('"autoMinMax" value in candleVectors must be boolean');
|
|
3853
3858
|
return this.inputParams.push({
|
|
3854
3859
|
key: "candleVectors",
|
|
@@ -3869,7 +3874,7 @@ var OHLCV_INDICATORS;
|
|
|
3869
3874
|
if (i(this), "number" != typeof t || t <= 1) throw new Error('fastSize" must be a positive number greater than 1 in volumeOscillator.');
|
|
3870
3875
|
if ("number" != typeof e || e <= t) throw new Error('"slowSize" must be a positive number greater than the "fastSize" in volumeOscillator.');
|
|
3871
3876
|
var n = r.scale, o = void 0 === n ? null : n;
|
|
3872
|
-
if ("number" == typeof o && !
|
|
3877
|
+
if ("number" == typeof o && !Lr.includes(o)) throw new Error('"scale" value in volumeOscillator must be any of the following numbers: '.concat(Lr.join(", ")));
|
|
3873
3878
|
return this.inputParams.push({
|
|
3874
3879
|
key: "volumeOscillator",
|
|
3875
3880
|
params: [ t, e, {
|
|
@@ -3893,7 +3898,7 @@ var OHLCV_INDICATORS;
|
|
|
3893
3898
|
params: []
|
|
3894
3899
|
}), this;
|
|
3895
3900
|
}
|
|
3896
|
-
} ], e &&
|
|
3901
|
+
} ], e && Br(t.prototype, e), r && Br(t, r), Object.defineProperty(t, "prototype", {
|
|
3897
3902
|
writable: !1
|
|
3898
3903
|
}), t;
|
|
3899
3904
|
var t, e, r;
|