ohlcv-indicators 3.2.6 → 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 +273 -263
- package/index.js +3 -3
- package/package.json +1 -1
- package/src/studies/candleVectors.js +46 -36
- package/src/utilities/pushToMain.js +8 -6
|
@@ -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);
|
|
@@ -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,7 +1098,7 @@ var OHLCV_INDICATORS;
|
|
|
1098
1098
|
if (void 0 === this.result && void 0 !== r) return this.setResult(r, e);
|
|
1099
1099
|
}
|
|
1100
1100
|
} ]);
|
|
1101
|
-
}(
|
|
1101
|
+
}(C);
|
|
1102
1102
|
function dt(t) {
|
|
1103
1103
|
return t.length ? t.reduce((function(t, e) {
|
|
1104
1104
|
return t + e;
|
|
@@ -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) {
|
|
@@ -1586,7 +1586,7 @@ var OHLCV_INDICATORS;
|
|
|
1586
1586
|
// Validate that value and bollingerBands are not null/undefined
|
|
1587
1587
|
if (null == t || null == e) return null;
|
|
1588
1588
|
var o = t >= 0, i = Math.abs(t), a = e.upper, u = e.lower, l = ne((i - u) / (a - u), r);
|
|
1589
|
-
return n ? o ? Math.min(l, 1) : Math.max(-l, -1) : o ? l : -l;
|
|
1589
|
+
return 0 === l ? o ? .01 : -.01 : n ? o ? Math.min(l, 1) : Math.max(-l, -1) : o ? l : -l;
|
|
1590
1590
|
};
|
|
1591
1591
|
// ./src/moving-averages/movingAverages.js
|
|
1592
1592
|
function se(t) {
|
|
@@ -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,38 +2229,38 @@ 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
2266
|
var d = f.value;
|
|
@@ -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,7 +2484,7 @@ 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
2489
|
var y = void 0, p = void 0, v = void 0, d = void 0, b = void 0;
|
|
2483
2490
|
"price" === s ? (p = n.close[e], v = n.high[e], d = n.low[e], b = n[f][e], o[h].update({
|
|
@@ -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,
|
|
@@ -2535,31 +2542,31 @@ var OHLCV_INDICATORS;
|
|
|
2535
2542
|
};
|
|
2536
2543
|
};
|
|
2537
2544
|
// ./src/studies/priceVariations.js
|
|
2538
|
-
function
|
|
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,
|
|
@@ -2730,10 +2737,10 @@ var OHLCV_INDICATORS;
|
|
|
2730
2737
|
}), r.dateTime.sessionIntradayIndexCount++;
|
|
2731
2738
|
},
|
|
2732
2739
|
priceVariations: function(t, e) {
|
|
2733
|
-
0 === e && (t.priceBased =
|
|
2740
|
+
0 === e && (t.priceBased = br(new Set([].concat(br(t.priceBased), [ "mid_price_open_close", "mid_price_high_low" ]))),
|
|
2734
2741
|
Object.assign(t.verticalOhlcv, {
|
|
2735
|
-
mid_price_open_close:
|
|
2736
|
-
mid_price_high_low:
|
|
2742
|
+
mid_price_open_close: br(t.nullArray),
|
|
2743
|
+
mid_price_high_low: br(t.nullArray)
|
|
2737
2744
|
}));
|
|
2738
2745
|
var r = t.verticalOhlcv.open[e], n = t.verticalOhlcv.high[e], o = t.verticalOhlcv.low[e], i = t.verticalOhlcv.close[e];
|
|
2739
2746
|
t.pushToMain({
|
|
@@ -2879,7 +2886,7 @@ var OHLCV_INDICATORS;
|
|
|
2879
2886
|
}), l.hasOwnProperty("macd") || (l.macd = {
|
|
2880
2887
|
numberOfIndicators: v,
|
|
2881
2888
|
settings: {}
|
|
2882
|
-
}), l.macd.settings[s] = new
|
|
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))),
|
|
2883
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];
|
|
@@ -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) {
|
|
@@ -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
|
},
|
|
@@ -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, d = h.close, b =
|
|
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,7 +3384,7 @@ 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",
|
|
@@ -3387,7 +3392,7 @@ var OHLCV_INDICATORS;
|
|
|
3387
3392
|
});
|
|
3388
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;
|
|
@@ -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;
|
|
@@ -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,37 +3565,42 @@ 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) {
|
|
3567
3572
|
var e = t.index, n = t.key, o = t.value;
|
|
3568
3573
|
return function(t) {
|
|
3569
3574
|
var e = t.main, r = t.index, n = t.key, o = t.value, i = e.precision, a = e.priceBased, u = e.minMaxRanges, l = e.verticalOhlcv, c = e.autoMinMaxKeys, s = e.precisionMultiplier;
|
|
3570
|
-
if (
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3575
|
+
if (null == o) {
|
|
3576
|
+
e.invalidValueIndex = r;
|
|
3577
|
+
//do not use let for main.invalidValueIndex
|
|
3578
|
+
for (var f = 0, h = Object.keys(u); f < h.length; f++) u[h[f]] = {
|
|
3579
|
+
min: 1 / 0,
|
|
3580
|
+
max: -1 / 0
|
|
3581
|
+
};
|
|
3582
|
+
return l[n][r] = null, !1;
|
|
3583
|
+
}
|
|
3574
3584
|
if (l[n][r] = o, "number" == typeof o && !n.includes("_x_")) {
|
|
3575
|
-
var
|
|
3576
|
-
if (n.includes("_diff_") &&
|
|
3577
|
-
min: -1,
|
|
3578
|
-
max: 1
|
|
3579
|
-
}); else if (n.startsWith("candle_") && h) u[n] = {
|
|
3585
|
+
var y = c.includes(n);
|
|
3586
|
+
if (n.includes("_diff_") && y) u.hasOwnProperty(n) && u[n].min !== 1 / 0 && u[n].max !== -1 / 0 || (u[n] = {
|
|
3580
3587
|
min: -1,
|
|
3581
3588
|
max: 1
|
|
3582
|
-
}; else if (n.
|
|
3589
|
+
}); else if (n.startsWith("candle_") && y) u[n] = {
|
|
3590
|
+
min: -3,
|
|
3591
|
+
max: 3
|
|
3592
|
+
}; else if (n.includes("_range_") && y) u[n] = {
|
|
3583
3593
|
min: 0,
|
|
3584
3594
|
max: 1
|
|
3585
|
-
}; else if (n.startsWith("rsi_") &&
|
|
3595
|
+
}; else if (n.startsWith("rsi_") && y) u[n] = {
|
|
3586
3596
|
min: 0,
|
|
3587
3597
|
max: 1
|
|
3588
3598
|
}; else {
|
|
3589
|
-
var
|
|
3599
|
+
var p = i && a.includes(n) ? o / s : o;
|
|
3590
3600
|
u.hasOwnProperty(n) || (u[n] = {
|
|
3591
3601
|
min: 1 / 0,
|
|
3592
3602
|
max: -1 / 0
|
|
3593
|
-
}),
|
|
3603
|
+
}), p < u[n].min && (u[n].min = p), p > u[n].max && (u[n].max = p);
|
|
3594
3604
|
}
|
|
3595
3605
|
}
|
|
3596
3606
|
return !0;
|
|
@@ -3669,7 +3679,7 @@ var OHLCV_INDICATORS;
|
|
|
3669
3679
|
//compute method can be used to process indicators if no arguments are provided
|
|
3670
3680
|
//compute method can be called to access the .verticalOhlcv object
|
|
3671
3681
|
//compute method is called automatically if getLastValues or getDate methods are called
|
|
3672
|
-
this.len > this.lastComputedIndex && !t &&
|
|
3682
|
+
this.len > this.lastComputedIndex && !t && xr(this.input, this, 0), t && "object" === Cr(t)) {
|
|
3673
3683
|
var e;
|
|
3674
3684
|
if (![ "open", "high", "low", "close", "volume", "date" ].every((function(e) {
|
|
3675
3685
|
return Object.keys(t).includes(e);
|
|
@@ -3680,16 +3690,16 @@ var OHLCV_INDICATORS;
|
|
|
3680
3690
|
//fallback if .compute(change) is triggered before .compute() alone
|
|
3681
3691
|
0 === this.lastComputedIndex && this.compute(), i !== r ? (
|
|
3682
3692
|
// Add new item
|
|
3683
|
-
this.len++, this.input.push(t),
|
|
3693
|
+
this.len++, this.input.push(t), xr(this.input, this, this.len)) : (
|
|
3684
3694
|
// Modify the last item
|
|
3685
|
-
this.input[n] = t,
|
|
3695
|
+
this.input[n] = t, xr(this.input, this, n));
|
|
3686
3696
|
}
|
|
3687
3697
|
return this;
|
|
3688
3698
|
}
|
|
3689
3699
|
}, {
|
|
3690
3700
|
key: "crossPairs",
|
|
3691
3701
|
value: function(t) {
|
|
3692
|
-
return i(this), this.crossPairsList = [].concat(
|
|
3702
|
+
return i(this), this.crossPairsList = [].concat(Ir(this.crossPairsList), Ir(t)),
|
|
3693
3703
|
this.inputParams.push({
|
|
3694
3704
|
key: "crossPairs",
|
|
3695
3705
|
params: [ this.crossPairsList ]
|
|
@@ -3720,7 +3730,7 @@ var OHLCV_INDICATORS;
|
|
|
3720
3730
|
if (!1 === this.hasVolume) throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');
|
|
3721
3731
|
i(this);
|
|
3722
3732
|
var r = e.scale, n = void 0 === r ? null : r;
|
|
3723
|
-
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(", ")));
|
|
3724
3734
|
return this.inputParams.push({
|
|
3725
3735
|
key: "relativeVolume",
|
|
3726
3736
|
params: [ t, {
|
|
@@ -3733,7 +3743,7 @@ var OHLCV_INDICATORS;
|
|
|
3733
3743
|
value: function(t) {
|
|
3734
3744
|
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3735
3745
|
i(this);
|
|
3736
|
-
var r = de("ema", t, e,
|
|
3746
|
+
var r = de("ema", t, e, Lr);
|
|
3737
3747
|
return this.inputParams.push({
|
|
3738
3748
|
key: "movingAverages",
|
|
3739
3749
|
params: [ "ema", t, r ]
|
|
@@ -3744,7 +3754,7 @@ var OHLCV_INDICATORS;
|
|
|
3744
3754
|
value: function(t) {
|
|
3745
3755
|
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3746
3756
|
i(this);
|
|
3747
|
-
var r = de("sma", t, e,
|
|
3757
|
+
var r = de("sma", t, e, Lr);
|
|
3748
3758
|
return this.inputParams.push({
|
|
3749
3759
|
key: "movingAverages",
|
|
3750
3760
|
params: [ "sma", t, r ]
|
|
@@ -3757,7 +3767,7 @@ var OHLCV_INDICATORS;
|
|
|
3757
3767
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"fast" must be a positive number in macd.');
|
|
3758
3768
|
if ("number" != typeof e || e <= t) throw new Error('"slow" must be a positive number greater than "fast" in macd.');
|
|
3759
3769
|
if ("number" != typeof r || r <= 0) throw new Error('"signal" must be a positive number in macd.');
|
|
3760
|
-
if ("object" !==
|
|
3770
|
+
if ("object" !== Cr(n)) throw new Error('"options" must be an object in macd. eg: {target}');
|
|
3761
3771
|
var o = n.target, a = void 0 === o ? "close" : o;
|
|
3762
3772
|
return this.inputParams.push({
|
|
3763
3773
|
key: "macd",
|
|
@@ -3770,7 +3780,7 @@ var OHLCV_INDICATORS;
|
|
|
3770
3780
|
key: "bollingerBands",
|
|
3771
3781
|
value: function() {
|
|
3772
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] : {};
|
|
3773
|
-
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}');
|
|
3774
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;
|
|
3775
3785
|
// Validate size and times
|
|
3776
3786
|
if ("number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in bollingerBands.');
|
|
@@ -3779,7 +3789,7 @@ var OHLCV_INDICATORS;
|
|
|
3779
3789
|
if ("number" != typeof y) throw new Error('"lag" value must be a number in bollingerBands.');
|
|
3780
3790
|
if ("boolean" != typeof v) throw new Error('"autoMinMax" value in rsi must be a number in bollingerBands.');
|
|
3781
3791
|
if ("boolean" != typeof u) throw new Error('"height" must be a boolean in bollingerBands.');
|
|
3782
|
-
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(", ")));
|
|
3783
3793
|
return this.inputParams.push({
|
|
3784
3794
|
key: "bollingerBands",
|
|
3785
3795
|
params: [ t, e, {
|
|
@@ -3799,7 +3809,7 @@ var OHLCV_INDICATORS;
|
|
|
3799
3809
|
// Validate size and times
|
|
3800
3810
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in rsi.');
|
|
3801
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;
|
|
3802
|
-
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(", ")));
|
|
3803
3813
|
if ("number" != typeof l) throw new Error('"lag" value in rsi must be a number in rsi.');
|
|
3804
3814
|
if ("boolean" != typeof s) throw new Error('"autoMinMax" value in rsi must be a number in rsi.');
|
|
3805
3815
|
return this.inputParams.push({
|
|
@@ -3823,7 +3833,7 @@ var OHLCV_INDICATORS;
|
|
|
3823
3833
|
if ("number" != typeof f) throw new Error('"lag" value in rsi must be a number in donchianChannels.');
|
|
3824
3834
|
if ("boolean" != typeof y) throw new Error('"autoMinMax" value in rsi must be a number in donchianChannels.');
|
|
3825
3835
|
if ("boolean" != typeof o) throw new Error('"height" must be a boolean in donchianChannels.');
|
|
3826
|
-
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(", ")));
|
|
3827
3837
|
return this.inputParams.push({
|
|
3828
3838
|
key: "donchianChannels",
|
|
3829
3839
|
params: [ t, e, {
|
|
@@ -3840,10 +3850,10 @@ var OHLCV_INDICATORS;
|
|
|
3840
3850
|
value: function() {
|
|
3841
3851
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 200, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3842
3852
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number greater than 0 in candleVectors.');
|
|
3843
|
-
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;
|
|
3844
3854
|
if ("number" != typeof n || n <= 0) throw new Error('"stdDev" must be a positive number greater than 0 in candleVectors.');
|
|
3845
|
-
if ("number" == typeof l && !
|
|
3846
|
-
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.');
|
|
3847
3857
|
if ("boolean" != typeof h) throw new Error('"autoMinMax" value in candleVectors must be boolean');
|
|
3848
3858
|
return this.inputParams.push({
|
|
3849
3859
|
key: "candleVectors",
|
|
@@ -3864,7 +3874,7 @@ var OHLCV_INDICATORS;
|
|
|
3864
3874
|
if (i(this), "number" != typeof t || t <= 1) throw new Error('fastSize" must be a positive number greater than 1 in volumeOscillator.');
|
|
3865
3875
|
if ("number" != typeof e || e <= t) throw new Error('"slowSize" must be a positive number greater than the "fastSize" in volumeOscillator.');
|
|
3866
3876
|
var n = r.scale, o = void 0 === n ? null : n;
|
|
3867
|
-
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(", ")));
|
|
3868
3878
|
return this.inputParams.push({
|
|
3869
3879
|
key: "volumeOscillator",
|
|
3870
3880
|
params: [ t, e, {
|
|
@@ -3888,7 +3898,7 @@ var OHLCV_INDICATORS;
|
|
|
3888
3898
|
params: []
|
|
3889
3899
|
}), this;
|
|
3890
3900
|
}
|
|
3891
|
-
} ], e &&
|
|
3901
|
+
} ], e && Br(t.prototype, e), r && Br(t, r), Object.defineProperty(t, "prototype", {
|
|
3892
3902
|
writable: !1
|
|
3893
3903
|
}), t;
|
|
3894
3904
|
var t, e, r;
|