@guihz/trading-vue-editor-tes 0.1.36 → 0.1.37
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/lib/assets/{parserTccWorker-DXLOsaP2.js → parserTccWorker-Douk71sp.js} +13282 -12922
- package/lib/assets/{scriptsRunWorker-M0obvDmK.js → scriptsRunWorker-DwBycCfp.js} +556 -525
- package/lib/components/editor/type/index.d.ts +2 -0
- package/lib/components/editor/v5/parseScript/constants.d.ts +1 -0
- package/lib/components/editor/v5/parseScript/parseToJs.d.ts +19 -2
- package/lib/components/editor/v6/parseScript/constants.d.ts +1 -0
- package/lib/components/editor/v6/parseScript/parseToJs.d.ts +19 -2
- package/lib/components/editor/v6/parseScript/visitorParser.d.ts +5 -2
- package/lib/components/editor/v6/parserTccWorker.d.ts +3 -0
- package/lib/components/editor/v6/tccParser/tccScriptParserVisitor.d.ts +7 -0
- package/lib/{index-Clupi1hX.js → index-DALxzLez.js} +67 -67
- package/lib/{index-D22ipYhi.js → index-DBn672U2.js} +91 -91
- package/lib/{index-CjECfhIW.js → index-Qjp-Unq2.js} +28 -28
- package/lib/{monarchTokens-BNkQaBBZ.js → monarchTokens-C5rW_kP9.js} +1 -1
- package/lib/{monarchTokens-BkGYzRcP.js → monarchTokens-h2q3KbTF.js} +1 -1
- package/lib/trading-vue-editor.es.packages.js +10 -10
- package/lib/trading-vue-editor.umd.packages.mjs +40 -40
- package/package.json +1 -1
- package/lib/components/editor/v5/parseScript/buildInFuncNamespace/strategyNew.d.ts +0 -261
- package/lib/components/editor/v6/parseScript/parseToLibJs.d.ts +0 -71
@@ -3007,51 +3007,51 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3007
3007
|
return $ > 96 ? $ - 87 : $ > 64 ? $ - 29 : $ - 48;
|
3008
3008
|
}
|
3009
3009
|
function u($) {
|
3010
|
-
var
|
3011
|
-
for ($.charCodeAt(0) === 45 && (
|
3012
|
-
P1 = l(n0.charCodeAt(
|
3013
|
-
for (
|
3014
|
-
a1 = a1 / 60, P1 = l(w0.charCodeAt(
|
3010
|
+
var K = 0, Z = $.split("."), n0 = Z[0], w0 = Z[1] || "", a1 = 1, P1, O1 = 0, m1 = 1;
|
3011
|
+
for ($.charCodeAt(0) === 45 && (K = 1, m1 = -1), K; K < n0.length; K++)
|
3012
|
+
P1 = l(n0.charCodeAt(K)), O1 = 60 * O1 + P1;
|
3013
|
+
for (K = 0; K < w0.length; K++)
|
3014
|
+
a1 = a1 / 60, P1 = l(w0.charCodeAt(K)), O1 += P1 * a1;
|
3015
3015
|
return O1 * m1;
|
3016
3016
|
}
|
3017
3017
|
function O($) {
|
3018
|
-
for (var
|
3019
|
-
$[
|
3018
|
+
for (var K = 0; K < $.length; K++)
|
3019
|
+
$[K] = u($[K]);
|
3020
3020
|
}
|
3021
|
-
function d($,
|
3022
|
-
for (var Z = 0; Z <
|
3021
|
+
function d($, K) {
|
3022
|
+
for (var Z = 0; Z < K; Z++)
|
3023
3023
|
$[Z] = Math.round(($[Z - 1] || 0) + $[Z] * 6e4);
|
3024
|
-
$[
|
3024
|
+
$[K - 1] = 1 / 0;
|
3025
3025
|
}
|
3026
|
-
function _($,
|
3026
|
+
function _($, K) {
|
3027
3027
|
var Z = [], n0;
|
3028
|
-
for (n0 = 0; n0 <
|
3029
|
-
Z[n0] = $[
|
3028
|
+
for (n0 = 0; n0 < K.length; n0++)
|
3029
|
+
Z[n0] = $[K[n0]];
|
3030
3030
|
return Z;
|
3031
3031
|
}
|
3032
3032
|
function f($) {
|
3033
|
-
var
|
3033
|
+
var K = $.split("|"), Z = K[2].split(" "), n0 = K[3].split(""), w0 = K[4].split(" ");
|
3034
3034
|
return O(Z), O(n0), O(w0), d(w0, n0.length), {
|
3035
|
-
name:
|
3036
|
-
abbrs: _(
|
3035
|
+
name: K[0],
|
3036
|
+
abbrs: _(K[1].split(" "), n0),
|
3037
3037
|
offsets: _(Z, n0),
|
3038
3038
|
untils: w0,
|
3039
|
-
population:
|
3039
|
+
population: K[5] | 0
|
3040
3040
|
};
|
3041
3041
|
}
|
3042
3042
|
function A($) {
|
3043
3043
|
$ && this._set(f($));
|
3044
3044
|
}
|
3045
|
-
function q($,
|
3046
|
-
var Z =
|
3047
|
-
if ($ <
|
3045
|
+
function q($, K) {
|
3046
|
+
var Z = K.length;
|
3047
|
+
if ($ < K[0])
|
3048
3048
|
return 0;
|
3049
|
-
if (Z > 1 &&
|
3049
|
+
if (Z > 1 && K[Z - 1] === 1 / 0 && $ >= K[Z - 2])
|
3050
3050
|
return Z - 1;
|
3051
|
-
if ($ >=
|
3051
|
+
if ($ >= K[Z - 1])
|
3052
3052
|
return -1;
|
3053
3053
|
for (var n0, w0 = 0, a1 = Z - 1; a1 - w0 > 1; )
|
3054
|
-
n0 = Math.floor((w0 + a1) / 2),
|
3054
|
+
n0 = Math.floor((w0 + a1) / 2), K[n0] <= $ ? w0 = n0 : a1 = n0;
|
3055
3055
|
return a1;
|
3056
3056
|
}
|
3057
3057
|
A.prototype = {
|
@@ -3059,20 +3059,20 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3059
3059
|
this.name = $.name, this.abbrs = $.abbrs, this.untils = $.untils, this.offsets = $.offsets, this.population = $.population;
|
3060
3060
|
},
|
3061
3061
|
_index: function($) {
|
3062
|
-
var
|
3063
|
-
if (n0 = q(
|
3062
|
+
var K = +$, Z = this.untils, n0;
|
3063
|
+
if (n0 = q(K, Z), n0 >= 0)
|
3064
3064
|
return n0;
|
3065
3065
|
},
|
3066
3066
|
countries: function() {
|
3067
3067
|
var $ = this.name;
|
3068
|
-
return Object.keys(s).filter(function(
|
3069
|
-
return s[
|
3068
|
+
return Object.keys(s).filter(function(K) {
|
3069
|
+
return s[K].zones.indexOf($) !== -1;
|
3070
3070
|
});
|
3071
3071
|
},
|
3072
3072
|
parse: function($) {
|
3073
|
-
var
|
3073
|
+
var K = +$, Z = this.offsets, n0 = this.untils, w0 = n0.length - 1, a1, P1, O1, m1;
|
3074
3074
|
for (m1 = 0; m1 < w0; m1++)
|
3075
|
-
if (a1 = Z[m1], P1 = Z[m1 + 1], O1 = Z[m1 && m1 - 1], a1 < P1 && f0.moveAmbiguousForward ? a1 = P1 : a1 > O1 && f0.moveInvalidForward && (a1 = O1),
|
3075
|
+
if (a1 = Z[m1], P1 = Z[m1 + 1], O1 = Z[m1 && m1 - 1], a1 < P1 && f0.moveAmbiguousForward ? a1 = P1 : a1 > O1 && f0.moveInvalidForward && (a1 = O1), K < n0[m1] - a1 * 6e4)
|
3076
3076
|
return Z[m1];
|
3077
3077
|
return Z[w0];
|
3078
3078
|
},
|
@@ -3086,12 +3086,12 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3086
3086
|
return this.offsets[this._index($)];
|
3087
3087
|
}
|
3088
3088
|
};
|
3089
|
-
function g($,
|
3090
|
-
this.name = $, this.zones =
|
3089
|
+
function g($, K) {
|
3090
|
+
this.name = $, this.zones = K;
|
3091
3091
|
}
|
3092
3092
|
function W($) {
|
3093
|
-
var
|
3094
|
-
Z && Z[0] ? (Z = Z[0].match(/[A-Z]/g), Z = Z ? Z.join("") : void 0) : (Z =
|
3093
|
+
var K = $.toTimeString(), Z = K.match(/\([a-z ]+\)/i);
|
3094
|
+
Z && Z[0] ? (Z = Z[0].match(/[A-Z]/g), Z = Z ? Z.join("") : void 0) : (Z = K.match(/[A-Z]{3,5}/g), Z = Z ? Z[0] : void 0), Z === "GMT" && (Z = void 0), this.at = +$, this.abbr = Z, this.offset = $.getTimezoneOffset();
|
3095
3095
|
}
|
3096
3096
|
function v($) {
|
3097
3097
|
this.zone = $, this.offsetScore = 0, this.abbrScore = 0;
|
@@ -3099,30 +3099,30 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3099
3099
|
v.prototype.scoreOffsetAt = function($) {
|
3100
3100
|
this.offsetScore += Math.abs(this.zone.utcOffset($.at) - $.offset), this.zone.abbr($.at).replace(/[^A-Z]/g, "") !== $.abbr && this.abbrScore++;
|
3101
3101
|
};
|
3102
|
-
function y($,
|
3103
|
-
for (var Z, n0; n0 = ((
|
3104
|
-
Z = new W(new Date($.at + n0)), Z.offset === $.offset ? $ = Z :
|
3102
|
+
function y($, K) {
|
3103
|
+
for (var Z, n0; n0 = ((K.at - $.at) / 12e4 | 0) * 6e4; )
|
3104
|
+
Z = new W(new Date($.at + n0)), Z.offset === $.offset ? $ = Z : K = Z;
|
3105
3105
|
return $;
|
3106
3106
|
}
|
3107
3107
|
function L() {
|
3108
|
-
var $ = (/* @__PURE__ */ new Date()).getFullYear() - 2,
|
3108
|
+
var $ = (/* @__PURE__ */ new Date()).getFullYear() - 2, K = new W(new Date($, 0, 1)), Z = K.offset, n0 = [K], w0, a1, P1, O1;
|
3109
3109
|
for (O1 = 1; O1 < 48; O1++)
|
3110
|
-
P1 = new Date($, O1, 1).getTimezoneOffset(), P1 !== Z && (a1 = new W(new Date($, O1, 1)), w0 = y(
|
3110
|
+
P1 = new Date($, O1, 1).getTimezoneOffset(), P1 !== Z && (a1 = new W(new Date($, O1, 1)), w0 = y(K, a1), n0.push(w0), n0.push(new W(new Date(w0.at + 6e4))), K = a1, Z = P1);
|
3111
3111
|
for (O1 = 0; O1 < 4; O1++)
|
3112
3112
|
n0.push(new W(new Date($ + O1, 0, 1))), n0.push(new W(new Date($ + O1, 6, 1)));
|
3113
3113
|
return n0;
|
3114
3114
|
}
|
3115
|
-
function D($,
|
3116
|
-
return $.offsetScore !==
|
3115
|
+
function D($, K) {
|
3116
|
+
return $.offsetScore !== K.offsetScore ? $.offsetScore - K.offsetScore : $.abbrScore !== K.abbrScore ? $.abbrScore - K.abbrScore : $.zone.population !== K.zone.population ? K.zone.population - $.zone.population : K.zone.name.localeCompare($.zone.name);
|
3117
3117
|
}
|
3118
|
-
function N($,
|
3118
|
+
function N($, K) {
|
3119
3119
|
var Z, n0;
|
3120
|
-
for (O(
|
3121
|
-
n0 =
|
3120
|
+
for (O(K), Z = 0; Z < K.length; Z++)
|
3121
|
+
n0 = K[Z], a[n0] = a[n0] || {}, a[n0][$] = !0;
|
3122
3122
|
}
|
3123
3123
|
function w($) {
|
3124
|
-
var
|
3125
|
-
for (a1 = 0; a1 <
|
3124
|
+
var K = $.length, Z = {}, n0 = [], w0 = {}, a1, P1, O1, m1;
|
3125
|
+
for (a1 = 0; a1 < K; a1++)
|
3126
3126
|
if (O1 = $[a1].offset, !w0.hasOwnProperty(O1)) {
|
3127
3127
|
m1 = a[O1] || {};
|
3128
3128
|
for (P1 in m1)
|
@@ -3137,9 +3137,9 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3137
3137
|
try {
|
3138
3138
|
var $ = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
3139
3139
|
if ($ && $.length > 3) {
|
3140
|
-
var
|
3141
|
-
if (
|
3142
|
-
return
|
3140
|
+
var K = o[S($)];
|
3141
|
+
if (K)
|
3142
|
+
return K;
|
3143
3143
|
B0("Moment Timezone found " + $ + " from the Intl api, but did not have that data loaded.");
|
3144
3144
|
}
|
3145
3145
|
} catch {
|
@@ -3155,38 +3155,38 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3155
3155
|
function T($) {
|
3156
3156
|
return (!c || $) && (c = x()), c;
|
3157
3157
|
}
|
3158
|
-
function
|
3158
|
+
function S($) {
|
3159
3159
|
return ($ || "").toLowerCase().replace(/\//g, "_");
|
3160
3160
|
}
|
3161
|
-
function
|
3162
|
-
var
|
3163
|
-
for (typeof $ == "string" && ($ = [$]),
|
3164
|
-
n0 = $[
|
3161
|
+
function k($) {
|
3162
|
+
var K, Z, n0, w0;
|
3163
|
+
for (typeof $ == "string" && ($ = [$]), K = 0; K < $.length; K++)
|
3164
|
+
n0 = $[K].split("|"), Z = n0[0], w0 = S(Z), r[w0] = $[K], o[w0] = Z, N(w0, n0[2].split(" "));
|
3165
3165
|
}
|
3166
|
-
function I($,
|
3167
|
-
$ =
|
3166
|
+
function I($, K) {
|
3167
|
+
$ = S($);
|
3168
3168
|
var Z = r[$], n0;
|
3169
|
-
return Z instanceof A ? Z : typeof Z == "string" ? (Z = new A(Z), r[$] = Z, Z) : i[$] &&
|
3169
|
+
return Z instanceof A ? Z : typeof Z == "string" ? (Z = new A(Z), r[$] = Z, Z) : i[$] && K !== I && (n0 = I(i[$], I)) ? (Z = r[$] = new A(), Z._set(n0), Z.name = o[$], Z) : null;
|
3170
3170
|
}
|
3171
3171
|
function Y() {
|
3172
|
-
var $,
|
3172
|
+
var $, K = [];
|
3173
3173
|
for ($ in o)
|
3174
|
-
o.hasOwnProperty($) && (r[$] || r[i[$]]) && o[$] &&
|
3175
|
-
return
|
3174
|
+
o.hasOwnProperty($) && (r[$] || r[i[$]]) && o[$] && K.push(o[$]);
|
3175
|
+
return K.sort();
|
3176
3176
|
}
|
3177
3177
|
function V() {
|
3178
3178
|
return Object.keys(s);
|
3179
3179
|
}
|
3180
|
-
function
|
3181
|
-
var
|
3182
|
-
for (typeof $ == "string" && ($ = [$]),
|
3183
|
-
Z = $[
|
3180
|
+
function G($) {
|
3181
|
+
var K, Z, n0, w0;
|
3182
|
+
for (typeof $ == "string" && ($ = [$]), K = 0; K < $.length; K++)
|
3183
|
+
Z = $[K].split("|"), n0 = S(Z[0]), w0 = S(Z[1]), i[n0] = w0, o[n0] = Z[0], i[w0] = n0, o[w0] = Z[1];
|
3184
3184
|
}
|
3185
3185
|
function t0($) {
|
3186
|
-
var
|
3186
|
+
var K, Z, n0, w0;
|
3187
3187
|
if (!(!$ || !$.length))
|
3188
|
-
for (
|
3189
|
-
w0 = $[
|
3188
|
+
for (K = 0; K < $.length; K++)
|
3189
|
+
w0 = $[K].split("|"), Z = w0[0].toUpperCase(), n0 = w0[1].split(" "), s[Z] = new g(
|
3190
3190
|
Z,
|
3191
3191
|
n0
|
3192
3192
|
);
|
@@ -3194,11 +3194,11 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3194
3194
|
function d0($) {
|
3195
3195
|
return $ = $.toUpperCase(), s[$] || null;
|
3196
3196
|
}
|
3197
|
-
function s0($,
|
3197
|
+
function s0($, K) {
|
3198
3198
|
if ($ = d0($), !$)
|
3199
3199
|
return null;
|
3200
3200
|
var Z = $.zones.sort();
|
3201
|
-
return
|
3201
|
+
return K ? Z.map(function(n0) {
|
3202
3202
|
var w0 = I(n0);
|
3203
3203
|
return {
|
3204
3204
|
name: n0,
|
@@ -3207,37 +3207,37 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
3207
3207
|
}) : Z;
|
3208
3208
|
}
|
3209
3209
|
function i0($) {
|
3210
|
-
|
3210
|
+
k($.zones), G($.links), t0($.countries), f0.dataVersion = $.version;
|
3211
3211
|
}
|
3212
3212
|
function k0($) {
|
3213
3213
|
return k0.didShowError || (k0.didShowError = !0, B0("moment.tz.zoneExists('" + $ + "') has been deprecated in favor of !moment.tz.zone('" + $ + "')")), !!I($);
|
3214
3214
|
}
|
3215
3215
|
function F0($) {
|
3216
|
-
var
|
3217
|
-
return !!($._a && $._tzm === void 0 && !
|
3216
|
+
var K = $._f === "X" || $._f === "x";
|
3217
|
+
return !!($._a && $._tzm === void 0 && !K);
|
3218
3218
|
}
|
3219
3219
|
function B0($) {
|
3220
3220
|
typeof console < "u" && typeof console.error == "function" && console.error($);
|
3221
3221
|
}
|
3222
3222
|
function f0($) {
|
3223
|
-
var
|
3223
|
+
var K = Array.prototype.slice.call(arguments, 0, -1), Z = arguments[arguments.length - 1], n0 = e.utc.apply(null, K), w0;
|
3224
3224
|
return !e.isMoment($) && F0(n0) && (w0 = I(Z)) && n0.add(w0.parse(n0), "minutes"), n0.tz(Z), n0;
|
3225
3225
|
}
|
3226
|
-
f0.version = t, f0.dataVersion = "", f0._zones = r, f0._links = i, f0._names = o, f0._countries = s, f0.add =
|
3226
|
+
f0.version = t, f0.dataVersion = "", f0._zones = r, f0._links = i, f0._names = o, f0._countries = s, f0.add = k, f0.link = G, f0.load = i0, f0.zone = I, f0.zoneExists = k0, f0.guess = T, f0.names = Y, f0.Zone = A, f0.unpack = f, f0.unpackBase60 = u, f0.needsOffset = F0, f0.moveInvalidForward = !0, f0.moveAmbiguousForward = !1, f0.countries = V, f0.zonesForCountry = s0;
|
3227
3227
|
var s1 = e.fn;
|
3228
|
-
e.tz = f0, e.defaultZone = null, e.updateOffset = function($,
|
3228
|
+
e.tz = f0, e.defaultZone = null, e.updateOffset = function($, K) {
|
3229
3229
|
var Z = e.defaultZone, n0;
|
3230
3230
|
if ($._z === void 0 && (Z && F0($) && !$._isUTC && $.isValid() && ($._d = e.utc($._a)._d, $.utc().add(Z.parse($), "minutes")), $._z = Z), $._z)
|
3231
3231
|
if (n0 = $._z.utcOffset($), Math.abs(n0) < 16 && (n0 = n0 / 60), $.utcOffset !== void 0) {
|
3232
3232
|
var w0 = $._z;
|
3233
|
-
$.utcOffset(-n0,
|
3233
|
+
$.utcOffset(-n0, K), $._z = w0;
|
3234
3234
|
} else
|
3235
|
-
$.zone(n0,
|
3236
|
-
}, s1.tz = function($,
|
3235
|
+
$.zone(n0, K);
|
3236
|
+
}, s1.tz = function($, K) {
|
3237
3237
|
if ($) {
|
3238
3238
|
if (typeof $ != "string")
|
3239
3239
|
throw new Error("Time zone name must be a string, got " + $ + " [" + typeof $ + "]");
|
3240
|
-
return this._z = I($), this._z ? e.updateOffset(this,
|
3240
|
+
return this._z = I($), this._z ? e.updateOffset(this, K) : B0("Moment Timezone has no data for " + $ + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
|
3241
3241
|
}
|
3242
3242
|
if (this._z)
|
3243
3243
|
return this._z.name;
|
@@ -4255,7 +4255,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
4255
4255
|
Wc.exports;
|
4256
4256
|
(function(n, e) {
|
4257
4257
|
(function() {
|
4258
|
-
var t, r = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", c = "__lodash_hash_undefined__", p = 500, b = "__lodash_placeholder__", M = 1, l = 2, u = 4, O = 1, d = 2, _ = 1, f = 2, A = 4, q = 8, g = 16, W = 32, v = 64, y = 128, L = 256, D = 512, N = 30, w = "...", x = 800, T = 16,
|
4258
|
+
var t, r = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", c = "__lodash_hash_undefined__", p = 500, b = "__lodash_placeholder__", M = 1, l = 2, u = 4, O = 1, d = 2, _ = 1, f = 2, A = 4, q = 8, g = 16, W = 32, v = 64, y = 128, L = 256, D = 512, N = 30, w = "...", x = 800, T = 16, S = 1, k = 2, I = 3, Y = 1 / 0, V = 9007199254740991, G = 17976931348623157e292, t0 = NaN, d0 = 4294967295, s0 = d0 - 1, i0 = d0 >>> 1, k0 = [
|
4259
4259
|
["ary", y],
|
4260
4260
|
["bind", _],
|
4261
4261
|
["bindKey", f],
|
@@ -4265,7 +4265,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
4265
4265
|
["partial", W],
|
4266
4266
|
["partialRight", v],
|
4267
4267
|
["rearg", L]
|
4268
|
-
], F0 = "[object Arguments]", B0 = "[object Array]", f0 = "[object AsyncFunction]", s1 = "[object Boolean]", e1 = "[object Date]", n1 = "[object DOMException]", K0 = "[object Error]", x0 = "[object Function]", $ = "[object GeneratorFunction]",
|
4268
|
+
], F0 = "[object Arguments]", B0 = "[object Array]", f0 = "[object AsyncFunction]", s1 = "[object Boolean]", e1 = "[object Date]", n1 = "[object DOMException]", K0 = "[object Error]", x0 = "[object Function]", $ = "[object GeneratorFunction]", K = "[object Map]", Z = "[object Number]", n0 = "[object Null]", w0 = "[object Object]", a1 = "[object Promise]", P1 = "[object Proxy]", O1 = "[object RegExp]", m1 = "[object Set]", ii = "[object String]", X = "[object Symbol]", j = "[object Undefined]", Q = "[object WeakMap]", p0 = "[object WeakSet]", M0 = "[object ArrayBuffer]", c0 = "[object DataView]", A0 = "[object Float32Array]", u0 = "[object Float64Array]", q0 = "[object Int8Array]", z0 = "[object Int16Array]", x1 = "[object Int32Array]", F1 = "[object Uint8Array]", ue = "[object Uint8ClampedArray]", Pe = "[object Uint16Array]", Ce = "[object Uint32Array]", Ct = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, ki = /(__e\(.*?\)|\b__t\)) \+\n'';/g, As = /&(?:amp|lt|gt|quot|#39);/g, Io = /[&<>"']/g, g2 = RegExp(As.source), W2 = RegExp(Io.source), v2 = /<%-([\s\S]+?)%>/g, y2 = /<%([\s\S]+?)%>/g, $o = /<%=([\s\S]+?)%>/g, R2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, N2 = /^\w*$/, L2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Yn = /[\\^$.*+?()[\]{}|]/g, w2 = RegExp(Yn.source), Kn = /^\s+/, D2 = /\s/, B2 = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, x2 = /\{\n\/\* \[wrapped with (.+)\] \*/, C2 = /,? & /, E2 = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, T2 = /[()=,{}\[\]\/\s]/, X2 = /\\(\\)?/g, I2 = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Fo = /\w*$/, $2 = /^[-+]0x[0-9a-f]+$/i, F2 = /^0b[01]+$/i, S2 = /^\[object .+?Constructor\]$/, k2 = /^0o[0-7]+$/i, P2 = /^(?:0|[1-9]\d*)$/, H2 = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, en = /($^)/, qs = /['\n\r\u2028\u2029\\]/g, N1 = "\\ud800-\\udfff", et = "\\u0300-\\u036f", U2 = "\\ufe20-\\ufe2f", tn = "\\u20d0-\\u20ff", Pi = et + U2 + tn, So = "\\u2700-\\u27bf", kM = "a-z\\xdf-\\xf6\\xf8-\\xff", hh = "\\xac\\xb1\\xd7\\xf7", _h = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ah = "\\u2000-\\u206f", qh = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", PM = "A-Z\\xc0-\\xd6\\xd8-\\xde", HM = "\\ufe0e\\ufe0f", UM = hh + _h + Ah + qh, j2 = "['’]", mh = "[" + N1 + "]", jM = "[" + UM + "]", ko = "[" + Pi + "]", VM = "\\d+", gh = "[" + So + "]", YM = "[" + kM + "]", KM = "[^" + N1 + UM + VM + So + kM + PM + "]", V2 = "\\ud83c[\\udffb-\\udfff]", Wh = "(?:" + ko + "|" + V2 + ")", GM = "[^" + N1 + "]", Y2 = "(?:\\ud83c[\\udde6-\\uddff]){2}", K2 = "[\\ud800-\\udbff][\\udc00-\\udfff]", rn = "[" + PM + "]", QM = "\\u200d", JM = "(?:" + YM + "|" + KM + ")", vh = "(?:" + rn + "|" + KM + ")", ZM = "(?:" + j2 + "(?:d|ll|m|re|s|t|ve))?", el = "(?:" + j2 + "(?:D|LL|M|RE|S|T|VE))?", tl = Wh + "?", rl = "[" + HM + "]?", yh = "(?:" + QM + "(?:" + [GM, Y2, K2].join("|") + ")" + rl + tl + ")*", Rh = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", Nh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", il = rl + tl + yh, Lh = "(?:" + [gh, Y2, K2].join("|") + ")" + il, wh = "(?:" + [GM + ko + "?", ko, Y2, K2, mh].join("|") + ")", Dh = RegExp(j2, "g"), Bh = RegExp(ko, "g"), G2 = RegExp(V2 + "(?=" + V2 + ")|" + wh + il, "g"), xh = RegExp([
|
4269
4269
|
rn + "?" + YM + "+" + ZM + "(?=" + [jM, rn, "$"].join("|") + ")",
|
4270
4270
|
vh + "+" + el + "(?=" + [jM, rn + JM, "$"].join("|") + ")",
|
4271
4271
|
rn + "?" + JM + "+" + ZM,
|
@@ -4306,9 +4306,9 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
4306
4306
|
"parseInt",
|
4307
4307
|
"setTimeout"
|
4308
4308
|
], Xh = -1, se = {};
|
4309
|
-
se[A0] = se[u0] = se[q0] = se[z0] = se[x1] = se[F1] = se[ue] = se[Pe] = se[Ce] = !0, se[F0] = se[B0] = se[M0] = se[s1] = se[c0] = se[e1] = se[K0] = se[x0] = se[
|
4309
|
+
se[A0] = se[u0] = se[q0] = se[z0] = se[x1] = se[F1] = se[ue] = se[Pe] = se[Ce] = !0, se[F0] = se[B0] = se[M0] = se[s1] = se[c0] = se[e1] = se[K0] = se[x0] = se[K] = se[Z] = se[w0] = se[O1] = se[m1] = se[ii] = se[Q] = !1;
|
4310
4310
|
var Z1 = {};
|
4311
|
-
Z1[F0] = Z1[B0] = Z1[M0] = Z1[c0] = Z1[s1] = Z1[e1] = Z1[A0] = Z1[u0] = Z1[q0] = Z1[z0] = Z1[x1] = Z1[
|
4311
|
+
Z1[F0] = Z1[B0] = Z1[M0] = Z1[c0] = Z1[s1] = Z1[e1] = Z1[A0] = Z1[u0] = Z1[q0] = Z1[z0] = Z1[x1] = Z1[K] = Z1[Z] = Z1[w0] = Z1[O1] = Z1[m1] = Z1[ii] = Z1[X] = Z1[F1] = Z1[ue] = Z1[Pe] = Z1[Ce] = !0, Z1[K0] = Z1[x0] = Z1[Q] = !1;
|
4312
4312
|
var Ih = {
|
4313
4313
|
// Latin-1 Supplement block.
|
4314
4314
|
À: "A",
|
@@ -4908,10 +4908,10 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
4908
4908
|
o0 += h;
|
4909
4909
|
for (var l1 = -1, j0 = z[o0]; ++l1 < l0; ) {
|
4910
4910
|
var h1 = a0[l1], R1 = h1.iteratee, Ft = h1.type, bt = R1(j0);
|
4911
|
-
if (Ft ==
|
4911
|
+
if (Ft == k)
|
4912
4912
|
j0 = bt;
|
4913
4913
|
else if (!bt) {
|
4914
|
-
if (Ft ==
|
4914
|
+
if (Ft == S)
|
4915
4915
|
continue e;
|
4916
4916
|
break e;
|
4917
4917
|
}
|
@@ -5325,7 +5325,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
5325
5325
|
return g0 ? (E || (E = new qr()), VA(z, h, m, R, B, E)) : !1;
|
5326
5326
|
}
|
5327
5327
|
function AA(z) {
|
5328
|
-
return ge(z) && rt(z) ==
|
5328
|
+
return ge(z) && rt(z) == K;
|
5329
5329
|
}
|
5330
5330
|
function hp(z, h, m, R) {
|
5331
5331
|
var B = m.length, E = B, F = !R;
|
@@ -6026,7 +6026,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
6026
6026
|
function Oz(z) {
|
6027
6027
|
return function(h) {
|
6028
6028
|
var m = rt(h);
|
6029
|
-
return m ==
|
6029
|
+
return m == K ? ap(h) : m == m1 ? a_(h) : Zh(h, z(h));
|
6030
6030
|
};
|
6031
6031
|
}
|
6032
6032
|
function ai(z, h, m, R, B, E, F, P) {
|
@@ -6116,7 +6116,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
6116
6116
|
case O1:
|
6117
6117
|
case ii:
|
6118
6118
|
return z == h + "";
|
6119
|
-
case
|
6119
|
+
case K:
|
6120
6120
|
var P = ap;
|
6121
6121
|
case m1:
|
6122
6122
|
var U = R & O;
|
@@ -6227,14 +6227,14 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
6227
6227
|
Ui(h, Tp(z)), z = Jo(z);
|
6228
6228
|
return h;
|
6229
6229
|
} : eb, rt = ct;
|
6230
|
-
(bp && rt(new bp(new ArrayBuffer(1))) != c0 || Jn && rt(new Jn()) !=
|
6230
|
+
(bp && rt(new bp(new ArrayBuffer(1))) != c0 || Jn && rt(new Jn()) != K || Mp && rt(Mp.resolve()) != a1 || pn && rt(new pn()) != m1 || Zn && rt(new Zn()) != Q) && (rt = function(z) {
|
6231
6231
|
var h = ct(z), m = h == w0 ? z.constructor : t, R = m ? Ls(m) : "";
|
6232
6232
|
if (R)
|
6233
6233
|
switch (R) {
|
6234
6234
|
case w_:
|
6235
6235
|
return c0;
|
6236
6236
|
case D_:
|
6237
|
-
return
|
6237
|
+
return K;
|
6238
6238
|
case B_:
|
6239
6239
|
return a1;
|
6240
6240
|
case x_:
|
@@ -6305,7 +6305,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
6305
6305
|
case Pe:
|
6306
6306
|
case Ce:
|
6307
6307
|
return iz(z, m);
|
6308
|
-
case
|
6308
|
+
case K:
|
6309
6309
|
return new R();
|
6310
6310
|
case Z:
|
6311
6311
|
case ii:
|
@@ -6909,7 +6909,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
6909
6909
|
if (qt(z))
|
6910
6910
|
return ya(z) ? on(z) : z.length;
|
6911
6911
|
var h = rt(z);
|
6912
|
-
return h ==
|
6912
|
+
return h == K || h == m1 ? z.size : _p(z).length;
|
6913
6913
|
}
|
6914
6914
|
function S4(z, h, m) {
|
6915
6915
|
var R = o1(z) ? tp : xA;
|
@@ -7152,7 +7152,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
7152
7152
|
if (qt(z) && (o1(z) || typeof z == "string" || typeof z.splice == "function" || Ji(z) || On(z) || ws(z)))
|
7153
7153
|
return !z.length;
|
7154
7154
|
var h = rt(z);
|
7155
|
-
if (h ==
|
7155
|
+
if (h == K || h == m1)
|
7156
7156
|
return !z.size;
|
7157
7157
|
if (co(z))
|
7158
7158
|
return !_p(z).length;
|
@@ -7261,7 +7261,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
7261
7261
|
return ya(z) ? Ar(z) : At(z);
|
7262
7262
|
if (Qn && z[Qn])
|
7263
7263
|
return o_(z[Qn]());
|
7264
|
-
var h = rt(z), m = h ==
|
7264
|
+
var h = rt(z), m = h == K ? ap : h == m1 ? Uo : dn;
|
7265
7265
|
return m(z);
|
7266
7266
|
}
|
7267
7267
|
function Mi(z) {
|
@@ -7269,7 +7269,7 @@ Arguments: ` + Array.prototype.slice.call(r).join("") + `
|
|
7269
7269
|
return z === 0 ? z : 0;
|
7270
7270
|
if (z = nr(z), z === Y || z === -Y) {
|
7271
7271
|
var h = z < 0 ? -1 : 1;
|
7272
|
-
return h *
|
7272
|
+
return h * G;
|
7273
7273
|
}
|
7274
7274
|
return z === z ? z : 0;
|
7275
7275
|
}
|
@@ -7838,7 +7838,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
7838
7838
|
return this.reverse()[z](m).reverse();
|
7839
7839
|
};
|
7840
7840
|
}), Zt(["filter", "map", "takeWhile"], function(z, h) {
|
7841
|
-
var m = h + 1, R = m ==
|
7841
|
+
var m = h + 1, R = m == S || m == I;
|
7842
7842
|
g1.prototype[z] = function(B) {
|
7843
7843
|
var E = this.clone();
|
7844
7844
|
return E.__iteratees__.push({
|
@@ -8103,7 +8103,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
8103
8103
|
_calcMaxContracts() {
|
8104
8104
|
const e = this._orders.length;
|
8105
8105
|
if (!e) {
|
8106
|
-
this._position_size = 0, this._position_avg_price = void 0;
|
8106
|
+
this._position_size = 0, this._position_avg_price = void 0, this.opentrades_long = 0, this.opentrades_short = 0, this.position_size_long = 0, this.position_size_short = 0, this.position_size_total = 0, this._openprofit = 0, this.openprofit_long = 0, this.openprofit_short = 0;
|
8107
8107
|
return;
|
8108
8108
|
}
|
8109
8109
|
this._firstPrice === void 0 && (this._firstPrice = this._orders[0].in_price);
|
@@ -8185,29 +8185,29 @@ function print() { __p += __j.call(arguments, '') }
|
|
8185
8185
|
maxprofit_percent_short: w = 0,
|
8186
8186
|
maxloss_percent_long: x = 0,
|
8187
8187
|
maxloss_percent_short: T = 0,
|
8188
|
-
hold_long_k_count:
|
8189
|
-
hold_short_k_count:
|
8188
|
+
hold_long_k_count: S = 0,
|
8189
|
+
hold_short_k_count: k = 0,
|
8190
8190
|
hold_profit_long_k_count: I = 0,
|
8191
8191
|
hold_profit_short_k_count: Y = 0,
|
8192
8192
|
hold_loss_long_k_count: V = 0,
|
8193
|
-
hold_loss_short_k_count:
|
8193
|
+
hold_loss_short_k_count: G = 0,
|
8194
8194
|
balanceByInterval: t0,
|
8195
8195
|
shapeRatioType: d0 = "NONE"
|
8196
8196
|
} = this._preHistoryOrderCalcResult;
|
8197
8197
|
const { profit: s0 = 0, profit_percent: i0 = 0, in_index: k0 = 0, out_index: F0 = 0, commission: B0 = 0, direction: f0, in_time: s1 = 0, out_time: e1 = 0, total_profit: n1 = 0 } = e, K0 = F0 - k0 + 1;
|
8198
|
-
if (f0 === G0.long ? (t += s0, i += 1, o += i0, g += B0,
|
8198
|
+
if (f0 === G0.long ? (t += s0, i += 1, o += i0, g += B0, S += K0, s0 > 0 ? (b += i0, A += 1, O += s0, I += K0, v = Math.max(v, s0), N = Math.max(N, i0)) : s0 < 0 && (c += i0, _ += 1, l += s0, V += K0, L = Math.min(L, s0), x = Math.min(x, i0))) : (r += s0, s += 1, a += i0, W += B0, k += K0, s0 > 0 ? (M += i0, q += 1, d += s0, Y += K0, y = Math.max(y, s0), w = Math.max(w, i0)) : s0 < 0 && (p += i0, f += 1, u += s0, G += K0, D = Math.min(D, s0), T = Math.min(T, i0))), !t0) {
|
8199
8199
|
const n0 = this._createBalanceByInterval(s1, Date.now());
|
8200
8200
|
t0 = n0.balanceByInterval, d0 = n0.shapeRatioType;
|
8201
8201
|
}
|
8202
8202
|
const x0 = i + s;
|
8203
8203
|
this._closedtrades = x0;
|
8204
|
-
const $ = this.initial_capital,
|
8205
|
-
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) /
|
8204
|
+
const $ = this.initial_capital, K = q + A, Z = f + _;
|
8205
|
+
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) / K : void 0, !this._options?.commission_value) {
|
8206
8206
|
this._netprofit = t + r;
|
8207
8207
|
const n0 = $ + this._netprofit;
|
8208
8208
|
this._preMaxNetValue = Math.max(this._preMaxNetValue || $, n0), this._preMinNetValue = Math.min(this._preMinNetValue || $, n0);
|
8209
8209
|
}
|
8210
|
-
if (this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 -
|
8210
|
+
if (this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 - K - Z, this._losstrades = Z, this._wintrades = K, this._preHistoryOrderCalcResult = {
|
8211
8211
|
netprofit_long: t,
|
8212
8212
|
netprofit_short: r,
|
8213
8213
|
closedtrades_long: i,
|
@@ -8236,12 +8236,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
8236
8236
|
maxprofit_percent_short: w,
|
8237
8237
|
maxloss_percent_long: x,
|
8238
8238
|
maxloss_percent_short: T,
|
8239
|
-
hold_long_k_count:
|
8240
|
-
hold_short_k_count:
|
8239
|
+
hold_long_k_count: S,
|
8240
|
+
hold_short_k_count: k,
|
8241
8241
|
hold_profit_long_k_count: I,
|
8242
8242
|
hold_profit_short_k_count: Y,
|
8243
8243
|
hold_loss_long_k_count: V,
|
8244
|
-
hold_loss_short_k_count:
|
8244
|
+
hold_loss_short_k_count: G,
|
8245
8245
|
balanceByInterval: t0,
|
8246
8246
|
shapeRatioType: d0
|
8247
8247
|
}, d0 !== "NONE") {
|
@@ -10058,13 +10058,13 @@ Example:
|
|
10058
10058
|
N(X.types[Q]) && (j = Math.min(j, X.types[Q].typeIndex));
|
10059
10059
|
return j;
|
10060
10060
|
}
|
10061
|
-
function
|
10061
|
+
function S(X) {
|
10062
10062
|
let j = s + 1;
|
10063
10063
|
for (let Q = 0; Q < X.types.length; Q++)
|
10064
10064
|
N(X.types[Q]) || (j = Math.min(j, X.types[Q].conversionIndex));
|
10065
10065
|
return j;
|
10066
10066
|
}
|
10067
|
-
function
|
10067
|
+
function k(X, j) {
|
10068
10068
|
if (X.hasAny) {
|
10069
10069
|
if (!j.hasAny)
|
10070
10070
|
return 1;
|
@@ -10085,7 +10085,7 @@ Example:
|
|
10085
10085
|
return -1;
|
10086
10086
|
if (Q > 0)
|
10087
10087
|
return 1;
|
10088
|
-
const p0 =
|
10088
|
+
const p0 = S(X) - S(j);
|
10089
10089
|
return p0 < 0 ? -1 : p0 > 0 ? 1 : 0;
|
10090
10090
|
}
|
10091
10091
|
function I(X, j) {
|
@@ -10121,7 +10121,7 @@ Example:
|
|
10121
10121
|
const Ce = [];
|
10122
10122
|
let Ct = 0;
|
10123
10123
|
for (let ki = 0; ki < Q.length; ++ki) {
|
10124
|
-
const As =
|
10124
|
+
const As = k(Q[ki], p0[ki]);
|
10125
10125
|
Ce.push(As), Ct += As;
|
10126
10126
|
}
|
10127
10127
|
if (Ct !== 0)
|
@@ -10152,7 +10152,7 @@ Example:
|
|
10152
10152
|
function V(X, j) {
|
10153
10153
|
let Q = j;
|
10154
10154
|
if (X.some((M0) => M0.hasConversion)) {
|
10155
|
-
const M0 = W(X), c0 = X.map(
|
10155
|
+
const M0 = W(X), c0 = X.map(G);
|
10156
10156
|
Q = function() {
|
10157
10157
|
const u0 = [], q0 = M0 ? arguments.length - 1 : arguments.length;
|
10158
10158
|
for (let z0 = 0; z0 < q0; z0++)
|
@@ -10169,7 +10169,7 @@ Example:
|
|
10169
10169
|
}
|
10170
10170
|
return p0;
|
10171
10171
|
}
|
10172
|
-
function
|
10172
|
+
function G(X) {
|
10173
10173
|
let j, Q, p0, M0;
|
10174
10174
|
const c0 = [], A0 = [];
|
10175
10175
|
switch (X.types.forEach(function(u0) {
|
@@ -10245,7 +10245,7 @@ Example:
|
|
10245
10245
|
return c0 ? A0 ? p0 === M0 : M0 >= p0 : A0 ? p0 >= M0 : p0 === M0;
|
10246
10246
|
}
|
10247
10247
|
function s0(X) {
|
10248
|
-
return X.map((j) => w0(j) ? Z(j.referToSelf.callback) : n0(j) ?
|
10248
|
+
return X.map((j) => w0(j) ? Z(j.referToSelf.callback) : n0(j) ? K(j.referTo.references, j.referTo.callback) : j);
|
10249
10249
|
}
|
10250
10250
|
function i0(X, j, Q) {
|
10251
10251
|
const p0 = [];
|
@@ -10377,9 +10377,9 @@ Example:
|
|
10377
10377
|
const X = s1(arguments).map((Q) => _(g(Q))), j = e1(arguments);
|
10378
10378
|
if (typeof j != "function")
|
10379
10379
|
throw new TypeError("Callback function expected as last argument");
|
10380
|
-
return
|
10380
|
+
return K(X, j);
|
10381
10381
|
}
|
10382
|
-
function
|
10382
|
+
function K(X, j) {
|
10383
10383
|
return {
|
10384
10384
|
referTo: {
|
10385
10385
|
references: X,
|
@@ -12022,30 +12022,30 @@ Example:
|
|
12022
12022
|
r.shift();
|
12023
12023
|
}
|
12024
12024
|
return function(r, i, s, o, a, c) {
|
12025
|
-
var p, b, M, l, u, O, d, _, f, A, q, g, W, v, y, L, D, N, w, x, T = r.constructor,
|
12026
|
-
if (!
|
12025
|
+
var p, b, M, l, u, O, d, _, f, A, q, g, W, v, y, L, D, N, w, x, T = r.constructor, S = r.s == i.s ? 1 : -1, k = r.d, I = i.d;
|
12026
|
+
if (!k || !k[0] || !I || !I[0])
|
12027
12027
|
return new T(
|
12028
12028
|
// Return NaN if either NaN, or both Infinity or 0.
|
12029
|
-
!r.s || !i.s || (
|
12029
|
+
!r.s || !i.s || (k ? I && k[0] == I[0] : !I) ? NaN : (
|
12030
12030
|
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
|
12031
|
-
|
12031
|
+
k && k[0] == 0 || !I ? S * 0 : S / 0
|
12032
12032
|
)
|
12033
12033
|
);
|
12034
|
-
for (c ? (u = 1, b = r.e - i.e) : (c = Tr, u = H0, b = at(r.e / u) - at(i.e / u)), w = I.length, D =
|
12034
|
+
for (c ? (u = 1, b = r.e - i.e) : (c = Tr, u = H0, b = at(r.e / u) - at(i.e / u)), w = I.length, D = k.length, f = new T(S), A = f.d = [], M = 0; I[M] == (k[M] || 0); M++)
|
12035
12035
|
;
|
12036
|
-
if (I[M] > (
|
12036
|
+
if (I[M] > (k[M] || 0) && b--, s == null ? (v = s = T.precision, o = T.rounding) : a ? v = s + (r.e - i.e) + 1 : v = s, v < 0)
|
12037
12037
|
A.push(1), O = !0;
|
12038
12038
|
else {
|
12039
12039
|
if (v = v / u + 2 | 0, M = 0, w == 1) {
|
12040
12040
|
for (l = 0, I = I[0], v++; (M < D || l) && v--; M++)
|
12041
|
-
y = l * c + (
|
12041
|
+
y = l * c + (k[M] || 0), A[M] = y / I | 0, l = y % I | 0;
|
12042
12042
|
O = l || M < D;
|
12043
12043
|
} else {
|
12044
|
-
for (l = c / (I[0] + 1) | 0, l > 1 && (I = n(I, l, c),
|
12044
|
+
for (l = c / (I[0] + 1) | 0, l > 1 && (I = n(I, l, c), k = n(k, l, c), w = I.length, D = k.length), L = w, q = k.slice(0, w), g = q.length; g < w; )
|
12045
12045
|
q[g++] = 0;
|
12046
12046
|
x = I.slice(), x.unshift(0), N = I[0], I[1] >= c / 2 && ++N;
|
12047
12047
|
do
|
12048
|
-
l = 0, p = e(I, q, w, g), p < 0 ? (W = q[0], w != g && (W = W * c + (q[1] || 0)), l = W / N | 0, l > 1 ? (l >= c && (l = c - 1), d = n(I, l, c), _ = d.length, g = q.length, p = e(d, q, _, g), p == 1 && (l--, t(d, w < _ ? x : I, _, c))) : (l == 0 && (p = l = 1), d = I.slice()), _ = d.length, _ < g && d.unshift(0), t(q, d, g, c), p == -1 && (g = q.length, p = e(I, q, w, g), p < 1 && (l++, t(q, w < g ? x : I, g, c))), g = q.length) : p === 0 && (l++, q = [0]), A[M++] = l, p && q[0] ? q[g++] =
|
12048
|
+
l = 0, p = e(I, q, w, g), p < 0 ? (W = q[0], w != g && (W = W * c + (q[1] || 0)), l = W / N | 0, l > 1 ? (l >= c && (l = c - 1), d = n(I, l, c), _ = d.length, g = q.length, p = e(d, q, _, g), p == 1 && (l--, t(d, w < _ ? x : I, _, c))) : (l == 0 && (p = l = 1), d = I.slice()), _ = d.length, _ < g && d.unshift(0), t(q, d, g, c), p == -1 && (g = q.length, p = e(I, q, w, g), p < 1 && (l++, t(q, w < g ? x : I, g, c))), g = q.length) : p === 0 && (l++, q = [0]), A[M++] = l, p && q[0] ? q[g++] = k[L] || 0 : (q = [k[L]], g = 1);
|
12049
12049
|
while ((L++ < D || q[0] !== void 0) && v--);
|
12050
12050
|
O = q[0] !== void 0;
|
12051
12051
|
}
|
@@ -13429,7 +13429,7 @@ Example:
|
|
13429
13429
|
return q !== f ? q > 1 && (A[q] = (A[q] || 0) + 1) : A[f] = (A[f] || 0) + 1, A;
|
13430
13430
|
}
|
13431
13431
|
var c = function(f, A) {
|
13432
|
-
var q = 0, g = 1, W = 1, v = 0, y = 0, L = 0, D = 1, N = 1, w = 0, x = 1, T = 1,
|
13432
|
+
var q = 0, g = 1, W = 1, v = 0, y = 0, L = 0, D = 1, N = 1, w = 0, x = 1, T = 1, S = 1, k = 1e7, I;
|
13433
13433
|
if (f != null)
|
13434
13434
|
if (A !== void 0) {
|
13435
13435
|
if (q = f, g = A, W = q * g, q % 1 !== 0 || g % 1 !== 0)
|
@@ -13450,12 +13450,12 @@ Example:
|
|
13450
13450
|
if (f < 0 && (W = f, f = -f), f % 1 === 0)
|
13451
13451
|
q = f;
|
13452
13452
|
else if (f > 0) {
|
13453
|
-
for (f >= 1 && (N = Math.pow(10, Math.floor(1 + Math.log(f) / Math.LN10)), f /= N); x <=
|
13454
|
-
if (I = (w + T) / (x +
|
13455
|
-
x +
|
13453
|
+
for (f >= 1 && (N = Math.pow(10, Math.floor(1 + Math.log(f) / Math.LN10)), f /= N); x <= k && S <= k; )
|
13454
|
+
if (I = (w + T) / (x + S), f === I) {
|
13455
|
+
x + S <= k ? (q = w + T, g = x + S) : S > x ? (q = T, g = S) : (q = w, g = x);
|
13456
13456
|
break;
|
13457
13457
|
} else
|
13458
|
-
f > I ? (w += T, x +=
|
13458
|
+
f > I ? (w += T, x += S) : (T += w, S += x), x > k ? (q = T, g = S) : (q = w, g = x);
|
13459
13459
|
q *= N;
|
13460
13460
|
} else
|
13461
13461
|
(isNaN(f) || isNaN(A)) && (g = q = NaN);
|
@@ -14471,14 +14471,14 @@ Example:
|
|
14471
14471
|
var q, g, W, v, y = _.min(), L = _.max();
|
14472
14472
|
for (q = 0, g = d._size.length; q < g; q++)
|
14473
14473
|
Ae(y[q], d._size[q]), Ae(L[q], d._size[q]);
|
14474
|
-
var D = d._values, N = d._index, w = d._ptr, x = _.dimension(0), T = _.dimension(1),
|
14475
|
-
x.forEach(function(
|
14476
|
-
|
14474
|
+
var D = d._values, N = d._index, w = d._ptr, x = _.dimension(0), T = _.dimension(1), S = [], k = [];
|
14475
|
+
x.forEach(function(G, t0) {
|
14476
|
+
k[G] = t0[0], S[G] = !0;
|
14477
14477
|
});
|
14478
14478
|
var I = D ? [] : void 0, Y = [], V = [];
|
14479
|
-
return T.forEach(function(
|
14480
|
-
for (V.push(Y.length), W = w[
|
14481
|
-
q = N[W],
|
14479
|
+
return T.forEach(function(G) {
|
14480
|
+
for (V.push(Y.length), W = w[G], v = w[G + 1]; W < v; W++)
|
14481
|
+
q = N[W], S[q] === !0 && (Y.push(k[q]), I && I.push(D[W]));
|
14482
14482
|
}), V.push(Y.length), new i({
|
14483
14483
|
values: I,
|
14484
14484
|
index: Y,
|
@@ -14515,8 +14515,8 @@ Example:
|
|
14515
14515
|
} else {
|
14516
14516
|
var D = _.dimension(0), N = _.dimension(1);
|
14517
14517
|
D.forEach(function(w, x) {
|
14518
|
-
Ae(w), N.forEach(function(T,
|
14519
|
-
Ae(T), d.set([w, T], f[x[0]][
|
14518
|
+
Ae(w), N.forEach(function(T, S) {
|
14519
|
+
Ae(T), d.set([w, T], f[x[0]][S[0]], A);
|
14520
14520
|
});
|
14521
14521
|
});
|
14522
14522
|
}
|
@@ -14601,12 +14601,12 @@ Example:
|
|
14601
14601
|
d._ptr[L] = d._values.length;
|
14602
14602
|
}
|
14603
14603
|
} else if (_ < y) {
|
14604
|
-
var
|
14604
|
+
var S = 0;
|
14605
14605
|
for (N = 0; N < L; N++) {
|
14606
|
-
d._ptr[N] = d._ptr[N] -
|
14607
|
-
var
|
14608
|
-
for (w =
|
14609
|
-
D = d._index[w], D > _ - 1 && (d._values.splice(w, 1), d._index.splice(w, 1),
|
14606
|
+
d._ptr[N] = d._ptr[N] - S;
|
14607
|
+
var k = d._ptr[N], I = d._ptr[N + 1] - S;
|
14608
|
+
for (w = k; w < I; w++)
|
14609
|
+
D = d._index[w], D > _ - 1 && (d._values.splice(w, 1), d._index.splice(w, 1), S++);
|
14610
14610
|
}
|
14611
14611
|
d._ptr[N] = d._values.length;
|
14612
14612
|
}
|
@@ -14617,8 +14617,8 @@ Example:
|
|
14617
14617
|
throw new TypeError("Array expected");
|
14618
14618
|
if (d.length !== 2)
|
14619
14619
|
throw new Error("Sparse matrices can only be reshaped in two dimensions");
|
14620
|
-
d.forEach(function(
|
14621
|
-
if (!re(
|
14620
|
+
d.forEach(function(G) {
|
14621
|
+
if (!re(G) || !fe(G) || G <= -2 || G === 0)
|
14622
14622
|
throw new TypeError("Invalid size, must contain positive integers or -1 (size: " + Q1(d) + ")");
|
14623
14623
|
});
|
14624
14624
|
var f = this._size[0] * this._size[1];
|
@@ -14639,9 +14639,9 @@ Example:
|
|
14639
14639
|
q._values.length = 0, q._index.length = 0, q._ptr.length = d[1] + 1, q._size = d.slice();
|
14640
14640
|
for (var T = 0; T < q._ptr.length; T++)
|
14641
14641
|
q._ptr[T] = 0;
|
14642
|
-
for (var
|
14643
|
-
var
|
14644
|
-
M(V,
|
14642
|
+
for (var S = 0; S < y.length; S++) {
|
14643
|
+
var k = L[S], I = g[S], Y = y[S], V = p(k, q._ptr[I], q._ptr[I + 1], q._index);
|
14644
|
+
M(V, k, I, Y, q._values, q._index, q._ptr);
|
14645
14645
|
}
|
14646
14646
|
return q;
|
14647
14647
|
}, i.prototype.clone = function() {
|
@@ -14670,16 +14670,16 @@ Example:
|
|
14670
14670
|
i0 = g(i0, k0, F0), D(i0, N) || (v.push(i0), y.push(k0));
|
14671
14671
|
}, x = A; x <= q; x++) {
|
14672
14672
|
L.push(v.length);
|
14673
|
-
var T = d._ptr[x],
|
14673
|
+
var T = d._ptr[x], S = d._ptr[x + 1];
|
14674
14674
|
if (W)
|
14675
|
-
for (var
|
14676
|
-
var I = d._index[
|
14677
|
-
I >= _ && I <= f && w(d._values[
|
14675
|
+
for (var k = T; k < S; k++) {
|
14676
|
+
var I = d._index[k];
|
14677
|
+
I >= _ && I <= f && w(d._values[k], I - _, x - A);
|
14678
14678
|
}
|
14679
14679
|
else {
|
14680
|
-
for (var Y = {}, V = T; V <
|
14681
|
-
var
|
14682
|
-
Y[
|
14680
|
+
for (var Y = {}, V = T; V < S; V++) {
|
14681
|
+
var G = d._index[V];
|
14682
|
+
Y[G] = d._values[V];
|
14683
14683
|
}
|
14684
14684
|
for (var t0 = _; t0 <= f; t0++) {
|
14685
14685
|
var d0 = t0 in Y ? Y[t0] : 0;
|
@@ -14790,10 +14790,10 @@ Example:
|
|
14790
14790
|
throw new TypeError("Array expected, size parameter");
|
14791
14791
|
if (d.length !== 2)
|
14792
14792
|
throw new Error("Only two dimensions matrix are supported");
|
14793
|
-
if (d = d.map(function(
|
14794
|
-
if (we(
|
14793
|
+
if (d = d.map(function(G) {
|
14794
|
+
if (we(G) && (G = G.toNumber()), !re(G) || !fe(G) || G < 1)
|
14795
14795
|
throw new Error("Size values must be positive integers");
|
14796
|
-
return
|
14796
|
+
return G;
|
14797
14797
|
}), f) {
|
14798
14798
|
if (we(f) && (f = f.toNumber()), !re(f) || !fe(f))
|
14799
14799
|
throw new TypeError("The parameter k must be an integer number");
|
@@ -14819,18 +14819,18 @@ Example:
|
|
14819
14819
|
w = function() {
|
14820
14820
|
return _;
|
14821
14821
|
};
|
14822
|
-
for (var T = [],
|
14823
|
-
|
14822
|
+
for (var T = [], S = [], k = [], I = 0; I < D; I++) {
|
14823
|
+
k.push(T.length);
|
14824
14824
|
var Y = I - v;
|
14825
14825
|
if (Y >= 0 && Y < N) {
|
14826
14826
|
var V = w(Y);
|
14827
|
-
g(V, W) || (
|
14827
|
+
g(V, W) || (S.push(Y + y), T.push(V));
|
14828
14828
|
}
|
14829
14829
|
}
|
14830
|
-
return
|
14830
|
+
return k.push(T.length), new i({
|
14831
14831
|
values: T,
|
14832
|
-
index:
|
14833
|
-
ptr:
|
14832
|
+
index: S,
|
14833
|
+
ptr: k,
|
14834
14834
|
size: [L, D]
|
14835
14835
|
});
|
14836
14836
|
}, i.prototype.swapRows = function(d, _) {
|
@@ -15218,8 +15218,8 @@ Example:
|
|
15218
15218
|
for (var v = [], y = [], L = [], D = 0; D < f; D++) {
|
15219
15219
|
L[D] = y.length;
|
15220
15220
|
for (var N = u[D], w = u[D + 1], x = N; x < w; x++) {
|
15221
|
-
var T = l[x],
|
15222
|
-
q(
|
15221
|
+
var T = l[x], S = a ? W(M[x], c[T][D]) : W(c[T][D], M[x]);
|
15222
|
+
q(S, g) || (y.push(T), v.push(S));
|
15223
15223
|
}
|
15224
15224
|
}
|
15225
15225
|
return L[f] = y.length, s.createSparseMatrix({
|
@@ -15251,8 +15251,8 @@ Example:
|
|
15251
15251
|
var T = M[x];
|
15252
15252
|
v[T] = o ? q(b[x], a[T][L]) : q(a[T][L], b[x]), y[T] = D;
|
15253
15253
|
}
|
15254
|
-
for (var
|
15255
|
-
y[
|
15254
|
+
for (var S = 0; S < d; S++)
|
15255
|
+
y[S] === D ? g[S][L] = v[S] : g[S][L] = o ? q(A, a[S][L]) : q(a[S][L], A);
|
15256
15256
|
}
|
15257
15257
|
return r.createDenseMatrix({
|
15258
15258
|
data: g,
|
@@ -15273,20 +15273,20 @@ Example:
|
|
15273
15273
|
throw new RangeError("Dimension mismatch. Matrix A (" + b + ") must match Matrix B (" + d + ")");
|
15274
15274
|
var f = b[0], A = b[1], q, g = t, W = 0, v = o;
|
15275
15275
|
typeof M == "string" && M === _ && M !== "mixed" && (q = M, g = e.find(t, [q, q]), W = e.convert(0, q), v = e.find(o, [q, q]));
|
15276
|
-
var y = a && l ? [] : void 0, L = [], D = [], N = y ? [] : void 0, w = y ? [] : void 0, x = [], T = [],
|
15277
|
-
for (
|
15278
|
-
D[
|
15279
|
-
var V =
|
15280
|
-
for (I = p[
|
15281
|
-
|
15282
|
-
for (I = O[
|
15283
|
-
|
15276
|
+
var y = a && l ? [] : void 0, L = [], D = [], N = y ? [] : void 0, w = y ? [] : void 0, x = [], T = [], S, k, I, Y;
|
15277
|
+
for (k = 0; k < A; k++) {
|
15278
|
+
D[k] = L.length;
|
15279
|
+
var V = k + 1;
|
15280
|
+
for (I = p[k], Y = p[k + 1]; I < Y; I++)
|
15281
|
+
S = c[I], L.push(S), x[S] = V, N && (N[S] = a[I]);
|
15282
|
+
for (I = O[k], Y = O[k + 1]; I < Y; I++)
|
15283
|
+
S = u[I], x[S] !== V && L.push(S), T[S] = V, w && (w[S] = l[I]);
|
15284
15284
|
if (y)
|
15285
|
-
for (I = D[
|
15286
|
-
|
15287
|
-
var
|
15288
|
-
if (
|
15289
|
-
var d0 =
|
15285
|
+
for (I = D[k]; I < L.length; ) {
|
15286
|
+
S = L[I];
|
15287
|
+
var G = x[S], t0 = T[S];
|
15288
|
+
if (G === V || t0 === V) {
|
15289
|
+
var d0 = G === V ? N[S] : W, s0 = t0 === V ? w[S] : W, i0 = v(d0, s0);
|
15290
15290
|
g(i0, W) ? L.splice(I, 1) : (y.push(i0), I++);
|
15291
15291
|
}
|
15292
15292
|
}
|
@@ -15425,23 +15425,23 @@ Example:
|
|
15425
15425
|
throw new RangeError("Dimension mismatch. Matrix A (" + b + ") must match Matrix B (" + d + ")");
|
15426
15426
|
var f = b[0], A = b[1], q, g = t, W = 0, v = o;
|
15427
15427
|
typeof M == "string" && M === _ && M !== "mixed" && (q = M, g = e.find(t, [q, q]), W = e.convert(0, q), v = e.find(o, [q, q]));
|
15428
|
-
var y = a && l ? [] : void 0, L = [], D = [], N = a && l ? [] : void 0, w = a && l ? [] : void 0, x = [], T = [],
|
15429
|
-
for (
|
15430
|
-
D[
|
15431
|
-
var
|
15432
|
-
for (Y = p[
|
15433
|
-
|
15434
|
-
for (Y = O[
|
15435
|
-
if (
|
15428
|
+
var y = a && l ? [] : void 0, L = [], D = [], N = a && l ? [] : void 0, w = a && l ? [] : void 0, x = [], T = [], S, k, I, Y, V;
|
15429
|
+
for (k = 0; k < A; k++) {
|
15430
|
+
D[k] = L.length;
|
15431
|
+
var G = k + 1;
|
15432
|
+
for (Y = p[k], V = p[k + 1], I = Y; I < V; I++)
|
15433
|
+
S = c[I], L.push(S), x[S] = G, N && (N[S] = a[I]);
|
15434
|
+
for (Y = O[k], V = O[k + 1], I = Y; I < V; I++)
|
15435
|
+
if (S = u[I], x[S] === G) {
|
15436
15436
|
if (N) {
|
15437
|
-
var t0 = v(N[
|
15438
|
-
g(t0, W) ? x[
|
15437
|
+
var t0 = v(N[S], l[I]);
|
15438
|
+
g(t0, W) ? x[S] = null : N[S] = t0;
|
15439
15439
|
}
|
15440
15440
|
} else
|
15441
|
-
L.push(
|
15441
|
+
L.push(S), T[S] = G, w && (w[S] = l[I]);
|
15442
15442
|
if (N && w)
|
15443
|
-
for (I = D[
|
15444
|
-
|
15443
|
+
for (I = D[k]; I < L.length; )
|
15444
|
+
S = L[I], x[S] === G ? (y[I] = N[S], I++) : T[S] === G ? (y[I] = w[S], I++) : L.splice(I, 1);
|
15445
15445
|
}
|
15446
15446
|
return D[A] = L.length, i.createSparseMatrix({
|
15447
15447
|
values: y,
|
@@ -15553,17 +15553,17 @@ Example:
|
|
15553
15553
|
return l(W, v);
|
15554
15554
|
}
|
15555
15555
|
function l(W, v) {
|
15556
|
-
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._data, w = v._size, x = v._datatype || v.getDataType(), T = L[0],
|
15557
|
-
D && x && D === x && typeof D == "string" && D !== "mixed" && (
|
15558
|
-
for (var V = [],
|
15559
|
-
for (var t0 = Y(y[0], N[0][
|
15560
|
-
t0 = I(t0, Y(y[d0], N[d0][
|
15561
|
-
V[
|
15556
|
+
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._data, w = v._size, x = v._datatype || v.getDataType(), T = L[0], S = w[1], k, I = r, Y = i;
|
15557
|
+
D && x && D === x && typeof D == "string" && D !== "mixed" && (k = D, I = e.find(r, [k, k]), Y = e.find(i, [k, k]));
|
15558
|
+
for (var V = [], G = 0; G < S; G++) {
|
15559
|
+
for (var t0 = Y(y[0], N[0][G]), d0 = 1; d0 < T; d0++)
|
15560
|
+
t0 = I(t0, Y(y[d0], N[d0][G]));
|
15561
|
+
V[G] = t0;
|
15562
15562
|
}
|
15563
15563
|
return W.createDenseMatrix({
|
15564
15564
|
data: V,
|
15565
|
-
size: [
|
15566
|
-
datatype: D === W._datatype && x === v._datatype ?
|
15565
|
+
size: [S],
|
15566
|
+
datatype: D === W._datatype && x === v._datatype ? k : void 0
|
15567
15567
|
});
|
15568
15568
|
}
|
15569
15569
|
var u = e("_multiplyMatrixVector", {
|
@@ -15576,57 +15576,57 @@ Example:
|
|
15576
15576
|
"SparseMatrix, SparseMatrix": g
|
15577
15577
|
});
|
15578
15578
|
function d(W, v) {
|
15579
|
-
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._data, w = v._datatype || v.getDataType(), x = L[0], T = L[1],
|
15580
|
-
D && w && D === w && typeof D == "string" && D !== "mixed" && (
|
15579
|
+
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._data, w = v._datatype || v.getDataType(), x = L[0], T = L[1], S, k = r, I = i;
|
15580
|
+
D && w && D === w && typeof D == "string" && D !== "mixed" && (S = D, k = e.find(r, [S, S]), I = e.find(i, [S, S]));
|
15581
15581
|
for (var Y = [], V = 0; V < x; V++) {
|
15582
|
-
for (var
|
15583
|
-
t0 =
|
15582
|
+
for (var G = y[V], t0 = I(G[0], N[0]), d0 = 1; d0 < T; d0++)
|
15583
|
+
t0 = k(t0, I(G[d0], N[d0]));
|
15584
15584
|
Y[V] = t0;
|
15585
15585
|
}
|
15586
15586
|
return W.createDenseMatrix({
|
15587
15587
|
data: Y,
|
15588
15588
|
size: [x],
|
15589
|
-
datatype: D === W._datatype && w === v._datatype ?
|
15589
|
+
datatype: D === W._datatype && w === v._datatype ? S : void 0
|
15590
15590
|
});
|
15591
15591
|
}
|
15592
15592
|
function _(W, v) {
|
15593
|
-
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._data, w = v._size, x = v._datatype || v.getDataType(), T = L[0],
|
15593
|
+
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._data, w = v._size, x = v._datatype || v.getDataType(), T = L[0], S = L[1], k = w[1], I, Y = r, V = i;
|
15594
15594
|
D && x && D === x && typeof D == "string" && D !== "mixed" && D !== "mixed" && (I = D, Y = e.find(r, [I, I]), V = e.find(i, [I, I]));
|
15595
|
-
for (var
|
15595
|
+
for (var G = [], t0 = 0; t0 < T; t0++) {
|
15596
15596
|
var d0 = y[t0];
|
15597
|
-
|
15598
|
-
for (var s0 = 0; s0 <
|
15599
|
-
for (var i0 = V(d0[0], N[0][s0]), k0 = 1; k0 <
|
15597
|
+
G[t0] = [];
|
15598
|
+
for (var s0 = 0; s0 < k; s0++) {
|
15599
|
+
for (var i0 = V(d0[0], N[0][s0]), k0 = 1; k0 < S; k0++)
|
15600
15600
|
i0 = Y(i0, V(d0[k0], N[k0][s0]));
|
15601
|
-
|
15601
|
+
G[t0][s0] = i0;
|
15602
15602
|
}
|
15603
15603
|
}
|
15604
15604
|
return W.createDenseMatrix({
|
15605
|
-
data:
|
15606
|
-
size: [T,
|
15605
|
+
data: G,
|
15606
|
+
size: [T, k],
|
15607
15607
|
datatype: D === W._datatype && x === v._datatype ? I : void 0
|
15608
15608
|
});
|
15609
15609
|
}
|
15610
15610
|
function f(W, v) {
|
15611
|
-
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._values, w = v._index, x = v._ptr, T = v._size,
|
15611
|
+
var y = W._data, L = W._size, D = W._datatype || W.getDataType(), N = v._values, w = v._index, x = v._ptr, T = v._size, S = v._datatype || v._data === void 0 ? v._datatype : v.getDataType();
|
15612
15612
|
if (!N)
|
15613
15613
|
throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");
|
15614
|
-
var
|
15615
|
-
D &&
|
15614
|
+
var k = L[0], I = T[1], Y, V = r, G = i, t0 = s, d0 = 0;
|
15615
|
+
D && S && D === S && typeof D == "string" && D !== "mixed" && (Y = D, V = e.find(r, [Y, Y]), G = e.find(i, [Y, Y]), t0 = e.find(s, [Y, Y]), d0 = e.convert(0, Y));
|
15616
15616
|
for (var s0 = [], i0 = [], k0 = [], F0 = v.createSparseMatrix({
|
15617
15617
|
values: s0,
|
15618
15618
|
index: i0,
|
15619
15619
|
ptr: k0,
|
15620
|
-
size: [
|
15621
|
-
datatype: D === W._datatype &&
|
15620
|
+
size: [k, I],
|
15621
|
+
datatype: D === W._datatype && S === v._datatype ? Y : void 0
|
15622
15622
|
}), B0 = 0; B0 < I; B0++) {
|
15623
15623
|
k0[B0] = i0.length;
|
15624
15624
|
var f0 = x[B0], s1 = x[B0 + 1];
|
15625
15625
|
if (s1 > f0)
|
15626
|
-
for (var e1 = 0, n1 = 0; n1 <
|
15626
|
+
for (var e1 = 0, n1 = 0; n1 < k; n1++) {
|
15627
15627
|
for (var K0 = n1 + 1, x0 = void 0, $ = f0; $ < s1; $++) {
|
15628
|
-
var
|
15629
|
-
e1 !== K0 ? (x0 =
|
15628
|
+
var K = w[$];
|
15629
|
+
e1 !== K0 ? (x0 = G(y[n1][K], N[$]), e1 = K0) : x0 = V(x0, G(y[n1][K], N[$]));
|
15630
15630
|
}
|
15631
15631
|
e1 === K0 && !t0(x0, d0) && (i0.push(n1), s0.push(x0));
|
15632
15632
|
}
|
@@ -15637,24 +15637,24 @@ Example:
|
|
15637
15637
|
var y = W._values, L = W._index, D = W._ptr, N = W._datatype || W._data === void 0 ? W._datatype : W.getDataType();
|
15638
15638
|
if (!y)
|
15639
15639
|
throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");
|
15640
|
-
var w = v._data, x = v._datatype || v.getDataType(), T = W._size[0],
|
15641
|
-
N && x && N === x && typeof N == "string" && N !== "mixed" && (V = N,
|
15640
|
+
var w = v._data, x = v._datatype || v.getDataType(), T = W._size[0], S = v._size[0], k = [], I = [], Y = [], V, G = r, t0 = i, d0 = s, s0 = 0;
|
15641
|
+
N && x && N === x && typeof N == "string" && N !== "mixed" && (V = N, G = e.find(r, [V, V]), t0 = e.find(i, [V, V]), d0 = e.find(s, [V, V]), s0 = e.convert(0, V));
|
15642
15642
|
var i0 = [], k0 = [];
|
15643
15643
|
Y[0] = 0;
|
15644
|
-
for (var F0 = 0; F0 <
|
15644
|
+
for (var F0 = 0; F0 < S; F0++) {
|
15645
15645
|
var B0 = w[F0];
|
15646
15646
|
if (!d0(B0, s0))
|
15647
15647
|
for (var f0 = D[F0], s1 = D[F0 + 1], e1 = f0; e1 < s1; e1++) {
|
15648
15648
|
var n1 = L[e1];
|
15649
|
-
k0[n1] ? i0[n1] =
|
15649
|
+
k0[n1] ? i0[n1] = G(i0[n1], t0(B0, y[e1])) : (k0[n1] = !0, I.push(n1), i0[n1] = t0(B0, y[e1]));
|
15650
15650
|
}
|
15651
15651
|
}
|
15652
15652
|
for (var K0 = I.length, x0 = 0; x0 < K0; x0++) {
|
15653
15653
|
var $ = I[x0];
|
15654
|
-
|
15654
|
+
k[x0] = i0[$];
|
15655
15655
|
}
|
15656
15656
|
return Y[1] = I.length, W.createSparseMatrix({
|
15657
|
-
values:
|
15657
|
+
values: k,
|
15658
15658
|
index: I,
|
15659
15659
|
ptr: Y,
|
15660
15660
|
size: [T, 1],
|
@@ -15665,22 +15665,22 @@ Example:
|
|
15665
15665
|
var y = W._values, L = W._index, D = W._ptr, N = W._datatype || W._data === void 0 ? W._datatype : W.getDataType();
|
15666
15666
|
if (!y)
|
15667
15667
|
throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");
|
15668
|
-
var w = v._data, x = v._datatype || v.getDataType(), T = W._size[0],
|
15669
|
-
N && x && N === x && typeof N == "string" && N !== "mixed" && (I = N, Y = e.find(r, [I, I]), V = e.find(i, [I, I]),
|
15668
|
+
var w = v._data, x = v._datatype || v.getDataType(), T = W._size[0], S = v._size[0], k = v._size[1], I, Y = r, V = i, G = s, t0 = 0;
|
15669
|
+
N && x && N === x && typeof N == "string" && N !== "mixed" && (I = N, Y = e.find(r, [I, I]), V = e.find(i, [I, I]), G = e.find(s, [I, I]), t0 = e.convert(0, I));
|
15670
15670
|
for (var d0 = [], s0 = [], i0 = [], k0 = W.createSparseMatrix({
|
15671
15671
|
values: d0,
|
15672
15672
|
index: s0,
|
15673
15673
|
ptr: i0,
|
15674
|
-
size: [T,
|
15674
|
+
size: [T, k],
|
15675
15675
|
datatype: N === W._datatype && x === v._datatype ? I : void 0
|
15676
|
-
}), F0 = [], B0 = [], f0 = 0; f0 <
|
15676
|
+
}), F0 = [], B0 = [], f0 = 0; f0 < k; f0++) {
|
15677
15677
|
i0[f0] = s0.length;
|
15678
|
-
for (var s1 = f0 + 1, e1 = 0; e1 <
|
15678
|
+
for (var s1 = f0 + 1, e1 = 0; e1 < S; e1++) {
|
15679
15679
|
var n1 = w[e1][f0];
|
15680
|
-
if (!
|
15680
|
+
if (!G(n1, t0))
|
15681
15681
|
for (var K0 = D[e1], x0 = D[e1 + 1], $ = K0; $ < x0; $++) {
|
15682
|
-
var
|
15683
|
-
B0[
|
15682
|
+
var K = L[$];
|
15683
|
+
B0[K] !== s1 ? (B0[K] = s1, s0.push(K), F0[K] = V(n1, y[$])) : F0[K] = Y(F0[K], V(n1, y[$]));
|
15684
15684
|
}
|
15685
15685
|
}
|
15686
15686
|
for (var Z = i0[f0], n0 = s0.length, w0 = Z; w0 < n0; w0++) {
|
@@ -15688,26 +15688,26 @@ Example:
|
|
15688
15688
|
d0[w0] = F0[a1];
|
15689
15689
|
}
|
15690
15690
|
}
|
15691
|
-
return i0[
|
15691
|
+
return i0[k] = s0.length, k0;
|
15692
15692
|
}
|
15693
15693
|
function g(W, v) {
|
15694
|
-
var y = W._values, L = W._index, D = W._ptr, N = W._datatype || W._data === void 0 ? W._datatype : W.getDataType(), w = v._values, x = v._index, T = v._ptr,
|
15695
|
-
N &&
|
15694
|
+
var y = W._values, L = W._index, D = W._ptr, N = W._datatype || W._data === void 0 ? W._datatype : W.getDataType(), w = v._values, x = v._index, T = v._ptr, S = v._datatype || v._data === void 0 ? v._datatype : v.getDataType(), k = W._size[0], I = v._size[1], Y = y && w, V, G = r, t0 = i;
|
15695
|
+
N && S && N === S && typeof N == "string" && N !== "mixed" && (V = N, G = e.find(r, [V, V]), t0 = e.find(i, [V, V]));
|
15696
15696
|
for (var d0 = Y ? [] : void 0, s0 = [], i0 = [], k0 = W.createSparseMatrix({
|
15697
15697
|
values: d0,
|
15698
15698
|
index: s0,
|
15699
15699
|
ptr: i0,
|
15700
|
-
size: [
|
15701
|
-
datatype: N === W._datatype &&
|
15702
|
-
}), F0 = Y ? [] : void 0, B0 = [], f0, s1, e1, n1, K0, x0, $,
|
15700
|
+
size: [k, I],
|
15701
|
+
datatype: N === W._datatype && S === v._datatype ? V : void 0
|
15702
|
+
}), F0 = Y ? [] : void 0, B0 = [], f0, s1, e1, n1, K0, x0, $, K, Z = 0; Z < I; Z++) {
|
15703
15703
|
i0[Z] = s0.length;
|
15704
15704
|
var n0 = Z + 1;
|
15705
15705
|
for (K0 = T[Z], x0 = T[Z + 1], n1 = K0; n1 < x0; n1++)
|
15706
|
-
if (
|
15707
|
-
for (s1 = D[
|
15708
|
-
$ = L[f0], B0[$] !== n0 ? (B0[$] = n0, s0.push($), F0[$] = t0(w[n1], y[f0])) : F0[$] =
|
15706
|
+
if (K = x[n1], Y)
|
15707
|
+
for (s1 = D[K], e1 = D[K + 1], f0 = s1; f0 < e1; f0++)
|
15708
|
+
$ = L[f0], B0[$] !== n0 ? (B0[$] = n0, s0.push($), F0[$] = t0(w[n1], y[f0])) : F0[$] = G(F0[$], t0(w[n1], y[f0]));
|
15709
15709
|
else
|
15710
|
-
for (s1 = D[
|
15710
|
+
for (s1 = D[K], e1 = D[K + 1], f0 = s1; f0 < e1; f0++)
|
15711
15711
|
$ = L[f0], B0[$] !== n0 && (B0[$] = n0, s0.push($));
|
15712
15712
|
if (Y)
|
15713
15713
|
for (var w0 = i0[Z], a1 = s0.length, P1 = w0; P1 < a1; P1++) {
|
@@ -17474,8 +17474,8 @@ Example:
|
|
17474
17474
|
return D.g(4) | 0;
|
17475
17475
|
}, N.quick = function() {
|
17476
17476
|
return D.g(4) / 4294967296;
|
17477
|
-
}, N.double = N, f(q(D.S), t), (W.pass || v || function(w, x, T,
|
17478
|
-
return
|
17477
|
+
}, N.double = N, f(q(D.S), t), (W.pass || v || function(w, x, T, S) {
|
17478
|
+
return S && (S.S && d(S, D), w.state = function() {
|
17479
17479
|
return d(D, {});
|
17480
17480
|
}), T ? (r[a] = w, x) : w;
|
17481
17481
|
})(
|
@@ -17492,9 +17492,9 @@ Example:
|
|
17492
17492
|
for (L = 0; L < i; L++)
|
17493
17493
|
N[L] = N[D = M & D + g[L % v] + (W = N[L])], N[D] = W;
|
17494
17494
|
(y.g = function(w) {
|
17495
|
-
for (var x, T = 0,
|
17496
|
-
x = I[
|
17497
|
-
return y.i =
|
17495
|
+
for (var x, T = 0, S = y.i, k = y.j, I = y.S; w--; )
|
17496
|
+
x = I[S = M & S + 1], T = T * i + I[M & (I[S] = I[k = M & k + x]) + (I[k] = x)];
|
17497
|
+
return y.i = S, y.j = k, T;
|
17498
17498
|
})(i);
|
17499
17499
|
}
|
17500
17500
|
function d(g, W) {
|
@@ -19720,8 +19720,8 @@ Example:
|
|
19720
19720
|
let L = f * c / b;
|
19721
19721
|
A += L, L += y, O = O - L, Object.assign(e, { commission: L });
|
19722
19722
|
const D = this._orders.reduce((N, w) => {
|
19723
|
-
const { qty: x = 0, original_qty: T = 0, commission:
|
19724
|
-
return N +
|
19723
|
+
const { qty: x = 0, original_qty: T = 0, commission: S = 0 } = w;
|
19724
|
+
return N + S * x / T;
|
19725
19725
|
}, 0);
|
19726
19726
|
q += D - l;
|
19727
19727
|
}
|
@@ -19954,45 +19954,45 @@ ${u}`), u;
|
|
19954
19954
|
if (T === null)
|
19955
19955
|
return;
|
19956
19956
|
} else if (a)
|
19957
|
-
for (const [T,
|
19958
|
-
let { time:
|
19959
|
-
|
19960
|
-
const Y = L[T + 1]?.time * 1e3 ||
|
19961
|
-
if (
|
19957
|
+
for (const [T, S] of L.entries()) {
|
19958
|
+
let { time: k, barIndex: I } = S;
|
19959
|
+
k = k * 1e3;
|
19960
|
+
const Y = L[T + 1]?.time * 1e3 || k + q, V = I || W + T;
|
19961
|
+
if (k >= N) {
|
19962
19962
|
this._reqCacheData[t] = {
|
19963
19963
|
index: V,
|
19964
19964
|
periodStamp: v
|
19965
19965
|
};
|
19966
19966
|
return;
|
19967
19967
|
}
|
19968
|
-
if (
|
19968
|
+
if (k <= D && Y > D)
|
19969
19969
|
return this._reqCacheData[t] = {
|
19970
19970
|
index: V,
|
19971
19971
|
periodStamp: v
|
19972
|
-
}, { ...
|
19972
|
+
}, { ...S, barIndex: V, nextBarTime: L[T + 1]?.time, ...x };
|
19973
19973
|
}
|
19974
19974
|
else
|
19975
|
-
for (const [T,
|
19976
|
-
let { time:
|
19977
|
-
|
19978
|
-
const Y = L[T + 1]?.time * 1e3 ||
|
19979
|
-
if (
|
19975
|
+
for (const [T, S] of L.entries()) {
|
19976
|
+
let { time: k, barIndex: I } = S;
|
19977
|
+
k = k * 1e3;
|
19978
|
+
const Y = L[T + 1]?.time * 1e3 || k + q, V = I || W + T;
|
19979
|
+
if (k > N) {
|
19980
19980
|
this._reqCacheData[t] = {
|
19981
19981
|
index: V,
|
19982
19982
|
periodStamp: v
|
19983
19983
|
};
|
19984
19984
|
return;
|
19985
19985
|
}
|
19986
|
-
if (
|
19986
|
+
if (k < N && N <= Y)
|
19987
19987
|
return this._reqCacheData[t] = {
|
19988
19988
|
index: V,
|
19989
19989
|
periodStamp: v
|
19990
|
-
}, { ...
|
19991
|
-
if (
|
19990
|
+
}, { ...S, barIndex: V, nextBarTime: L[T + 1]?.time, ...x };
|
19991
|
+
if (k >= D && k <= N && V === x.lastBarIndex)
|
19992
19992
|
return this._reqCacheData[t] = {
|
19993
19993
|
index: V,
|
19994
19994
|
periodStamp: v
|
19995
|
-
}, { ...
|
19995
|
+
}, { ...S, barIndex: V, nextBarTime: L[T + 1]?.time, ...x };
|
19996
19996
|
}
|
19997
19997
|
this._reqCacheData[t] = {
|
19998
19998
|
index: y.length,
|
@@ -21083,15 +21083,15 @@ ${u}`), u;
|
|
21083
21083
|
else if (r && r.length) {
|
21084
21084
|
const N = r.length - 1;
|
21085
21085
|
A.__isFirstRun = t, A.updateOptions({ interval: o, mintick: _, chart: c, syminfo: s }), g.updateOptions({ inputs: a, strategy: p });
|
21086
|
-
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`),
|
21086
|
+
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`), S = Date.now();
|
21087
21087
|
try {
|
21088
|
-
let
|
21088
|
+
let k;
|
21089
21089
|
const I = self.workerStorage.get(`request_${l}_list`);
|
21090
21090
|
for (const [Y, V] of r.entries()) {
|
21091
|
-
const { barindex:
|
21092
|
-
if (
|
21091
|
+
const { barindex: G } = V;
|
21092
|
+
if (G && !A._isRealTimeBar && G <= A.bar_index)
|
21093
21093
|
continue;
|
21094
|
-
if (Date.now() -
|
21094
|
+
if (Date.now() - S > 4e4)
|
21095
21095
|
return xs(l), {
|
21096
21096
|
status: 1,
|
21097
21097
|
errors: [{
|
@@ -21103,11 +21103,11 @@ ${u}`), u;
|
|
21103
21103
|
type: We.Error
|
21104
21104
|
}]
|
21105
21105
|
};
|
21106
|
-
!t && (
|
21107
|
-
const t0 = await gO(A, g, q, W, b,
|
21106
|
+
!t && (G || G === 0) && O.push(G);
|
21107
|
+
const t0 = await gO(A, g, q, W, b, k, T, { newCacheData: f, cacheData: d }, w, x, I);
|
21108
21108
|
if (t0)
|
21109
21109
|
return t0;
|
21110
|
-
|
21110
|
+
k = Object.assign(V, { barIndex: G || Y, lastBarIndex: r[N].barindex || N, lastBarTime: r[N].time, nextBarTime: r[Y + 1]?.time }), Cf(A, g, q, W, b, k, w);
|
21111
21111
|
const d0 = g.errors;
|
21112
21112
|
if (d0.length && d0.some((s0) => s0.type === We.Error))
|
21113
21113
|
return xs(l), {
|
@@ -21116,7 +21116,7 @@ ${u}`), u;
|
|
21116
21116
|
};
|
21117
21117
|
}
|
21118
21118
|
if (w?.size) {
|
21119
|
-
const Y = await gO(A, g, q, W, b,
|
21119
|
+
const Y = await gO(A, g, q, W, b, k, T, { newCacheData: f, cacheData: d }, w, x, I);
|
21120
21120
|
if (Y)
|
21121
21121
|
return xs(l), Y;
|
21122
21122
|
}
|
@@ -21134,8 +21134,8 @@ ${u}`), u;
|
|
21134
21134
|
};
|
21135
21135
|
if (I?.size) {
|
21136
21136
|
const Y = /* @__PURE__ */ new Map();
|
21137
|
-
for (const [V,
|
21138
|
-
y.push(
|
21137
|
+
for (const [V, G] of I)
|
21138
|
+
y.push(G), t && x?.has(V) && Y.set(V, x.get(V));
|
21139
21139
|
t && self.workerStorage.set(`request_${l}_data`, Y);
|
21140
21140
|
}
|
21141
21141
|
t && self.workerStorage.delete(`request_${l}_tmp`), f.requestCacheData = {
|
@@ -21146,15 +21146,15 @@ ${u}`), u;
|
|
21146
21146
|
requestData: Array.from(x || /* @__PURE__ */ new Map()),
|
21147
21147
|
requestTmp: Array.from(self.workerStorage.get(`request_${l}_tmp`) || /* @__PURE__ */ new Map())
|
21148
21148
|
};
|
21149
|
-
} catch (
|
21150
|
-
return console.log(
|
21149
|
+
} catch (k) {
|
21150
|
+
return console.log(k), xs(l), {
|
21151
21151
|
status: 1,
|
21152
21152
|
errors: [{
|
21153
21153
|
endLineNumber: 0,
|
21154
21154
|
startColumn: 0,
|
21155
21155
|
endColumn: 0,
|
21156
21156
|
startLineNumber: 0,
|
21157
|
-
message:
|
21157
|
+
message: k?.message,
|
21158
21158
|
type: We.Error
|
21159
21159
|
}]
|
21160
21160
|
};
|
@@ -21727,7 +21727,7 @@ ${u}`), u;
|
|
21727
21727
|
_calcMaxContracts() {
|
21728
21728
|
const e = this._orders.length;
|
21729
21729
|
if (!e) {
|
21730
|
-
this._position_size = 0, this._position_avg_price = void 0, this._opentrades_capital_held = 0;
|
21730
|
+
this._position_size = 0, this._position_avg_price = void 0, this._opentrades_capital_held = 0, this.opentrades_long = 0, this.opentrades_short = 0, this.position_size_long = 0, this.position_size_short = 0, this.position_size_total = 0, this._openprofit = 0, this.openprofit_long = 0, this.openprofit_short = 0;
|
21731
21731
|
return;
|
21732
21732
|
}
|
21733
21733
|
this._firstPrice === void 0 && (this._firstPrice = this._orders[0].in_price);
|
@@ -21809,29 +21809,29 @@ ${u}`), u;
|
|
21809
21809
|
maxprofit_percent_short: w = 0,
|
21810
21810
|
maxloss_percent_long: x = 0,
|
21811
21811
|
maxloss_percent_short: T = 0,
|
21812
|
-
hold_long_k_count:
|
21813
|
-
hold_short_k_count:
|
21812
|
+
hold_long_k_count: S = 0,
|
21813
|
+
hold_short_k_count: k = 0,
|
21814
21814
|
hold_profit_long_k_count: I = 0,
|
21815
21815
|
hold_profit_short_k_count: Y = 0,
|
21816
21816
|
hold_loss_long_k_count: V = 0,
|
21817
|
-
hold_loss_short_k_count:
|
21817
|
+
hold_loss_short_k_count: G = 0,
|
21818
21818
|
balanceByInterval: t0,
|
21819
21819
|
shapeRatioType: d0 = "NONE"
|
21820
21820
|
} = this._preHistoryOrderCalcResult;
|
21821
21821
|
const { profit: s0 = 0, profit_percent: i0 = 0, in_index: k0 = 0, out_index: F0 = 0, commission: B0 = 0, direction: f0, in_time: s1 = 0, out_time: e1 = 0, total_profit: n1 = 0 } = e, K0 = F0 - k0 + 1;
|
21822
|
-
if (f0 === f1.long ? (t += s0, i += 1, o += i0, g += B0,
|
21822
|
+
if (f0 === f1.long ? (t += s0, i += 1, o += i0, g += B0, S += K0, s0 > 0 ? (b += i0, A += 1, O += s0, I += K0, v = Math.max(v, s0), N = Math.max(N, i0)) : s0 < 0 && (c += i0, _ += 1, l += s0, V += K0, L = Math.min(L, s0), x = Math.min(x, i0))) : (r += s0, s += 1, a += i0, W += B0, k += K0, s0 > 0 ? (M += i0, q += 1, d += s0, Y += K0, y = Math.max(y, s0), w = Math.max(w, i0)) : s0 < 0 && (p += i0, f += 1, u += s0, G += K0, D = Math.min(D, s0), T = Math.min(T, i0))), !t0) {
|
21823
21823
|
const n0 = this._createBalanceByInterval(s1, Date.now());
|
21824
21824
|
t0 = n0.balanceByInterval, d0 = n0.shapeRatioType;
|
21825
21825
|
}
|
21826
21826
|
const x0 = i + s;
|
21827
21827
|
this._closedtrades = x0;
|
21828
|
-
const $ = this.initial_capital,
|
21829
|
-
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) /
|
21828
|
+
const $ = this.initial_capital, K = q + A, Z = f + _;
|
21829
|
+
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) / K : void 0, !this._options?.commission_value) {
|
21830
21830
|
this._netprofit = t + r;
|
21831
21831
|
const n0 = $ + this._netprofit;
|
21832
21832
|
this._preMaxNetValue = Math.max(this._preMaxNetValue || $, n0), this._preMinNetValue = Math.min(this._preMinNetValue || $, n0);
|
21833
21833
|
}
|
21834
|
-
if (this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 -
|
21834
|
+
if (this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 - K - Z, this._losstrades = Z, this._wintrades = K, this._preHistoryOrderCalcResult = {
|
21835
21835
|
netprofit_long: t,
|
21836
21836
|
netprofit_short: r,
|
21837
21837
|
closedtrades_long: i,
|
@@ -21860,12 +21860,12 @@ ${u}`), u;
|
|
21860
21860
|
maxprofit_percent_short: w,
|
21861
21861
|
maxloss_percent_long: x,
|
21862
21862
|
maxloss_percent_short: T,
|
21863
|
-
hold_long_k_count:
|
21864
|
-
hold_short_k_count:
|
21863
|
+
hold_long_k_count: S,
|
21864
|
+
hold_short_k_count: k,
|
21865
21865
|
hold_profit_long_k_count: I,
|
21866
21866
|
hold_profit_short_k_count: Y,
|
21867
21867
|
hold_loss_long_k_count: V,
|
21868
|
-
hold_loss_short_k_count:
|
21868
|
+
hold_loss_short_k_count: G,
|
21869
21869
|
balanceByInterval: t0,
|
21870
21870
|
shapeRatioType: d0
|
21871
21871
|
}, d0 !== "NONE") {
|
@@ -22724,13 +22724,22 @@ ${u}`), u;
|
|
22724
22724
|
return this._allInstance;
|
22725
22725
|
}
|
22726
22726
|
get data() {
|
22727
|
-
const e =
|
22728
|
-
for (const
|
22729
|
-
if (!t.some((
|
22730
|
-
const
|
22731
|
-
|
22727
|
+
const e = /* @__PURE__ */ new Map(), t = C0.flatMap([...this._deleteIds.values()]), r = C0.uniq([...this._all.keys(), ...this._tmpData.keys()]), i = [];
|
22728
|
+
for (const a of r)
|
22729
|
+
if (!t.some((c) => c.key === a)) {
|
22730
|
+
const c = this._tmpData.get(a) || this._all.get(a), p = c?.id;
|
22731
|
+
c && (i.push(a), e.set(p, c));
|
22732
|
+
}
|
22733
|
+
const s = Array.from(e.values());
|
22734
|
+
this._variables._isRealTimeBar && this._preDeleteIds.set(this._variables.last_bar_index, this._deleteIds.get(this._variables.last_bar_index) || []), this._tmpDataHandle();
|
22735
|
+
const o = i.length - this._maxLength;
|
22736
|
+
if (o > 0)
|
22737
|
+
for (const [a, c] of i.entries()) {
|
22738
|
+
if (a >= o)
|
22739
|
+
break;
|
22740
|
+
this._allInstance.delete(c), this._all.delete(c);
|
22732
22741
|
}
|
22733
|
-
return
|
22742
|
+
return s.slice(-this._maxLength);
|
22734
22743
|
}
|
22735
22744
|
add(e, t, r) {
|
22736
22745
|
if (this.set(e, t, r), !this._variables._isRealTimeBar && this._all.size > this._maxLength) {
|
@@ -23436,7 +23445,7 @@ ${u}`), u;
|
|
23436
23445
|
random({ min: e = 0, max: t = 1, seed: r }) {
|
23437
23446
|
i1(e) && (e = 0), i1(t) && (t = 1);
|
23438
23447
|
let i = Math.random;
|
23439
|
-
r && (i = new wM(r));
|
23448
|
+
r && (i = new wM(`${e}${t}${r}`));
|
23440
23449
|
let s;
|
23441
23450
|
if (t === e)
|
23442
23451
|
s = e;
|
@@ -26483,8 +26492,8 @@ ${u}`), u;
|
|
26483
26492
|
let L = f * c / b;
|
26484
26493
|
A += L, L += y, O = O - L, Object.assign(e, { commission: L });
|
26485
26494
|
const D = this._orders.reduce((N, w) => {
|
26486
|
-
const { qty: x = 0, original_qty: T = 0, commission:
|
26487
|
-
return N +
|
26495
|
+
const { qty: x = 0, original_qty: T = 0, commission: S = 0 } = w;
|
26496
|
+
return N + S * x / T;
|
26488
26497
|
}, 0);
|
26489
26498
|
q += D - l;
|
26490
26499
|
}
|
@@ -26690,7 +26699,7 @@ ${u}`), u;
|
|
26690
26699
|
originTimeframe: u,
|
26691
26700
|
timeframe: NB[u] || DB(u)
|
26692
26701
|
};
|
26693
|
-
if (_?.get(O) || f?.set(O, A), _?.set(O, A), d?.has(O)) {
|
26702
|
+
if (_?.get(O) || (f?.set(O, A), _?.set(O, A)), d?.has(O)) {
|
26694
26703
|
let g = jt(u, M) * 1e3;
|
26695
26704
|
const W = jt(p, M) * 1e3, {
|
26696
26705
|
index: v = 0,
|
@@ -26710,51 +26719,51 @@ ${u}`), u;
|
|
26710
26719
|
mintick: b
|
26711
26720
|
};
|
26712
26721
|
if (g > y) {
|
26713
|
-
let
|
26714
|
-
if (a ?
|
26715
|
-
return
|
26716
|
-
if (
|
26722
|
+
let S;
|
26723
|
+
if (a ? S = this._lookaheadOnHandle(D, u, w, g, T, v, y, t, N, o) : S = this._lookaheadOffHandle(D, u, w, g, T, v, y, t, N, l || w, o), S)
|
26724
|
+
return S;
|
26725
|
+
if (S === null)
|
26717
26726
|
return;
|
26718
26727
|
} else if (a)
|
26719
|
-
for (const [
|
26720
|
-
let { time: I, barIndex: Y } =
|
26728
|
+
for (const [S, k] of D.entries()) {
|
26729
|
+
let { time: I, barIndex: Y } = k;
|
26721
26730
|
I = I * 1e3;
|
26722
|
-
const V = D[
|
26731
|
+
const V = D[S + 1]?.time * 1e3 || I + g, G = Y || v + S;
|
26723
26732
|
if (I >= w) {
|
26724
26733
|
this._reqCacheDataLoc[t] = {
|
26725
|
-
index:
|
26734
|
+
index: G,
|
26726
26735
|
periodStamp: y
|
26727
26736
|
};
|
26728
26737
|
return;
|
26729
26738
|
}
|
26730
26739
|
if (I <= N && V > N)
|
26731
26740
|
return this._reqCacheDataLoc[t] = {
|
26732
|
-
index:
|
26741
|
+
index: G,
|
26733
26742
|
periodStamp: y
|
26734
|
-
}, { ...
|
26743
|
+
}, { ...k, barIndex: G, nextBarTime: D[S + 1]?.time, ...T };
|
26735
26744
|
}
|
26736
26745
|
else
|
26737
|
-
for (const [
|
26738
|
-
let { time: I, barIndex: Y } =
|
26746
|
+
for (const [S, k] of D.entries()) {
|
26747
|
+
let { time: I, barIndex: Y } = k;
|
26739
26748
|
I = I * 1e3;
|
26740
|
-
const V = D[
|
26749
|
+
const V = D[S + 1]?.time * 1e3 || I + g, G = Y || v + S;
|
26741
26750
|
if (I > w) {
|
26742
26751
|
this._reqCacheDataLoc[t] = {
|
26743
|
-
index:
|
26752
|
+
index: G,
|
26744
26753
|
periodStamp: y
|
26745
26754
|
};
|
26746
26755
|
return;
|
26747
26756
|
}
|
26748
26757
|
if (I < w && w <= V)
|
26749
26758
|
return this._reqCacheDataLoc[t] = {
|
26750
|
-
index:
|
26759
|
+
index: G,
|
26751
26760
|
periodStamp: y
|
26752
|
-
}, { ...
|
26753
|
-
if (I >= N && I <= w &&
|
26761
|
+
}, { ...k, barIndex: G, nextBarTime: D[S + 1]?.time, ...T };
|
26762
|
+
if (I >= N && I <= w && G === T.lastBarIndex)
|
26754
26763
|
return this._reqCacheDataLoc[t] = {
|
26755
|
-
index:
|
26764
|
+
index: G,
|
26756
26765
|
periodStamp: y
|
26757
|
-
}, { ...
|
26766
|
+
}, { ...k, barIndex: G, nextBarTime: D[S + 1]?.time, ...T };
|
26758
26767
|
}
|
26759
26768
|
this._reqCacheDataLoc[t] = {
|
26760
26769
|
index: L.length,
|
@@ -27462,15 +27471,15 @@ ${u}`), u;
|
|
27462
27471
|
else if (r && r.length) {
|
27463
27472
|
const N = r.length - 1;
|
27464
27473
|
A.__isFirstRun = t, A.updateOptions({ interval: o, mintick: _, chart: c, syminfo: s }), g.updateOptions({ inputs: a, strategy: p });
|
27465
|
-
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`),
|
27474
|
+
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`), S = Date.now();
|
27466
27475
|
try {
|
27467
|
-
let
|
27476
|
+
let k;
|
27468
27477
|
const I = self.workerStorage.get(`request_${l}_list`);
|
27469
27478
|
for (const [Y, V] of r.entries()) {
|
27470
|
-
const { barindex:
|
27471
|
-
if (
|
27479
|
+
const { barindex: G } = V;
|
27480
|
+
if (G && !A._isRealTimeBar && G <= A.bar_index)
|
27472
27481
|
continue;
|
27473
|
-
if (Date.now() -
|
27482
|
+
if (Date.now() - S > 4e4)
|
27474
27483
|
return Cs(l), {
|
27475
27484
|
status: 1,
|
27476
27485
|
errors: [{
|
@@ -27482,11 +27491,11 @@ ${u}`), u;
|
|
27482
27491
|
type: k1.Error
|
27483
27492
|
}]
|
27484
27493
|
};
|
27485
|
-
!t && (
|
27486
|
-
const t0 = await xO(A, g, q, W, b,
|
27494
|
+
!t && (G || G === 0) && O.push(G);
|
27495
|
+
const t0 = await xO(A, g, q, W, b, k, T, { newCacheData: f, cacheData: d }, w, x, I);
|
27487
27496
|
if (t0)
|
27488
27497
|
return t0;
|
27489
|
-
|
27498
|
+
k = Object.assign(V, { barIndex: G || Y, lastBarIndex: r[N].barindex || N, lastBarTime: r[N].time, nextBarTime: r[Y + 1]?.time }), kf(A, g, q, W, b, k, w);
|
27490
27499
|
const d0 = g.errors;
|
27491
27500
|
if (d0.length && d0.some((s0) => s0.type === k1.Error))
|
27492
27501
|
return Cs(l), {
|
@@ -27495,7 +27504,7 @@ ${u}`), u;
|
|
27495
27504
|
};
|
27496
27505
|
}
|
27497
27506
|
if (w?.size) {
|
27498
|
-
const Y = await xO(A, g, q, W, b,
|
27507
|
+
const Y = await xO(A, g, q, W, b, k, T, { newCacheData: f, cacheData: d }, w, x, I);
|
27499
27508
|
if (Y)
|
27500
27509
|
return Cs(l), Y;
|
27501
27510
|
}
|
@@ -27513,8 +27522,8 @@ ${u}`), u;
|
|
27513
27522
|
};
|
27514
27523
|
if (I?.size) {
|
27515
27524
|
const Y = /* @__PURE__ */ new Map();
|
27516
|
-
for (const [V,
|
27517
|
-
y.push(
|
27525
|
+
for (const [V, G] of I)
|
27526
|
+
y.push(G), t && x?.has(V) && Y.set(V, x.get(V));
|
27518
27527
|
t && self.workerStorage.set(`request_${l}_data`, Y);
|
27519
27528
|
}
|
27520
27529
|
t && self.workerStorage.delete(`request_${l}_tmp`), f.requestCacheData = {
|
@@ -27525,15 +27534,15 @@ ${u}`), u;
|
|
27525
27534
|
requestData: Array.from(x || /* @__PURE__ */ new Map()),
|
27526
27535
|
requestTmp: Array.from(self.workerStorage.get(`request_${l}_tmp`) || /* @__PURE__ */ new Map())
|
27527
27536
|
};
|
27528
|
-
} catch (
|
27529
|
-
return console.log(
|
27537
|
+
} catch (k) {
|
27538
|
+
return console.log(k), Cs(l), {
|
27530
27539
|
status: 1,
|
27531
27540
|
errors: [{
|
27532
27541
|
endLineNumber: 0,
|
27533
27542
|
startColumn: 0,
|
27534
27543
|
endColumn: 0,
|
27535
27544
|
startLineNumber: 0,
|
27536
|
-
message:
|
27545
|
+
message: k?.message,
|
27537
27546
|
type: k1.Error
|
27538
27547
|
}]
|
27539
27548
|
};
|
@@ -27784,7 +27793,8 @@ ${u}`), u;
|
|
27784
27793
|
matrixRowsColsEqErr: '在 `matrix.$name()` 函数中,矩阵"id1"和"id2"必须具有相同的行数和列数才能执行加法运算。',
|
27785
27794
|
matrixMultErr: '在 `matrix.mult()` 函数中,"id1"矩阵的列数必须等于"id2"矩阵的行数(或数组的元素个数)。',
|
27786
27795
|
maxOpenOrdersErr: "最大开仓交易数限制($count笔)。",
|
27787
|
-
maxOrdersErr: "最大交易数限制($count笔)。"
|
27796
|
+
maxOrdersErr: "最大交易数限制($count笔)。",
|
27797
|
+
maxPlotErr: "脚本创建了太多绘图($count)。限制为64"
|
27788
27798
|
}, Lx = {
|
27789
27799
|
repeatVar: '父作用域中已存在变量"$name",此处会产生遮蔽。是否应使用":="替代"="?',
|
27790
27800
|
typeMismatch: "`$operator` 函数的 `$index` 参数仅接受 $type 类型参数,为避免意外结果,请确保传入该参数的值或表达式为 $type 类型。",
|
@@ -28507,7 +28517,7 @@ ${u}`), u;
|
|
28507
28517
|
random({ min: e = 0, max: t = 1, seed: r }) {
|
28508
28518
|
h0(e) && (e = 0), h0(t) && (t = 1);
|
28509
28519
|
let i = Math.random;
|
28510
|
-
r && (i = new wM(r));
|
28520
|
+
r && (i = new wM(`${e}${t}${r}`));
|
28511
28521
|
let s;
|
28512
28522
|
if (t === e)
|
28513
28523
|
s = e;
|
@@ -30704,8 +30714,8 @@ ${Gf}`);
|
|
30704
30714
|
strassen3x3(e) {
|
30705
30715
|
e = m0.checkMatrix(e);
|
30706
30716
|
let t = new m0(3, 3);
|
30707
|
-
const r = this.get(0, 0), i = this.get(0, 1), s = this.get(0, 2), o = this.get(1, 0), a = this.get(1, 1), c = this.get(1, 2), p = this.get(2, 0), b = this.get(2, 1), M = this.get(2, 2), l = e.get(0, 0), u = e.get(0, 1), O = e.get(0, 2), d = e.get(1, 0), _ = e.get(1, 1), f = e.get(1, 2), A = e.get(2, 0), q = e.get(2, 1), g = e.get(2, 2), W = (r + i + s - o - a - b - M) * _, v = (r - o) * (-u + _), y = a * (-l + u + d - _ - f - A + g), L = (-r + o + a) * (l - u + _), D = (o + a) * (-l + u), N = r * l, w = (-r + p + b) * (l - O + f), x = (-r + p) * (O - f), T = (p + b) * (-l + O),
|
30708
|
-
return t.set(0, 0, s1), t.set(0, 1, e1), t.set(0, 2, n1), t.set(1, 0, K0), t.set(1, 1, x0), t.set(1, 2, $), t.set(2, 0,
|
30717
|
+
const r = this.get(0, 0), i = this.get(0, 1), s = this.get(0, 2), o = this.get(1, 0), a = this.get(1, 1), c = this.get(1, 2), p = this.get(2, 0), b = this.get(2, 1), M = this.get(2, 2), l = e.get(0, 0), u = e.get(0, 1), O = e.get(0, 2), d = e.get(1, 0), _ = e.get(1, 1), f = e.get(1, 2), A = e.get(2, 0), q = e.get(2, 1), g = e.get(2, 2), W = (r + i + s - o - a - b - M) * _, v = (r - o) * (-u + _), y = a * (-l + u + d - _ - f - A + g), L = (-r + o + a) * (l - u + _), D = (o + a) * (-l + u), N = r * l, w = (-r + p + b) * (l - O + f), x = (-r + p) * (O - f), T = (p + b) * (-l + O), S = (r + i + s - a - c - p - b) * f, k = b * (-l + O + d - _ - f - A + q), I = (-s + b + M) * (_ + A - q), Y = (s - M) * (_ - q), V = s * A, G = (b + M) * (-A + q), t0 = (-s + a + c) * (f + A - g), d0 = (s - c) * (f - g), s0 = (a + c) * (-A + g), i0 = i * d, k0 = c * q, F0 = o * O, B0 = p * u, f0 = M * g, s1 = N + V + i0, e1 = W + L + D + N + I + V + G, n1 = N + w + T + S + V + t0 + s0, K0 = v + y + L + N + V + t0 + d0, x0 = v + L + D + N + k0, $ = V + t0 + d0 + s0 + F0, K = N + w + x + k + I + Y + V, Z = I + Y + V + G + B0, n0 = N + w + x + T + f0;
|
30718
|
+
return t.set(0, 0, s1), t.set(0, 1, e1), t.set(0, 2, n1), t.set(1, 0, K0), t.set(1, 1, x0), t.set(1, 2, $), t.set(2, 0, K), t.set(2, 1, Z), t.set(2, 2, n0), t;
|
30709
30719
|
}
|
30710
30720
|
mmulStrassen(e) {
|
30711
30721
|
e = m0.checkMatrix(e);
|
@@ -30733,22 +30743,22 @@ ${Gf}`);
|
|
30733
30743
|
c1.add(A, L),
|
30734
30744
|
d,
|
30735
30745
|
_
|
30736
|
-
), N = b(c1.add(W, y), A, d, _), w = b(f, c1.sub(g, L), d, _), x = b(y, c1.sub(v, A), d, _), T = b(c1.add(f, q), L, d, _),
|
30746
|
+
), N = b(c1.add(W, y), A, d, _), w = b(f, c1.sub(g, L), d, _), x = b(y, c1.sub(v, A), d, _), T = b(c1.add(f, q), L, d, _), S = b(
|
30737
30747
|
c1.sub(W, f),
|
30738
30748
|
c1.add(A, g),
|
30739
30749
|
d,
|
30740
30750
|
_
|
30741
|
-
),
|
30751
|
+
), k = b(
|
30742
30752
|
c1.sub(q, y),
|
30743
30753
|
c1.add(v, L),
|
30744
30754
|
d,
|
30745
30755
|
_
|
30746
30756
|
), I = c1.add(D, x);
|
30747
|
-
I.sub(T), I.add(
|
30748
|
-
let Y = c1.add(w, T), V = c1.add(N, x),
|
30749
|
-
|
30757
|
+
I.sub(T), I.add(k);
|
30758
|
+
let Y = c1.add(w, T), V = c1.add(N, x), G = c1.sub(D, N);
|
30759
|
+
G.add(w), G.add(S);
|
30750
30760
|
let t0 = c1.zeros(2 * I.rows, 2 * I.columns);
|
30751
|
-
return t0 = t0.setSubMatrix(I, 0, 0), t0 = t0.setSubMatrix(Y, I.rows, 0), t0 = t0.setSubMatrix(V, 0, I.columns), t0 = t0.setSubMatrix(
|
30761
|
+
return t0 = t0.setSubMatrix(I, 0, 0), t0 = t0.setSubMatrix(Y, I.rows, 0), t0 = t0.setSubMatrix(V, 0, I.columns), t0 = t0.setSubMatrix(G, I.rows, I.columns), t0.subMatrix(0, u - 1, 0, O - 1);
|
30752
30762
|
}
|
30753
30763
|
return b(t, e, c, p);
|
30754
30764
|
}
|
@@ -31872,10 +31882,10 @@ ${Gf}`);
|
|
31872
31882
|
let x = f[y - 2];
|
31873
31883
|
f[y - 2] = 0;
|
31874
31884
|
for (let T = y - 2; T >= N; T--) {
|
31875
|
-
let
|
31876
|
-
if (O[T] =
|
31885
|
+
let S = _i(O[T], x), k = O[T] / S, I = x / S;
|
31886
|
+
if (O[T] = S, T !== N && (x = -I * f[T - 1], f[T - 1] = k * f[T - 1]), p)
|
31877
31887
|
for (let Y = 0; Y < i; Y++)
|
31878
|
-
|
31888
|
+
S = k * _.get(Y, T) + I * _.get(Y, y - 1), _.set(Y, y - 1, -I * _.get(Y, T) + k * _.get(Y, y - 1)), _.set(Y, T, S);
|
31879
31889
|
}
|
31880
31890
|
break;
|
31881
31891
|
}
|
@@ -31883,10 +31893,10 @@ ${Gf}`);
|
|
31883
31893
|
let x = f[N - 1];
|
31884
31894
|
f[N - 1] = 0;
|
31885
31895
|
for (let T = N; T < y; T++) {
|
31886
|
-
let
|
31887
|
-
if (O[T] =
|
31896
|
+
let S = _i(O[T], x), k = O[T] / S, I = x / S;
|
31897
|
+
if (O[T] = S, x = -I * f[T], f[T] = k * f[T], c)
|
31888
31898
|
for (let Y = 0; Y < r; Y++)
|
31889
|
-
|
31899
|
+
S = k * d.get(Y, T) + I * d.get(Y, N - 1), d.set(Y, N - 1, -I * d.get(Y, T) + k * d.get(Y, N - 1)), d.set(Y, T, S);
|
31890
31900
|
}
|
31891
31901
|
break;
|
31892
31902
|
}
|
@@ -31897,9 +31907,9 @@ ${Gf}`);
|
|
31897
31907
|
Math.abs(f[y - 2]),
|
31898
31908
|
Math.abs(O[N]),
|
31899
31909
|
Math.abs(f[N])
|
31900
|
-
), T = O[y - 1] / x,
|
31910
|
+
), T = O[y - 1] / x, S = O[y - 2] / x, k = f[y - 2] / x, I = O[N] / x, Y = f[N] / x, V = ((S + T) * (S - T) + k * k) / 2, G = T * k * (T * k);
|
31901
31911
|
let t0 = 0;
|
31902
|
-
(V !== 0 ||
|
31912
|
+
(V !== 0 || G !== 0) && (V < 0 ? t0 = 0 - Math.sqrt(V * V + G) : t0 = Math.sqrt(V * V + G), t0 = G / (V + t0));
|
31903
31913
|
let d0 = (I + T) * (I - T) + t0, s0 = I * Y;
|
31904
31914
|
for (let i0 = N; i0 < y - 1; i0++) {
|
31905
31915
|
let k0 = _i(d0, s0);
|
@@ -32246,7 +32256,7 @@ ${Gf}`);
|
|
32246
32256
|
}
|
32247
32257
|
}
|
32248
32258
|
function T7(n, e, t, r, i) {
|
32249
|
-
let s = n - 1, o = 0, a = n - 1, c = Number.EPSILON, p = 0, b = 0, M = 0, l = 0, u = 0, O = 0, d = 0, _ = 0, f, A, q, g, W, v, y, L, D, N, w, x, T,
|
32259
|
+
let s = n - 1, o = 0, a = n - 1, c = Number.EPSILON, p = 0, b = 0, M = 0, l = 0, u = 0, O = 0, d = 0, _ = 0, f, A, q, g, W, v, y, L, D, N, w, x, T, S, k;
|
32250
32260
|
for (f = 0; f < n; f++)
|
32251
32261
|
for ((f < o || f > a) && (t[f] = i.get(f, f), e[f] = 0), A = Math.max(f - 1, 0); A < n; A++)
|
32252
32262
|
b = b + Math.abs(i.get(f, A));
|
@@ -32281,14 +32291,14 @@ ${Gf}`);
|
|
32281
32291
|
W--;
|
32282
32292
|
for (f = W + 2; f <= s; f++)
|
32283
32293
|
i.set(f, f - 2, 0), f > W + 2 && i.set(f, f - 3, 0);
|
32284
|
-
for (q = W; q <= s - 1 && (
|
32294
|
+
for (q = W; q <= s - 1 && (S = q !== s - 1, q !== W && (M = i.get(q, q - 1), l = i.get(q + 1, q - 1), u = S ? i.get(q + 2, q - 1) : 0, L = Math.abs(M) + Math.abs(l) + Math.abs(u), L !== 0 && (M = M / L, l = l / L, u = u / L)), L !== 0); q++)
|
32285
32295
|
if (O = Math.sqrt(M * M + l * l + u * u), M < 0 && (O = -O), O !== 0) {
|
32286
32296
|
for (q !== W ? i.set(q, q - 1, -O * L) : g !== W && i.set(q, q - 1, -i.get(q, q - 1)), M = M + O, L = M / O, D = l / O, d = u / O, l = l / M, u = u / M, A = q; A < n; A++)
|
32287
|
-
M = i.get(q, A) + l * i.get(q + 1, A),
|
32297
|
+
M = i.get(q, A) + l * i.get(q + 1, A), S && (M = M + u * i.get(q + 2, A), i.set(q + 2, A, i.get(q + 2, A) - M * d)), i.set(q, A, i.get(q, A) - M * L), i.set(q + 1, A, i.get(q + 1, A) - M * D);
|
32288
32298
|
for (f = 0; f <= Math.min(s, q + 3); f++)
|
32289
|
-
M = L * i.get(f, q) + D * i.get(f, q + 1),
|
32299
|
+
M = L * i.get(f, q) + D * i.get(f, q + 1), S && (M = M + d * i.get(f, q + 2), i.set(f, q + 2, i.get(f, q + 2) - M * u)), i.set(f, q, i.get(f, q) - M), i.set(f, q + 1, i.get(f, q + 1) - M * l);
|
32290
32300
|
for (f = o; f <= a; f++)
|
32291
|
-
M = L * r.get(f, q) + D * r.get(f, q + 1),
|
32301
|
+
M = L * r.get(f, q) + D * r.get(f, q + 1), S && (M = M + d * r.get(f, q + 2), r.set(f, q + 2, r.get(f, q + 2) - M * u)), r.set(f, q, r.get(f, q) - M), r.set(f, q + 1, r.get(f, q + 1) - M * l);
|
32292
32302
|
}
|
32293
32303
|
}
|
32294
32304
|
}
|
@@ -32309,17 +32319,17 @@ ${Gf}`);
|
|
32309
32319
|
i.set(A, s, i.get(A, s) / v);
|
32310
32320
|
}
|
32311
32321
|
else if (l < 0)
|
32312
|
-
for (g = s - 1, Math.abs(i.get(s, s - 1)) > Math.abs(i.get(s - 1, s)) ? (i.set(s - 1, s - 1, l / i.get(s, s - 1)), i.set(s - 1, s, -(i.get(s, s) - M) / i.get(s, s - 1))) : (
|
32322
|
+
for (g = s - 1, Math.abs(i.get(s, s - 1)) > Math.abs(i.get(s - 1, s)) ? (i.set(s - 1, s - 1, l / i.get(s, s - 1)), i.set(s - 1, s, -(i.get(s, s) - M) / i.get(s, s - 1))) : (k = Ha(0, -i.get(s - 1, s), i.get(s - 1, s - 1) - M, l), i.set(s - 1, s - 1, k[0]), i.set(s - 1, s, k[1])), i.set(s, s - 1, 0), i.set(s, s, 1), f = s - 2; f >= 0; f--) {
|
32313
32323
|
for (N = 0, w = 0, A = g; A <= s; A++)
|
32314
32324
|
N = N + i.get(f, A) * i.get(A, s - 1), w = w + i.get(f, A) * i.get(A, s);
|
32315
32325
|
if (y = i.get(f, f) - M, e[f] < 0)
|
32316
32326
|
d = y, u = N, O = w;
|
32317
|
-
else if (g = f, e[f] === 0 ? (
|
32327
|
+
else if (g = f, e[f] === 0 ? (k = Ha(-N, -w, y, l), i.set(f, s - 1, k[0]), i.set(f, s, k[1])) : (L = i.get(f, f + 1), D = i.get(f + 1, f), x = (t[f] - M) * (t[f] - M) + e[f] * e[f] - l * l, T = (t[f] - M) * 2 * l, x === 0 && T === 0 && (x = c * b * (Math.abs(y) + Math.abs(l) + Math.abs(L) + Math.abs(D) + Math.abs(d))), k = Ha(
|
32318
32328
|
L * u - d * N + l * w,
|
32319
32329
|
L * O - d * w - l * N,
|
32320
32330
|
x,
|
32321
32331
|
T
|
32322
|
-
), i.set(f, s - 1,
|
32332
|
+
), i.set(f, s - 1, k[0]), i.set(f, s, k[1]), Math.abs(L) > Math.abs(d) + Math.abs(l) ? (i.set(
|
32323
32333
|
f + 1,
|
32324
32334
|
s - 1,
|
32325
32335
|
(-N - y * i.get(f, s - 1) + l * i.get(f, s)) / L
|
@@ -32327,12 +32337,12 @@ ${Gf}`);
|
|
32327
32337
|
f + 1,
|
32328
32338
|
s,
|
32329
32339
|
(-w - y * i.get(f, s) - l * i.get(f, s - 1)) / L
|
32330
|
-
)) : (
|
32340
|
+
)) : (k = Ha(
|
32331
32341
|
-u - D * i.get(f, s - 1),
|
32332
32342
|
-O - D * i.get(f, s),
|
32333
32343
|
d,
|
32334
32344
|
l
|
32335
|
-
), i.set(f + 1, s - 1,
|
32345
|
+
), i.set(f + 1, s - 1, k[0]), i.set(f + 1, s, k[1]))), v = Math.max(Math.abs(i.get(f, s - 1)), Math.abs(i.get(f, s))), c * v * v > 1)
|
32336
32346
|
for (A = f; A <= s; A++)
|
32337
32347
|
i.set(A, s - 1, i.get(A, s - 1) / v), i.set(A, s, i.get(A, s) / v);
|
32338
32348
|
}
|
@@ -36058,8 +36068,8 @@ ${Gf}`);
|
|
36058
36068
|
let L = f * c / b;
|
36059
36069
|
A += L, L += y, O = O - L, Object.assign(e, { commission: L });
|
36060
36070
|
const D = this._orders.reduce((N, w) => {
|
36061
|
-
const { qty: x = 0, original_qty: T = 0, commission:
|
36062
|
-
return N +
|
36071
|
+
const { qty: x = 0, original_qty: T = 0, commission: S = 0 } = w;
|
36072
|
+
return N + S * x / T;
|
36063
36073
|
}, 0);
|
36064
36074
|
q += D - l;
|
36065
36075
|
}
|
@@ -36906,7 +36916,7 @@ ${u}`), u;
|
|
36906
36916
|
originTimeframe: o,
|
36907
36917
|
timeframe: CO[o] || XO(o)
|
36908
36918
|
};
|
36909
|
-
if (f?.get(d) || A?.set(d, q), f?.set(d, q), _?.has(d)) {
|
36919
|
+
if (f?.get(d) || (A?.set(d, q), f?.set(d, q)), _?.has(d)) {
|
36910
36920
|
const {
|
36911
36921
|
index: W = 0,
|
36912
36922
|
periodStamp: v = O
|
@@ -36918,20 +36928,20 @@ ${u}`), u;
|
|
36918
36928
|
const D = y.slice(W);
|
36919
36929
|
let N = M, w = v + N;
|
36920
36930
|
const x = [];
|
36921
|
-
for (const [T,
|
36922
|
-
let { time:
|
36923
|
-
|
36931
|
+
for (const [T, S] of D.entries()) {
|
36932
|
+
let { time: k, barIndex: I } = S;
|
36933
|
+
k = k * 1e3;
|
36924
36934
|
let Y = I || W + T;
|
36925
|
-
if (
|
36935
|
+
if (k >= w)
|
36926
36936
|
return !l && (this._cacheData[r] = {
|
36927
36937
|
index: Y,
|
36928
36938
|
periodStamp: v
|
36929
36939
|
}), x;
|
36930
|
-
if (N <=
|
36931
|
-
const V =
|
36940
|
+
if (N <= k && k < w) {
|
36941
|
+
const V = S?.result?.[r];
|
36932
36942
|
if (Array.isArray(V))
|
36933
|
-
for (const [
|
36934
|
-
x[
|
36943
|
+
for (const [G, t0] of V.entries())
|
36944
|
+
x[G] || (x[G] = []), x[G].push(t0);
|
36935
36945
|
else
|
36936
36946
|
i || x.push(V);
|
36937
36947
|
}
|
@@ -36946,84 +36956,88 @@ ${u}`), u;
|
|
36946
36956
|
let { symbol: r, timeframe: i, calc_bars_count: s, gaps: o, lookahead: a, ignore_invalid_symbol: c } = e;
|
36947
36957
|
const { __period: p, mintick: b, time: M, nextBarTime: l } = this._variables;
|
36948
36958
|
i = Sa(i), r = r;
|
36949
|
-
const u = `${r}--${i}`, O = self.workerStorage.get(`request_${this._scriptId}_data`), d = self.workerStorage.get(`request_${this._scriptId}_list`), _ = self.workerStorage.get(`request_${this._scriptId}_tmp`)
|
36950
|
-
|
36951
|
-
|
36952
|
-
|
36953
|
-
|
36954
|
-
|
36955
|
-
|
36956
|
-
|
36957
|
-
|
36958
|
-
|
36959
|
-
|
36959
|
+
const u = `${r}--${i}`, O = self.workerStorage.get(`request_${this._scriptId}_data`), d = self.workerStorage.get(`request_${this._scriptId}_list`), _ = self.workerStorage.get(`request_${this._scriptId}_tmp`);
|
36960
|
+
if (!d?.get(u)) {
|
36961
|
+
const A = {
|
36962
|
+
id: u,
|
36963
|
+
calc_bars_count: s,
|
36964
|
+
ignore_invalid_symbol: c,
|
36965
|
+
symbol: r,
|
36966
|
+
originTimeframe: i,
|
36967
|
+
timeframe: CO[i] || XO(i)
|
36968
|
+
};
|
36969
|
+
_?.set(u, A), d?.set(u, A);
|
36970
|
+
}
|
36971
|
+
if (O?.has(u)) {
|
36972
|
+
let A = ht(i, M) * 1e3;
|
36973
|
+
const q = ht(p, M) * 1e3;
|
36960
36974
|
_?.delete(u);
|
36961
36975
|
const {
|
36962
|
-
index:
|
36963
|
-
periodStamp:
|
36964
|
-
} = this._cacheData[t] || {},
|
36965
|
-
if (!
|
36976
|
+
index: g = 0,
|
36977
|
+
periodStamp: W = q
|
36978
|
+
} = this._cacheData[t] || {}, v = O?.get(u);
|
36979
|
+
if (!v.length)
|
36966
36980
|
return;
|
36967
|
-
const
|
36968
|
-
let
|
36969
|
-
const
|
36970
|
-
lastBarIndex:
|
36971
|
-
lastBarTime:
|
36981
|
+
const y = v.slice(g);
|
36982
|
+
let L = M, D = W + L;
|
36983
|
+
const N = v.length - 1, w = {
|
36984
|
+
lastBarIndex: v[N].barIndex || N,
|
36985
|
+
lastBarTime: v[N].time,
|
36972
36986
|
interval: i,
|
36973
36987
|
mintick: b
|
36974
36988
|
};
|
36975
|
-
if (
|
36976
|
-
let
|
36977
|
-
if (a === Yr.lookaheadOn ?
|
36978
|
-
return
|
36979
|
-
if (
|
36989
|
+
if (A > W) {
|
36990
|
+
let x;
|
36991
|
+
if (a === Yr.lookaheadOn ? x = this._lookaheadOnHandle(y, i, D, A, w, g, W, t, L, o) : x = this._lookaheadOffHandle(y, i, D, A, w, g, W, t, L, l || D, o), x)
|
36992
|
+
return x;
|
36993
|
+
if (x === null)
|
36980
36994
|
return;
|
36981
36995
|
} else if (a === Yr.lookaheadOn)
|
36982
|
-
for (const [
|
36983
|
-
let { time: S, barIndex:
|
36996
|
+
for (const [x, T] of y.entries()) {
|
36997
|
+
let { time: S, barIndex: k } = T;
|
36984
36998
|
S = S * 1e3;
|
36985
|
-
const
|
36986
|
-
let
|
36987
|
-
if (S >=
|
36999
|
+
const I = y[x + 1]?.time * 1e3 || S + A;
|
37000
|
+
let Y = k || g + x;
|
37001
|
+
if (S >= D) {
|
36988
37002
|
this._cacheData[t] = {
|
36989
|
-
index:
|
36990
|
-
periodStamp:
|
37003
|
+
index: Y,
|
37004
|
+
periodStamp: W
|
36991
37005
|
};
|
36992
37006
|
return;
|
36993
37007
|
}
|
36994
|
-
if (S <=
|
37008
|
+
if (S <= L && I > L)
|
36995
37009
|
return this._cacheData[t] = {
|
36996
|
-
index:
|
36997
|
-
periodStamp:
|
36998
|
-
}, { ...
|
37010
|
+
index: Y,
|
37011
|
+
periodStamp: W
|
37012
|
+
}, { ...T, barIndex: k, nextBarTime: y[x + 1]?.time, ...w };
|
36999
37013
|
}
|
37000
37014
|
else
|
37001
|
-
for (const [
|
37002
|
-
let { time: S, barIndex:
|
37015
|
+
for (const [x, T] of y.entries()) {
|
37016
|
+
let { time: S, barIndex: k } = T;
|
37003
37017
|
S = S * 1e3;
|
37004
|
-
const
|
37005
|
-
let
|
37006
|
-
if (S >
|
37018
|
+
const I = S + A, Y = y[x + 1]?.time * 1e3 || I;
|
37019
|
+
let V = k || g + x;
|
37020
|
+
if (S > D) {
|
37007
37021
|
this._cacheData[t] = {
|
37008
|
-
index:
|
37009
|
-
periodStamp:
|
37022
|
+
index: V,
|
37023
|
+
periodStamp: W
|
37010
37024
|
};
|
37011
37025
|
return;
|
37012
37026
|
}
|
37013
|
-
if (S <
|
37027
|
+
if (S < D && D <= Y)
|
37014
37028
|
return this._cacheData[t] = {
|
37015
|
-
index:
|
37016
|
-
periodStamp:
|
37017
|
-
}, { ...
|
37018
|
-
if ((S >=
|
37029
|
+
index: V,
|
37030
|
+
periodStamp: W
|
37031
|
+
}, { ...T, barIndex: V, nextBarTime: y[x + 1]?.time, ...w };
|
37032
|
+
if ((S >= L && S <= D || I < D && S < L) && V === w.lastBarIndex)
|
37019
37033
|
return this._cacheData[t] = {
|
37020
|
-
index:
|
37021
|
-
periodStamp:
|
37022
|
-
}, { ...
|
37034
|
+
index: V,
|
37035
|
+
periodStamp: W
|
37036
|
+
}, { ...T, barIndex: V, nextBarTime: y[x + 1]?.time, ...w };
|
37023
37037
|
}
|
37024
37038
|
this._cacheData[t] = {
|
37025
|
-
index:
|
37026
|
-
periodStamp:
|
37039
|
+
index: v.length,
|
37040
|
+
periodStamp: W
|
37027
37041
|
};
|
37028
37042
|
return;
|
37029
37043
|
}
|
@@ -37169,8 +37183,8 @@ ${u}`), u;
|
|
37169
37183
|
let y;
|
37170
37184
|
const L = {};
|
37171
37185
|
for (const [w, x] of i.entries()) {
|
37172
|
-
const { barindex: T } = x,
|
37173
|
-
if (y &&
|
37186
|
+
const { barindex: T } = x, S = await this.requestMapHandle(b, q, L, f, A, g);
|
37187
|
+
if (y && S && (b.log.clearLogForIndex(y.barIndex), c.__isReqRepeated = !0, c.updateData(y), b.update({ barIndex: y?.barIndex || 0 }), y.result = Object.assign(y.result || {}, { [t]: M(c, p, b, o || [], t) }), b.endExecution(), c.__isReqRepeated = !1), y = Object.assign(x, { barIndex: T || w, lastBarIndex: i[l].barindex || l, lastBarTime: i[l].time, nextBarTime: i[w + 1]?.time }), c.updateData(y), b.update({ barIndex: y?.barIndex || 0 }), x.result = Object.assign(x.result || {}, { [t]: M(c, p, b, o || [], t) }), b.endExecution(), b.errors.length && b.errors.some((k) => k.type === V0.Error))
|
37174
37188
|
return {
|
37175
37189
|
logs: [],
|
37176
37190
|
errors: b.errors
|
@@ -37529,7 +37543,7 @@ ${u}`), u;
|
|
37529
37543
|
_calcMaxContracts() {
|
37530
37544
|
const e = this._orders.length;
|
37531
37545
|
if (!e) {
|
37532
|
-
this._position_size = 0, this._position_avg_price = void 0, this._opentrades_capital_held = 0;
|
37546
|
+
this._position_size = 0, this._position_avg_price = void 0, this._opentrades_capital_held = 0, this.opentrades_long = 0, this.opentrades_short = 0, this.position_size_long = 0, this.position_size_short = 0, this.position_size_total = 0, this._openprofit = 0, this.openprofit_long = 0, this.openprofit_short = 0;
|
37533
37547
|
return;
|
37534
37548
|
}
|
37535
37549
|
this._firstPrice === void 0 && (this._firstPrice = this._orders[0].in_price);
|
@@ -37611,29 +37625,29 @@ ${u}`), u;
|
|
37611
37625
|
maxprofit_percent_short: w = 0,
|
37612
37626
|
maxloss_percent_long: x = 0,
|
37613
37627
|
maxloss_percent_short: T = 0,
|
37614
|
-
hold_long_k_count:
|
37615
|
-
hold_short_k_count:
|
37628
|
+
hold_long_k_count: S = 0,
|
37629
|
+
hold_short_k_count: k = 0,
|
37616
37630
|
hold_profit_long_k_count: I = 0,
|
37617
37631
|
hold_profit_short_k_count: Y = 0,
|
37618
37632
|
hold_loss_long_k_count: V = 0,
|
37619
|
-
hold_loss_short_k_count:
|
37633
|
+
hold_loss_short_k_count: G = 0,
|
37620
37634
|
balanceByInterval: t0,
|
37621
37635
|
shapeRatioType: d0 = "NONE"
|
37622
37636
|
} = this._preHistoryOrderCalcResult;
|
37623
37637
|
const { profit: s0 = 0, profit_percent: i0 = 0, in_index: k0 = 0, out_index: F0 = 0, commission: B0 = 0, direction: f0, in_time: s1 = 0, out_time: e1 = 0, total_profit: n1 = 0 } = e, K0 = F0 - k0 + 1;
|
37624
|
-
if (f0 === X0.long ? (t += s0, i += 1, o += i0, g += B0,
|
37638
|
+
if (f0 === X0.long ? (t += s0, i += 1, o += i0, g += B0, S += K0, s0 > 0 ? (b += i0, A += 1, O += s0, I += K0, v = Math.max(v, s0), N = Math.max(N, i0)) : s0 < 0 && (c += i0, _ += 1, l += s0, V += K0, L = Math.min(L, s0), x = Math.min(x, i0))) : (r += s0, s += 1, a += i0, W += B0, k += K0, s0 > 0 ? (M += i0, q += 1, d += s0, Y += K0, y = Math.max(y, s0), w = Math.max(w, i0)) : s0 < 0 && (p += i0, f += 1, u += s0, G += K0, D = Math.min(D, s0), T = Math.min(T, i0))), !t0) {
|
37625
37639
|
const n0 = this._createBalanceByInterval(s1, Date.now());
|
37626
37640
|
t0 = n0.balanceByInterval, d0 = n0.shapeRatioType;
|
37627
37641
|
}
|
37628
37642
|
const x0 = i + s;
|
37629
37643
|
this._closedtrades = x0;
|
37630
|
-
const $ = this.initial_capital,
|
37631
|
-
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) /
|
37644
|
+
const $ = this.initial_capital, K = q + A, Z = f + _;
|
37645
|
+
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) / K : void 0, !this._options?.commission_value) {
|
37632
37646
|
this._netprofit = t + r;
|
37633
37647
|
const n0 = $ + this._netprofit;
|
37634
37648
|
this._preMaxNetValue = Math.max(this._preMaxNetValue || $, n0), this._preMinNetValue = Math.min(this._preMinNetValue || $, n0);
|
37635
37649
|
}
|
37636
|
-
this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 -
|
37650
|
+
this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 - K - Z, this._losstrades = Z, this._wintrades = K, this._preHistoryOrderCalcResult = {
|
37637
37651
|
netprofit_long: t,
|
37638
37652
|
netprofit_short: r,
|
37639
37653
|
closedtrades_long: i,
|
@@ -37662,12 +37676,12 @@ ${u}`), u;
|
|
37662
37676
|
maxprofit_percent_short: w,
|
37663
37677
|
maxloss_percent_long: x,
|
37664
37678
|
maxloss_percent_short: T,
|
37665
|
-
hold_long_k_count:
|
37666
|
-
hold_short_k_count:
|
37679
|
+
hold_long_k_count: S,
|
37680
|
+
hold_short_k_count: k,
|
37667
37681
|
hold_profit_long_k_count: I,
|
37668
37682
|
hold_profit_short_k_count: Y,
|
37669
37683
|
hold_loss_long_k_count: V,
|
37670
|
-
hold_loss_short_k_count:
|
37684
|
+
hold_loss_short_k_count: G,
|
37671
37685
|
balanceByInterval: t0,
|
37672
37686
|
shapeRatioType: d0
|
37673
37687
|
}, d0 !== "NONE" && (t0[r2(e1)] = $ + n1);
|
@@ -38746,14 +38760,22 @@ ${u}`), u;
|
|
38746
38760
|
return this._allInstance;
|
38747
38761
|
}
|
38748
38762
|
get data() {
|
38749
|
-
const e = /* @__PURE__ */ new Map(), t = C0.flatMap([...this._deleteIds.values()]), r = C0.uniq([...this._all.keys(), ...this._tmpData.keys()]);
|
38750
|
-
for (const
|
38751
|
-
if (!t.some((
|
38752
|
-
const
|
38753
|
-
|
38763
|
+
const e = /* @__PURE__ */ new Map(), t = C0.flatMap([...this._deleteIds.values()]), r = C0.uniq([...this._all.keys(), ...this._tmpData.keys()]), i = [];
|
38764
|
+
for (const a of r)
|
38765
|
+
if (!t.some((c) => c.key === a)) {
|
38766
|
+
const c = this._tmpData.get(a) || this._all.get(a), p = c?.id;
|
38767
|
+
c && (i.push(a), e.set(p, c));
|
38768
|
+
}
|
38769
|
+
const s = Array.from(e.values());
|
38770
|
+
this._variables._isRealTimeBar && this._preDeleteIds.set(this._variables.last_bar_index, this._deleteIds.get(this._variables.last_bar_index) || []), this._tmpDataHandle();
|
38771
|
+
const o = i.length - this._maxLength;
|
38772
|
+
if (o > 0)
|
38773
|
+
for (const [a, c] of i.entries()) {
|
38774
|
+
if (a >= o)
|
38775
|
+
break;
|
38776
|
+
this._allInstance.delete(c), this._all.delete(c);
|
38754
38777
|
}
|
38755
|
-
|
38756
|
-
return this._variables._isRealTimeBar && this._preDeleteIds.set(this._variables.last_bar_index, this._deleteIds.get(this._variables.last_bar_index) || []), this._tmpDataHandle(), this._type === R0.LINEFILL ? i : i.slice(-this._maxLength);
|
38778
|
+
return this._type === R0.LINEFILL ? s : s.slice(-this._maxLength);
|
38757
38779
|
}
|
38758
38780
|
get all() {
|
38759
38781
|
const e = Array.from(this._allInstance.values()), t = e.map((r) => r.data.id);
|
@@ -38910,15 +38932,15 @@ ${u}`), u;
|
|
38910
38932
|
else if (r && r.length) {
|
38911
38933
|
const N = r.length - 1;
|
38912
38934
|
A.__isFirstRun = t, A.updateOptions({ interval: o, mintick: _, chart: c, syminfo: s }), g.updateOptions({ inputs: a, strategy: p });
|
38913
|
-
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`),
|
38935
|
+
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`), S = Date.now(), k = !t && N <= 1;
|
38914
38936
|
try {
|
38915
38937
|
let I;
|
38916
38938
|
const Y = self.workerStorage.get(`request_${l}_list`);
|
38917
|
-
for (const [V,
|
38918
|
-
const { barindex: t0 } =
|
38939
|
+
for (const [V, G] of r.entries()) {
|
38940
|
+
const { barindex: t0 } = G;
|
38919
38941
|
if (t0 && !A._isRealTimeBar && t0 < A.bar_index)
|
38920
38942
|
continue;
|
38921
|
-
if (Date.now() -
|
38943
|
+
if (Date.now() - S > 4e4)
|
38922
38944
|
return Es(l), {
|
38923
38945
|
status: 1,
|
38924
38946
|
errors: [{
|
@@ -38934,7 +38956,7 @@ ${u}`), u;
|
|
38934
38956
|
const d0 = await GO(A, g, q, W, b, I, T, { newCacheData: f, cacheData: d }, w, x, Y);
|
38935
38957
|
if (d0)
|
38936
38958
|
return d0;
|
38937
|
-
I = Object.assign(
|
38959
|
+
I = Object.assign(G, { barIndex: t0 || V, lastBarIndex: k ? t0 : r[N].barindex || N, lastBarTime: k ? G.time : r[N].time, nextBarTime: r[V + 1]?.time }), oh(A, g, q, W, b, I, w);
|
38938
38960
|
const s0 = g.errors;
|
38939
38961
|
if (s0.length && s0.some((i0) => i0.type === V0.Error))
|
38940
38962
|
return Es(l), {
|
@@ -38961,8 +38983,8 @@ ${u}`), u;
|
|
38961
38983
|
};
|
38962
38984
|
if (Y?.size) {
|
38963
38985
|
const V = /* @__PURE__ */ new Map();
|
38964
|
-
for (const [
|
38965
|
-
y.push(t0), t && x?.has(
|
38986
|
+
for (const [G, t0] of Y)
|
38987
|
+
y.push(t0), t && x?.has(G) && V.set(G, x.get(G));
|
38966
38988
|
t && self.workerStorage.set(`request_${l}_data`, V);
|
38967
38989
|
}
|
38968
38990
|
t && self.workerStorage.delete(`request_${l}_tmp`), f.requestCacheData = {
|
@@ -39011,8 +39033,8 @@ ${u}`), u;
|
|
39011
39033
|
let D = 0;
|
39012
39034
|
const N = p?.get(g);
|
39013
39035
|
N && (D = N[N.length - 1]?.time || 0), O.push({ id: g, key: L, ignore_invalid_symbol: v, currentDataList: N, startTime: D });
|
39014
|
-
const [w, x] = A.split(":"), T = Number(y) <= 60 ? 1e4 : 5e3,
|
39015
|
-
u.push(Un({ params: [{ exchange: x ? w : "FX", symbol: x || w, limit:
|
39036
|
+
const [w, x] = A.split(":"), T = Number(y) <= 60 ? 1e4 : 5e3, S = W ? W <= 1e5 ? W : 1e5 : T;
|
39037
|
+
u.push(Un({ params: [{ exchange: x ? w : "FX", symbol: x || w, limit: S, start: D, end: 0, period: q }] }).json());
|
39016
39038
|
}
|
39017
39039
|
const d = await Promise.all(u);
|
39018
39040
|
for (const [_, f] of d.entries()) {
|
@@ -39242,7 +39264,8 @@ ${u}`), u;
|
|
39242
39264
|
conditionTypeErr: '"$name"语句的条件表达式必须为"bool"类型',
|
39243
39265
|
boolVarErr: '无法将类型为"simple na"的值赋给变量"$name"。该变量已声明为"$type"类型。',
|
39244
39266
|
naCompareErr: '无法直接与"na"进行比较。请改用"na()"函数。',
|
39245
|
-
notConstConditionTypeErr: "在条件非常量的情况下,内置限定类型常量不能作为$name语句的返回值。"
|
39267
|
+
notConstConditionTypeErr: "在条件非常量的情况下,内置限定类型常量不能作为$name语句的返回值。",
|
39268
|
+
exportVarErr: "无法导出$name变量。导出的变量必须为'int'、'float'、'bool'、'color'或'string'类型,并在声明中使用`const`关键字。"
|
39246
39269
|
};
|
39247
39270
|
N0.LINE, N0.LINEFILL, N0.POLYLINE, N0.CHART_POINT, N0.TABLE, N0.BOX, N0.LABEL;
|
39248
39271
|
N0.SERIES, N0.SIMPLE, N0.INPUT, N0.CONST;
|
@@ -39954,7 +39977,7 @@ ${u}`), u;
|
|
39954
39977
|
random({ min: e = 0, max: t = 1, seed: r }) {
|
39955
39978
|
_0(e) && (e = 0), _0(t) && (t = 1);
|
39956
39979
|
let i = Math.random;
|
39957
|
-
r && (i = new wM(r));
|
39980
|
+
r && (i = new wM(`${e}${t}${r}`));
|
39958
39981
|
let s;
|
39959
39982
|
if (t === e)
|
39960
39983
|
s = e;
|
@@ -41818,7 +41841,7 @@ ${u}`), u;
|
|
41818
41841
|
}
|
41819
41842
|
_verfiyArgs(e, t) {
|
41820
41843
|
const { xloc: r, yloc: i, style: s, size: o, textalign: a, text_font_family: c } = e, p = "label.new";
|
41821
|
-
this._paramVerfiy(s, t, p, Object.values(te), "style"), this._paramVerfiy(r, t, p, Object.values(Y1), "xloc"), this._paramVerfiy(i, t, p, Object.values(ur), "yloc"), this._paramVerfiy(o, t, p, Object.values(Je), "size"), this._paramVerfiy(a, t, p, [Z0.alignLeft, Z0.alignCenter, Z0.alignRight], "textalign"), this._paramVerfiy(c, t, p, Object.values(Ti), "text_font_family");
|
41844
|
+
this._paramVerfiy(s, t, p, Object.values(te), "style"), this._paramVerfiy(r, t, p, Object.values(Y1), "xloc"), this._paramVerfiy(i, t, p, Object.values(ur), "yloc"), typeof o == "string" && this._paramVerfiy(o, t, p, Object.values(Je), "size"), this._paramVerfiy(a, t, p, [Z0.alignLeft, Z0.alignCenter, Z0.alignRight], "textalign"), this._paramVerfiy(c, t, p, Object.values(Ti), "text_font_family");
|
41822
41845
|
}
|
41823
41846
|
_paramVerfiy(e = "", t, r, i, s) {
|
41824
41847
|
this._paramVerfiyHandle(e, i) && this._errorListener.addError(be(u1.paramsErr, { value: e, func: r, param: s, targetVal: `[${i.join(", ")}]` }), t, Y0.Error);
|
@@ -41888,7 +41911,7 @@ ${u}`), u;
|
|
41888
41911
|
return;
|
41889
41912
|
E0(this._errorListener, "label.set_size", this._variables.__requestName, r);
|
41890
41913
|
const i = this._getLabel(e);
|
41891
|
-
i && (i.size = t), this._updateIds.add(e.id), this._paramVerfiy(t, r, "label.set_size", Object.values(Je), "size");
|
41914
|
+
i && (i.size = t), this._updateIds.add(e.id), typeof t == "string" && this._paramVerfiy(t, r, "label.set_size", Object.values(Je), "size");
|
41892
41915
|
}
|
41893
41916
|
set_xloc({ id: e, x: t, xloc: r }, i) {
|
41894
41917
|
if (!e)
|
@@ -42659,7 +42682,7 @@ ${u}`), u;
|
|
42659
42682
|
}
|
42660
42683
|
_verfiyArgs(e, t) {
|
42661
42684
|
const { border_style: r, extend: i, xloc: s, text_size: o, text_halign: a, text_valign: c, text_wrap: p, text_font_family: b } = e, M = "box.new";
|
42662
|
-
this._paramVerfiy(r, t, M, [me.styleDashed, me.styleDotted, me.styleSolid], "border_style"), this._paramVerfiy(i, t, M, Object.values(Yt), "extend"), this._paramVerfiy(s, t, M, Object.values(Y1), "xloc"), this._paramVerfiy(o, t, M, Object.values(Je), "text_size"), this._paramVerfiy(a, t, M, [Z0.alignLeft, Z0.alignCenter, Z0.alignRight], "text_halign"), this._paramVerfiy(c, t, M, [Z0.alignBottom, Z0.alignCenter, Z0.alignTop], "text_valign"), this._paramVerfiy(p, t, M, [Z0.wrapAuto, Z0.wrapNone], "text_wrap"), this._paramVerfiy(b, t, M, Object.values(Ti), "text_font_family");
|
42685
|
+
this._paramVerfiy(r, t, M, [me.styleDashed, me.styleDotted, me.styleSolid], "border_style"), this._paramVerfiy(i, t, M, Object.values(Yt), "extend"), this._paramVerfiy(s, t, M, Object.values(Y1), "xloc"), typeof o == "string" && this._paramVerfiy(o, t, M, Object.values(Je), "text_size"), this._paramVerfiy(a, t, M, [Z0.alignLeft, Z0.alignCenter, Z0.alignRight], "text_halign"), this._paramVerfiy(c, t, M, [Z0.alignBottom, Z0.alignCenter, Z0.alignTop], "text_valign"), this._paramVerfiy(p, t, M, [Z0.wrapAuto, Z0.wrapNone], "text_wrap"), this._paramVerfiy(b, t, M, Object.values(Ti), "text_font_family");
|
42663
42686
|
}
|
42664
42687
|
_paramVerfiy(e = "", t, r, i, s) {
|
42665
42688
|
e && !i.includes(e) && this._errorListener.addError(be(u1.paramsErr, { value: e, func: r, param: s, targetVal: `[${i.join(", ")}]` }), t, Y0.Error);
|
@@ -42805,7 +42828,7 @@ ${u}`), u;
|
|
42805
42828
|
return;
|
42806
42829
|
E0(this._errorListener, "box.set_text_size", this._variables.__requestName, r);
|
42807
42830
|
const i = this._getBox(e);
|
42808
|
-
i && (i.text_size = t, this._updateIds.add(e.id), this._paramVerfiy(t, r, "box.set_text_size", Object.values(Je), "text_size"));
|
42831
|
+
i && (i.text_size = t, this._updateIds.add(e.id), typeof t == "string" && this._paramVerfiy(t, r, "box.set_text_size", Object.values(Je), "text_size"));
|
42809
42832
|
}
|
42810
42833
|
set_text_wrap({ id: e, text_wrap: t }, r) {
|
42811
42834
|
if (!e)
|
@@ -44527,8 +44550,8 @@ ${u}`), u;
|
|
44527
44550
|
let L = f * c / b;
|
44528
44551
|
A += L, L += y, O = O - L, Object.assign(e, { commission: L });
|
44529
44552
|
const D = this._orders.reduce((N, w) => {
|
44530
|
-
const { qty: x = 0, original_qty: T = 0, commission:
|
44531
|
-
return N +
|
44553
|
+
const { qty: x = 0, original_qty: T = 0, commission: S = 0 } = w;
|
44554
|
+
return N + S * x / T;
|
44532
44555
|
}, 0);
|
44533
44556
|
q += D - l;
|
44534
44557
|
}
|
@@ -45381,7 +45404,7 @@ ${u}`), u;
|
|
45381
45404
|
originTimeframe: o,
|
45382
45405
|
timeframe: QO[o] || ZO(o)
|
45383
45406
|
};
|
45384
|
-
if (f?.get(d) || A?.set(d, q), f?.set(d, q), _?.has(d)) {
|
45407
|
+
if (f?.get(d) || (A?.set(d, q), f?.set(d, q)), _?.has(d)) {
|
45385
45408
|
const {
|
45386
45409
|
index: W = 0,
|
45387
45410
|
periodStamp: v = O
|
@@ -45393,20 +45416,20 @@ ${u}`), u;
|
|
45393
45416
|
const D = y.slice(W);
|
45394
45417
|
let N = M, w = v + N;
|
45395
45418
|
const x = [];
|
45396
|
-
for (const [T,
|
45397
|
-
let { time:
|
45398
|
-
|
45419
|
+
for (const [T, S] of D.entries()) {
|
45420
|
+
let { time: k, barIndex: I } = S;
|
45421
|
+
k = k * 1e3;
|
45399
45422
|
let Y = I || W + T;
|
45400
|
-
if (
|
45423
|
+
if (k >= w)
|
45401
45424
|
return !l && (this._cacheData[r] = {
|
45402
45425
|
index: Y,
|
45403
45426
|
periodStamp: v
|
45404
45427
|
}), x;
|
45405
|
-
if (N <=
|
45406
|
-
const V =
|
45428
|
+
if (N <= k && k < w) {
|
45429
|
+
const V = S?.result?.[r];
|
45407
45430
|
if (Array.isArray(V))
|
45408
|
-
for (const [
|
45409
|
-
x[
|
45431
|
+
for (const [G, t0] of V.entries())
|
45432
|
+
x[G] || (x[G] = []), x[G].push(t0);
|
45410
45433
|
else
|
45411
45434
|
i || x.push(V);
|
45412
45435
|
}
|
@@ -45429,7 +45452,7 @@ ${u}`), u;
|
|
45429
45452
|
originTimeframe: i,
|
45430
45453
|
timeframe: QO[i] || ZO(i)
|
45431
45454
|
};
|
45432
|
-
if (d?.get(u) || _?.set(u, f), d?.set(u, f), O?.has(u)) {
|
45455
|
+
if (d?.get(u) || (_?.set(u, f), d?.set(u, f)), O?.has(u)) {
|
45433
45456
|
let q = _t(i, M) * 1e3;
|
45434
45457
|
const g = _t(p, M) * 1e3;
|
45435
45458
|
_?.delete(u);
|
@@ -45457,47 +45480,47 @@ ${u}`), u;
|
|
45457
45480
|
if (T === null)
|
45458
45481
|
return;
|
45459
45482
|
} else if (a === Kr.lookaheadOn)
|
45460
|
-
for (const [T,
|
45461
|
-
let { time:
|
45462
|
-
|
45463
|
-
const Y = L[T + 1]?.time * 1e3 ||
|
45483
|
+
for (const [T, S] of L.entries()) {
|
45484
|
+
let { time: k, barIndex: I } = S;
|
45485
|
+
k = k * 1e3;
|
45486
|
+
const Y = L[T + 1]?.time * 1e3 || k + q;
|
45464
45487
|
let V = I || W + T;
|
45465
|
-
if (
|
45488
|
+
if (k >= N) {
|
45466
45489
|
this._cacheData[t] = {
|
45467
45490
|
index: V,
|
45468
45491
|
periodStamp: v
|
45469
45492
|
};
|
45470
45493
|
return;
|
45471
45494
|
}
|
45472
|
-
if (
|
45495
|
+
if (k <= D && Y > D)
|
45473
45496
|
return this._cacheData[t] = {
|
45474
45497
|
index: V,
|
45475
45498
|
periodStamp: v
|
45476
|
-
}, { ...
|
45499
|
+
}, { ...S, barIndex: V, nextBarTime: L[T + 1]?.time, ...x };
|
45477
45500
|
}
|
45478
45501
|
else
|
45479
|
-
for (const [T,
|
45480
|
-
let { time:
|
45481
|
-
|
45482
|
-
const Y =
|
45483
|
-
let
|
45484
|
-
if (
|
45502
|
+
for (const [T, S] of L.entries()) {
|
45503
|
+
let { time: k, barIndex: I } = S;
|
45504
|
+
k = k * 1e3;
|
45505
|
+
const Y = k + q, V = L[T + 1]?.time * 1e3 || Y;
|
45506
|
+
let G = I || W + T;
|
45507
|
+
if (k > N) {
|
45485
45508
|
this._cacheData[t] = {
|
45486
|
-
index:
|
45509
|
+
index: G,
|
45487
45510
|
periodStamp: v
|
45488
45511
|
};
|
45489
45512
|
return;
|
45490
45513
|
}
|
45491
|
-
if (
|
45514
|
+
if (k < N && N <= V)
|
45492
45515
|
return this._cacheData[t] = {
|
45493
|
-
index:
|
45516
|
+
index: G,
|
45494
45517
|
periodStamp: v
|
45495
|
-
}, { ...
|
45496
|
-
if ((
|
45518
|
+
}, { ...S, barIndex: G, nextBarTime: L[T + 1]?.time, ...x };
|
45519
|
+
if ((k >= D && k <= N || Y < N && k < D) && G === x.lastBarIndex)
|
45497
45520
|
return this._cacheData[t] = {
|
45498
|
-
index:
|
45521
|
+
index: G,
|
45499
45522
|
periodStamp: v
|
45500
|
-
}, { ...
|
45523
|
+
}, { ...S, barIndex: G, nextBarTime: L[T + 1]?.time, ...x };
|
45501
45524
|
}
|
45502
45525
|
this._cacheData[t] = {
|
45503
45526
|
index: y.length,
|
@@ -45648,8 +45671,8 @@ ${u}`), u;
|
|
45648
45671
|
let L;
|
45649
45672
|
const D = {};
|
45650
45673
|
for (const [x, T] of i.entries()) {
|
45651
|
-
const { barindex:
|
45652
|
-
if (L &&
|
45674
|
+
const { barindex: S } = T, k = await this.requestMapHandle(M, g, D, A, q, W);
|
45675
|
+
if (L && k && (M.log.clearLogForIndex(L.barIndex), p.__isReqRepeated = !0, p.updateData(L), M.update({ barIndex: L?.barIndex || 0 }), L.result = Object.assign(L.result || {}, { [t]: l(p, b, M, o || [], t) }), M.endExecution(), p.__isReqRepeated = !1), L = Object.assign(T, { barIndex: S || x, lastBarIndex: i[u].barindex || u, lastBarTime: i[u].time, nextBarTime: i[x + 1]?.time }), p.updateData(L), M.update({ barIndex: L?.barIndex || 0 }), T.result = Object.assign(T.result || {}, { [t]: l(p, b, M, o || [], t) }), M.endExecution(), M.errors.length && M.errors.some((I) => I.type === Y0.Error))
|
45653
45676
|
return {
|
45654
45677
|
logs: [],
|
45655
45678
|
errors: M.errors
|
@@ -46016,7 +46039,7 @@ ${u}`), u;
|
|
46016
46039
|
_calcMaxContracts() {
|
46017
46040
|
const e = this._orders.length;
|
46018
46041
|
if (!e) {
|
46019
|
-
this._position_size = 0, this._position_avg_price = void 0, this._opentrades_capital_held = 0;
|
46042
|
+
this._position_size = 0, this._position_avg_price = void 0, this._opentrades_capital_held = 0, this.opentrades_long = 0, this.opentrades_short = 0, this.position_size_long = 0, this.position_size_short = 0, this.position_size_total = 0, this._openprofit = 0, this.openprofit_long = 0, this.openprofit_short = 0;
|
46020
46043
|
return;
|
46021
46044
|
}
|
46022
46045
|
this._firstPrice === void 0 && (this._firstPrice = this._orders[0].in_price);
|
@@ -46098,29 +46121,29 @@ ${u}`), u;
|
|
46098
46121
|
maxprofit_percent_short: w = 0,
|
46099
46122
|
maxloss_percent_long: x = 0,
|
46100
46123
|
maxloss_percent_short: T = 0,
|
46101
|
-
hold_long_k_count:
|
46102
|
-
hold_short_k_count:
|
46124
|
+
hold_long_k_count: S = 0,
|
46125
|
+
hold_short_k_count: k = 0,
|
46103
46126
|
hold_profit_long_k_count: I = 0,
|
46104
46127
|
hold_profit_short_k_count: Y = 0,
|
46105
46128
|
hold_loss_long_k_count: V = 0,
|
46106
|
-
hold_loss_short_k_count:
|
46129
|
+
hold_loss_short_k_count: G = 0,
|
46107
46130
|
balanceByInterval: t0,
|
46108
46131
|
shapeRatioType: d0 = "NONE"
|
46109
46132
|
} = this._preHistoryOrderCalcResult;
|
46110
46133
|
const { profit: s0 = 0, profit_percent: i0 = 0, in_index: k0 = 0, out_index: F0 = 0, commission: B0 = 0, direction: f0, in_time: s1 = 0, out_time: e1 = 0, total_profit: n1 = 0 } = e, K0 = F0 - k0 + 1;
|
46111
|
-
if (f0 === I0.long ? (t += s0, i += 1, o += i0, g += B0,
|
46134
|
+
if (f0 === I0.long ? (t += s0, i += 1, o += i0, g += B0, S += K0, s0 > 0 ? (b += i0, A += 1, O += s0, I += K0, v = Math.max(v, s0), N = Math.max(N, i0)) : s0 < 0 && (c += i0, _ += 1, l += s0, V += K0, L = Math.min(L, s0), x = Math.min(x, i0))) : (r += s0, s += 1, a += i0, W += B0, k += K0, s0 > 0 ? (M += i0, q += 1, d += s0, Y += K0, y = Math.max(y, s0), w = Math.max(w, i0)) : s0 < 0 && (p += i0, f += 1, u += s0, G += K0, D = Math.min(D, s0), T = Math.min(T, i0))), !t0) {
|
46112
46135
|
const n0 = this._createBalanceByInterval(s1, Date.now());
|
46113
46136
|
t0 = n0.balanceByInterval, d0 = n0.shapeRatioType;
|
46114
46137
|
}
|
46115
46138
|
const x0 = i + s;
|
46116
46139
|
this._closedtrades = x0;
|
46117
|
-
const $ = this.initial_capital,
|
46118
|
-
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) /
|
46140
|
+
const $ = this.initial_capital, K = q + A, Z = f + _;
|
46141
|
+
if (this._avg_trade_percent = x0 ? (o + a) / x0 : void 0, this._avg_losing_trade_percent = x0 ? Math.abs(c + p) / Z : void 0, this._avg_winning_trade_percent = x0 ? (b + M) / K : void 0, !this._options?.commission_value) {
|
46119
46142
|
this._netprofit = t + r;
|
46120
46143
|
const n0 = $ + this._netprofit;
|
46121
46144
|
this._preMaxNetValue = Math.max(this._preMaxNetValue || $, n0), this._preMinNetValue = Math.min(this._preMinNetValue || $, n0);
|
46122
46145
|
}
|
46123
|
-
this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 -
|
46146
|
+
this._grossloss = Math.abs(l + u), this._grossprofit = O + d, this._eventrades = x0 - K - Z, this._losstrades = Z, this._wintrades = K, this._preHistoryOrderCalcResult = {
|
46124
46147
|
netprofit_long: t,
|
46125
46148
|
netprofit_short: r,
|
46126
46149
|
closedtrades_long: i,
|
@@ -46149,12 +46172,12 @@ ${u}`), u;
|
|
46149
46172
|
maxprofit_percent_short: w,
|
46150
46173
|
maxloss_percent_long: x,
|
46151
46174
|
maxloss_percent_short: T,
|
46152
|
-
hold_long_k_count:
|
46153
|
-
hold_short_k_count:
|
46175
|
+
hold_long_k_count: S,
|
46176
|
+
hold_short_k_count: k,
|
46154
46177
|
hold_profit_long_k_count: I,
|
46155
46178
|
hold_profit_short_k_count: Y,
|
46156
46179
|
hold_loss_long_k_count: V,
|
46157
|
-
hold_loss_short_k_count:
|
46180
|
+
hold_loss_short_k_count: G,
|
46158
46181
|
balanceByInterval: t0,
|
46159
46182
|
shapeRatioType: d0
|
46160
46183
|
}, d0 !== "NONE" && (t0[r2(e1)] = $ + n1);
|
@@ -47264,14 +47287,22 @@ ${u}`), u;
|
|
47264
47287
|
return this._allInstance;
|
47265
47288
|
}
|
47266
47289
|
get data() {
|
47267
|
-
const e = /* @__PURE__ */ new Map(), t = C0.flatMap([...this._deleteIds.values()]), r = C0.uniq([...this._all.keys(), ...this._tmpData.keys()]);
|
47268
|
-
for (const
|
47269
|
-
if (!t.some((
|
47270
|
-
const
|
47271
|
-
|
47290
|
+
const e = /* @__PURE__ */ new Map(), t = C0.flatMap([...this._deleteIds.values()]), r = C0.uniq([...this._all.keys(), ...this._tmpData.keys()]), i = [];
|
47291
|
+
for (const a of r)
|
47292
|
+
if (!t.some((c) => c.key === a)) {
|
47293
|
+
const c = this._tmpData.get(a) || this._all.get(a), p = c?.id;
|
47294
|
+
c && (i.push(a), e.set(p, c));
|
47295
|
+
}
|
47296
|
+
const s = Array.from(e.values());
|
47297
|
+
this._variables._isRealTimeBar && this._preDeleteIds.set(this._variables.last_bar_index, this._deleteIds.get(this._variables.last_bar_index) || []), this._tmpDataHandle();
|
47298
|
+
const o = i.length - this._maxLength;
|
47299
|
+
if (o > 0)
|
47300
|
+
for (const [a, c] of i.entries()) {
|
47301
|
+
if (a >= o)
|
47302
|
+
break;
|
47303
|
+
this._allInstance.delete(c), this._all.delete(c);
|
47272
47304
|
}
|
47273
|
-
|
47274
|
-
return this._variables._isRealTimeBar && this._preDeleteIds.set(this._variables.last_bar_index, this._deleteIds.get(this._variables.last_bar_index) || []), this._tmpDataHandle(), this._type === N0.LINEFILL ? i : i.slice(-this._maxLength);
|
47305
|
+
return this._type === N0.LINEFILL ? s : s.slice(-this._maxLength);
|
47275
47306
|
}
|
47276
47307
|
get all() {
|
47277
47308
|
const e = Array.from(this._allInstance.values()), t = e.map((r) => r.data.id);
|
@@ -47428,15 +47459,15 @@ ${u}`), u;
|
|
47428
47459
|
else if (r && r.length) {
|
47429
47460
|
const N = r.length - 1;
|
47430
47461
|
A.__isFirstRun = t, A.updateOptions({ interval: o, mintick: _, chart: c, syminfo: s }), g.updateOptions({ inputs: a, strategy: p });
|
47431
|
-
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`),
|
47462
|
+
const w = self.workerStorage.get(`request_${l}_tmp`), x = self.workerStorage.get(`request_${l}_data`), T = self.workerStorage.get(`request_${l}`), S = Date.now(), k = !t && N <= 1;
|
47432
47463
|
try {
|
47433
47464
|
let I;
|
47434
47465
|
const Y = self.workerStorage.get(`request_${l}_list`);
|
47435
|
-
for (const [V,
|
47436
|
-
const { barindex: t0 } =
|
47466
|
+
for (const [V, G] of r.entries()) {
|
47467
|
+
const { barindex: t0 } = G;
|
47437
47468
|
if (t0 && !A._isRealTimeBar && t0 < A.bar_index)
|
47438
47469
|
continue;
|
47439
|
-
if (Date.now() -
|
47470
|
+
if (Date.now() - S > 4e4)
|
47440
47471
|
return Ts(l), {
|
47441
47472
|
status: 1,
|
47442
47473
|
errors: [{
|
@@ -47452,7 +47483,7 @@ ${u}`), u;
|
|
47452
47483
|
const d0 = await cd(A, g, q, W, b, I, T, { newCacheData: f, cacheData: d }, w, x, Y);
|
47453
47484
|
if (d0)
|
47454
47485
|
return d0;
|
47455
|
-
I = Object.assign(
|
47486
|
+
I = Object.assign(G, { barIndex: t0 || V, lastBarIndex: k ? t0 : r[N].barindex || N, lastBarTime: k ? G.time : r[N].time, nextBarTime: r[V + 1]?.time }), dh(A, g, q, W, b, I, w);
|
47456
47487
|
const s0 = g.errors;
|
47457
47488
|
if (s0.length && s0.some((i0) => i0.type === Y0.Error))
|
47458
47489
|
return Ts(l), {
|
@@ -47479,8 +47510,8 @@ ${u}`), u;
|
|
47479
47510
|
};
|
47480
47511
|
if (Y?.size) {
|
47481
47512
|
const V = /* @__PURE__ */ new Map();
|
47482
|
-
for (const [
|
47483
|
-
y.push(t0), t && x?.has(
|
47513
|
+
for (const [G, t0] of Y)
|
47514
|
+
y.push(t0), t && x?.has(G) && V.set(G, x.get(G));
|
47484
47515
|
t && self.workerStorage.set(`request_${l}_data`, V);
|
47485
47516
|
}
|
47486
47517
|
t && self.workerStorage.delete(`request_${l}_tmp`), f.requestCacheData = {
|
@@ -47529,8 +47560,8 @@ ${u}`), u;
|
|
47529
47560
|
let D = 0;
|
47530
47561
|
const N = p?.get(g);
|
47531
47562
|
N && (D = N[N.length - 1]?.time || 0), O.push({ id: g, key: L, ignore_invalid_symbol: v, currentDataList: N, startTime: D });
|
47532
|
-
const [w, x] = A.split(":"), T = Number(y) <= 60 ? 1e4 : 5e3,
|
47533
|
-
u.push(Un({ params: [{ exchange: x ? w : "FX", symbol: x || w, limit:
|
47563
|
+
const [w, x] = A.split(":"), T = Number(y) <= 60 ? 1e4 : 5e3, S = W ? W <= 1e5 ? W : 1e5 : T;
|
47564
|
+
u.push(Un({ params: [{ exchange: x ? w : "FX", symbol: x || w, limit: S, start: D, end: 0, period: q }] }).json());
|
47534
47565
|
}
|
47535
47566
|
const d = await Promise.all(u);
|
47536
47567
|
for (const [_, f] of d.entries()) {
|