@tradejs/cli 2.0.18 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +14522 -15704
- package/dist/lib/aiExport.js +15 -1608
- package/dist/lib/aiPocketSearch.js +499 -67
- package/dist/lib/aiPocketSearchCli.js +113 -0
- package/dist/lib/aiTrainCharts.js +14 -1
- package/dist/lib/aiTrainMetrics.js +4 -1
- package/dist/lib/aiTrainResearch.js +88 -54
- package/dist/lib/binanceMarketContextBackfill.js +7 -6
- package/dist/lib/coinMarketCapContextBackfill.js +19 -18
- package/dist/lib/coreResearch.js +2738 -0
- package/dist/lib/derivativesContextBackfill.js +10 -9
- package/dist/lib/executionCalibration.js +6 -3
- package/dist/lib/hyperliquidWhaleBackfill.js +8 -8
- package/dist/lib/hyperliquidWhaleStream.js +4 -4
- package/dist/lib/marketContextPrepare.js +83 -1686
- package/dist/lib/runEnvironment.js +14 -1666
- package/dist/lib/runFormatting.js +1 -1607
- package/dist/lib/runtimeDebugEvidence.js +2 -48
- package/dist/lib/runtimeLineage.js +81 -48
- package/dist/lib/runtimeRedis.js +6 -57
- package/dist/lib/runtimeScorecard.js +153 -10
- package/dist/lib/runtimeStrategyBacktest.js +2 -48
- package/dist/lib/strategyGateFingerprint.js +80 -0
- package/dist/lib/strategyRelease.js +1365 -0
- package/dist/scripts/aiExport.js +17 -1610
- package/dist/scripts/aiPocketSearch.js +1070 -1770
- package/dist/scripts/aiTrain.js +108 -1688
- package/dist/scripts/backtest.js +120 -1760
- package/dist/scripts/binanceMarketIngest.js +5 -4
- package/dist/scripts/candlesMigrateProvider.js +6 -5186
- package/dist/scripts/cleanupMarketContext.js +4 -3
- package/dist/scripts/continuity.js +4 -3
- package/dist/scripts/coreResearch.js +2830 -0
- package/dist/scripts/derivativesIngest.js +6 -4
- package/dist/scripts/derivativesIngestCoinalyzeAll.js +5 -4
- package/dist/scripts/doctor.js +2 -5184
- package/dist/scripts/executionCalibration.js +6 -3
- package/dist/scripts/hyperliquidWhaleBackfill.js +8 -8
- package/dist/scripts/hyperliquidWhaleIngest.js +4 -4
- package/dist/scripts/hyperliquidWhalesUpdate.js +1 -1
- package/dist/scripts/migration.js +3 -3
- package/dist/scripts/mlExport.js +1 -1607
- package/dist/scripts/replay.js +239 -1855
- package/dist/scripts/replayRunner.js +239 -1855
- package/dist/scripts/replayRuntimeEvidence.js +29 -62
- package/dist/scripts/researchAuto.js +3 -49
- package/dist/scripts/results.js +1 -1607
- package/dist/scripts/runtimeEvidence.js +18 -56
- package/dist/scripts/runtimeParity.js +121 -1746
- package/dist/scripts/runtimeScorecard.js +883 -29
- package/dist/scripts/signals.js +1178 -2724
- package/dist/scripts/signalsDaemon.js +1183 -2696
- package/dist/scripts/signalsSummary.js +4 -26
- package/dist/scripts/strategyRelease.js +1469 -0
- package/dist/workers/testerWorker.js +2 -2
- package/package.json +13 -9
|
@@ -5,13 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
try {
|
|
10
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
-
} catch (e) {
|
|
12
|
-
throw mod = 0, e;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
8
|
var __export = (target, all) => {
|
|
16
9
|
for (var name in all)
|
|
17
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -34,1605 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
27
|
));
|
|
35
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
29
|
|
|
37
|
-
// ../../node_modules/ms/index.js
|
|
38
|
-
var require_ms = __commonJS({
|
|
39
|
-
"../../node_modules/ms/index.js"(exports2, module2) {
|
|
40
|
-
"use strict";
|
|
41
|
-
var s = 1e3;
|
|
42
|
-
var m = s * 60;
|
|
43
|
-
var h = m * 60;
|
|
44
|
-
var d = h * 24;
|
|
45
|
-
var w = d * 7;
|
|
46
|
-
var y = d * 365.25;
|
|
47
|
-
module2.exports = function(val, options) {
|
|
48
|
-
options = options || {};
|
|
49
|
-
var type = typeof val;
|
|
50
|
-
if (type === "string" && val.length > 0) {
|
|
51
|
-
return parse(val);
|
|
52
|
-
} else if (type === "number" && isFinite(val)) {
|
|
53
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
54
|
-
}
|
|
55
|
-
throw new Error(
|
|
56
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
function parse(str) {
|
|
60
|
-
str = String(str);
|
|
61
|
-
if (str.length > 100) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
65
|
-
str
|
|
66
|
-
);
|
|
67
|
-
if (!match) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
var n = parseFloat(match[1]);
|
|
71
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
72
|
-
switch (type) {
|
|
73
|
-
case "years":
|
|
74
|
-
case "year":
|
|
75
|
-
case "yrs":
|
|
76
|
-
case "yr":
|
|
77
|
-
case "y":
|
|
78
|
-
return n * y;
|
|
79
|
-
case "weeks":
|
|
80
|
-
case "week":
|
|
81
|
-
case "w":
|
|
82
|
-
return n * w;
|
|
83
|
-
case "days":
|
|
84
|
-
case "day":
|
|
85
|
-
case "d":
|
|
86
|
-
return n * d;
|
|
87
|
-
case "hours":
|
|
88
|
-
case "hour":
|
|
89
|
-
case "hrs":
|
|
90
|
-
case "hr":
|
|
91
|
-
case "h":
|
|
92
|
-
return n * h;
|
|
93
|
-
case "minutes":
|
|
94
|
-
case "minute":
|
|
95
|
-
case "mins":
|
|
96
|
-
case "min":
|
|
97
|
-
case "m":
|
|
98
|
-
return n * m;
|
|
99
|
-
case "seconds":
|
|
100
|
-
case "second":
|
|
101
|
-
case "secs":
|
|
102
|
-
case "sec":
|
|
103
|
-
case "s":
|
|
104
|
-
return n * s;
|
|
105
|
-
case "milliseconds":
|
|
106
|
-
case "millisecond":
|
|
107
|
-
case "msecs":
|
|
108
|
-
case "msec":
|
|
109
|
-
case "ms":
|
|
110
|
-
return n;
|
|
111
|
-
default:
|
|
112
|
-
return void 0;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function fmtShort(ms) {
|
|
116
|
-
var msAbs = Math.abs(ms);
|
|
117
|
-
if (msAbs >= d) {
|
|
118
|
-
return Math.round(ms / d) + "d";
|
|
119
|
-
}
|
|
120
|
-
if (msAbs >= h) {
|
|
121
|
-
return Math.round(ms / h) + "h";
|
|
122
|
-
}
|
|
123
|
-
if (msAbs >= m) {
|
|
124
|
-
return Math.round(ms / m) + "m";
|
|
125
|
-
}
|
|
126
|
-
if (msAbs >= s) {
|
|
127
|
-
return Math.round(ms / s) + "s";
|
|
128
|
-
}
|
|
129
|
-
return ms + "ms";
|
|
130
|
-
}
|
|
131
|
-
function fmtLong(ms) {
|
|
132
|
-
var msAbs = Math.abs(ms);
|
|
133
|
-
if (msAbs >= d) {
|
|
134
|
-
return plural(ms, msAbs, d, "day");
|
|
135
|
-
}
|
|
136
|
-
if (msAbs >= h) {
|
|
137
|
-
return plural(ms, msAbs, h, "hour");
|
|
138
|
-
}
|
|
139
|
-
if (msAbs >= m) {
|
|
140
|
-
return plural(ms, msAbs, m, "minute");
|
|
141
|
-
}
|
|
142
|
-
if (msAbs >= s) {
|
|
143
|
-
return plural(ms, msAbs, s, "second");
|
|
144
|
-
}
|
|
145
|
-
return ms + " ms";
|
|
146
|
-
}
|
|
147
|
-
function plural(ms, msAbs, n, name) {
|
|
148
|
-
var isPlural = msAbs >= n * 1.5;
|
|
149
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// ../../node_modules/list-it/node_modules/debug/src/common.js
|
|
155
|
-
var require_common = __commonJS({
|
|
156
|
-
"../../node_modules/list-it/node_modules/debug/src/common.js"(exports2, module2) {
|
|
157
|
-
"use strict";
|
|
158
|
-
function setup(env) {
|
|
159
|
-
createDebug.debug = createDebug;
|
|
160
|
-
createDebug.default = createDebug;
|
|
161
|
-
createDebug.coerce = coerce;
|
|
162
|
-
createDebug.disable = disable;
|
|
163
|
-
createDebug.enable = enable;
|
|
164
|
-
createDebug.enabled = enabled;
|
|
165
|
-
createDebug.humanize = require_ms();
|
|
166
|
-
createDebug.destroy = destroy;
|
|
167
|
-
Object.keys(env).forEach((key) => {
|
|
168
|
-
createDebug[key] = env[key];
|
|
169
|
-
});
|
|
170
|
-
createDebug.names = [];
|
|
171
|
-
createDebug.skips = [];
|
|
172
|
-
createDebug.formatters = {};
|
|
173
|
-
function selectColor(namespace) {
|
|
174
|
-
let hash = 0;
|
|
175
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
176
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
177
|
-
hash |= 0;
|
|
178
|
-
}
|
|
179
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
180
|
-
}
|
|
181
|
-
createDebug.selectColor = selectColor;
|
|
182
|
-
function createDebug(namespace) {
|
|
183
|
-
let prevTime;
|
|
184
|
-
let enableOverride = null;
|
|
185
|
-
let namespacesCache;
|
|
186
|
-
let enabledCache;
|
|
187
|
-
function debug(...args2) {
|
|
188
|
-
if (!debug.enabled) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const self = debug;
|
|
192
|
-
const curr = Number(/* @__PURE__ */ new Date());
|
|
193
|
-
const ms = curr - (prevTime || curr);
|
|
194
|
-
self.diff = ms;
|
|
195
|
-
self.prev = prevTime;
|
|
196
|
-
self.curr = curr;
|
|
197
|
-
prevTime = curr;
|
|
198
|
-
args2[0] = createDebug.coerce(args2[0]);
|
|
199
|
-
if (typeof args2[0] !== "string") {
|
|
200
|
-
args2.unshift("%O");
|
|
201
|
-
}
|
|
202
|
-
let index = 0;
|
|
203
|
-
args2[0] = args2[0].replace(/%([a-zA-Z%])/g, (match, format2) => {
|
|
204
|
-
if (match === "%%") {
|
|
205
|
-
return "%";
|
|
206
|
-
}
|
|
207
|
-
index++;
|
|
208
|
-
const formatter = createDebug.formatters[format2];
|
|
209
|
-
if (typeof formatter === "function") {
|
|
210
|
-
const val = args2[index];
|
|
211
|
-
match = formatter.call(self, val);
|
|
212
|
-
args2.splice(index, 1);
|
|
213
|
-
index--;
|
|
214
|
-
}
|
|
215
|
-
return match;
|
|
216
|
-
});
|
|
217
|
-
createDebug.formatArgs.call(self, args2);
|
|
218
|
-
const logFn = self.log || createDebug.log;
|
|
219
|
-
logFn.apply(self, args2);
|
|
220
|
-
}
|
|
221
|
-
debug.namespace = namespace;
|
|
222
|
-
debug.useColors = createDebug.useColors();
|
|
223
|
-
debug.color = createDebug.selectColor(namespace);
|
|
224
|
-
debug.extend = extend;
|
|
225
|
-
debug.destroy = createDebug.destroy;
|
|
226
|
-
Object.defineProperty(debug, "enabled", {
|
|
227
|
-
enumerable: true,
|
|
228
|
-
configurable: false,
|
|
229
|
-
get: () => {
|
|
230
|
-
if (enableOverride !== null) {
|
|
231
|
-
return enableOverride;
|
|
232
|
-
}
|
|
233
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
234
|
-
namespacesCache = createDebug.namespaces;
|
|
235
|
-
enabledCache = createDebug.enabled(namespace);
|
|
236
|
-
}
|
|
237
|
-
return enabledCache;
|
|
238
|
-
},
|
|
239
|
-
set: (v) => {
|
|
240
|
-
enableOverride = v;
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
if (typeof createDebug.init === "function") {
|
|
244
|
-
createDebug.init(debug);
|
|
245
|
-
}
|
|
246
|
-
return debug;
|
|
247
|
-
}
|
|
248
|
-
function extend(namespace, delimiter) {
|
|
249
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
250
|
-
newDebug.log = this.log;
|
|
251
|
-
return newDebug;
|
|
252
|
-
}
|
|
253
|
-
function enable(namespaces) {
|
|
254
|
-
createDebug.save(namespaces);
|
|
255
|
-
createDebug.namespaces = namespaces;
|
|
256
|
-
createDebug.names = [];
|
|
257
|
-
createDebug.skips = [];
|
|
258
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
259
|
-
for (const ns of split) {
|
|
260
|
-
if (ns[0] === "-") {
|
|
261
|
-
createDebug.skips.push(ns.slice(1));
|
|
262
|
-
} else {
|
|
263
|
-
createDebug.names.push(ns);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function matchesTemplate(search, template) {
|
|
268
|
-
let searchIndex = 0;
|
|
269
|
-
let templateIndex = 0;
|
|
270
|
-
let starIndex = -1;
|
|
271
|
-
let matchIndex = 0;
|
|
272
|
-
while (searchIndex < search.length) {
|
|
273
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
274
|
-
if (template[templateIndex] === "*") {
|
|
275
|
-
starIndex = templateIndex;
|
|
276
|
-
matchIndex = searchIndex;
|
|
277
|
-
templateIndex++;
|
|
278
|
-
} else {
|
|
279
|
-
searchIndex++;
|
|
280
|
-
templateIndex++;
|
|
281
|
-
}
|
|
282
|
-
} else if (starIndex !== -1) {
|
|
283
|
-
templateIndex = starIndex + 1;
|
|
284
|
-
matchIndex++;
|
|
285
|
-
searchIndex = matchIndex;
|
|
286
|
-
} else {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
291
|
-
templateIndex++;
|
|
292
|
-
}
|
|
293
|
-
return templateIndex === template.length;
|
|
294
|
-
}
|
|
295
|
-
function disable() {
|
|
296
|
-
const namespaces = [
|
|
297
|
-
...createDebug.names,
|
|
298
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
299
|
-
].join(",");
|
|
300
|
-
createDebug.enable("");
|
|
301
|
-
return namespaces;
|
|
302
|
-
}
|
|
303
|
-
function enabled(name) {
|
|
304
|
-
for (const skip of createDebug.skips) {
|
|
305
|
-
if (matchesTemplate(name, skip)) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
for (const ns of createDebug.names) {
|
|
310
|
-
if (matchesTemplate(name, ns)) {
|
|
311
|
-
return true;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
function coerce(val) {
|
|
317
|
-
if (val instanceof Error) {
|
|
318
|
-
return val.stack || val.message;
|
|
319
|
-
}
|
|
320
|
-
return val;
|
|
321
|
-
}
|
|
322
|
-
function destroy() {
|
|
323
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
324
|
-
}
|
|
325
|
-
createDebug.enable(createDebug.load());
|
|
326
|
-
return createDebug;
|
|
327
|
-
}
|
|
328
|
-
module2.exports = setup;
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
// ../../node_modules/list-it/node_modules/debug/src/browser.js
|
|
333
|
-
var require_browser = __commonJS({
|
|
334
|
-
"../../node_modules/list-it/node_modules/debug/src/browser.js"(exports2, module2) {
|
|
335
|
-
"use strict";
|
|
336
|
-
exports2.formatArgs = formatArgs;
|
|
337
|
-
exports2.save = save;
|
|
338
|
-
exports2.load = load;
|
|
339
|
-
exports2.useColors = useColors;
|
|
340
|
-
exports2.storage = localstorage();
|
|
341
|
-
exports2.destroy = /* @__PURE__ */ (() => {
|
|
342
|
-
let warned = false;
|
|
343
|
-
return () => {
|
|
344
|
-
if (!warned) {
|
|
345
|
-
warned = true;
|
|
346
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
})();
|
|
350
|
-
exports2.colors = [
|
|
351
|
-
"#0000CC",
|
|
352
|
-
"#0000FF",
|
|
353
|
-
"#0033CC",
|
|
354
|
-
"#0033FF",
|
|
355
|
-
"#0066CC",
|
|
356
|
-
"#0066FF",
|
|
357
|
-
"#0099CC",
|
|
358
|
-
"#0099FF",
|
|
359
|
-
"#00CC00",
|
|
360
|
-
"#00CC33",
|
|
361
|
-
"#00CC66",
|
|
362
|
-
"#00CC99",
|
|
363
|
-
"#00CCCC",
|
|
364
|
-
"#00CCFF",
|
|
365
|
-
"#3300CC",
|
|
366
|
-
"#3300FF",
|
|
367
|
-
"#3333CC",
|
|
368
|
-
"#3333FF",
|
|
369
|
-
"#3366CC",
|
|
370
|
-
"#3366FF",
|
|
371
|
-
"#3399CC",
|
|
372
|
-
"#3399FF",
|
|
373
|
-
"#33CC00",
|
|
374
|
-
"#33CC33",
|
|
375
|
-
"#33CC66",
|
|
376
|
-
"#33CC99",
|
|
377
|
-
"#33CCCC",
|
|
378
|
-
"#33CCFF",
|
|
379
|
-
"#6600CC",
|
|
380
|
-
"#6600FF",
|
|
381
|
-
"#6633CC",
|
|
382
|
-
"#6633FF",
|
|
383
|
-
"#66CC00",
|
|
384
|
-
"#66CC33",
|
|
385
|
-
"#9900CC",
|
|
386
|
-
"#9900FF",
|
|
387
|
-
"#9933CC",
|
|
388
|
-
"#9933FF",
|
|
389
|
-
"#99CC00",
|
|
390
|
-
"#99CC33",
|
|
391
|
-
"#CC0000",
|
|
392
|
-
"#CC0033",
|
|
393
|
-
"#CC0066",
|
|
394
|
-
"#CC0099",
|
|
395
|
-
"#CC00CC",
|
|
396
|
-
"#CC00FF",
|
|
397
|
-
"#CC3300",
|
|
398
|
-
"#CC3333",
|
|
399
|
-
"#CC3366",
|
|
400
|
-
"#CC3399",
|
|
401
|
-
"#CC33CC",
|
|
402
|
-
"#CC33FF",
|
|
403
|
-
"#CC6600",
|
|
404
|
-
"#CC6633",
|
|
405
|
-
"#CC9900",
|
|
406
|
-
"#CC9933",
|
|
407
|
-
"#CCCC00",
|
|
408
|
-
"#CCCC33",
|
|
409
|
-
"#FF0000",
|
|
410
|
-
"#FF0033",
|
|
411
|
-
"#FF0066",
|
|
412
|
-
"#FF0099",
|
|
413
|
-
"#FF00CC",
|
|
414
|
-
"#FF00FF",
|
|
415
|
-
"#FF3300",
|
|
416
|
-
"#FF3333",
|
|
417
|
-
"#FF3366",
|
|
418
|
-
"#FF3399",
|
|
419
|
-
"#FF33CC",
|
|
420
|
-
"#FF33FF",
|
|
421
|
-
"#FF6600",
|
|
422
|
-
"#FF6633",
|
|
423
|
-
"#FF9900",
|
|
424
|
-
"#FF9933",
|
|
425
|
-
"#FFCC00",
|
|
426
|
-
"#FFCC33"
|
|
427
|
-
];
|
|
428
|
-
function useColors() {
|
|
429
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
430
|
-
return true;
|
|
431
|
-
}
|
|
432
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
433
|
-
return false;
|
|
434
|
-
}
|
|
435
|
-
let m;
|
|
436
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
437
|
-
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
438
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
439
|
-
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
440
|
-
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
441
|
-
}
|
|
442
|
-
function formatArgs(args2) {
|
|
443
|
-
args2[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args2[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
|
|
444
|
-
if (!this.useColors) {
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
const c = "color: " + this.color;
|
|
448
|
-
args2.splice(1, 0, c, "color: inherit");
|
|
449
|
-
let index = 0;
|
|
450
|
-
let lastC = 0;
|
|
451
|
-
args2[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
452
|
-
if (match === "%%") {
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
index++;
|
|
456
|
-
if (match === "%c") {
|
|
457
|
-
lastC = index;
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
args2.splice(lastC, 0, c);
|
|
461
|
-
}
|
|
462
|
-
exports2.log = console.debug || console.log || (() => {
|
|
463
|
-
});
|
|
464
|
-
function save(namespaces) {
|
|
465
|
-
try {
|
|
466
|
-
if (namespaces) {
|
|
467
|
-
exports2.storage.setItem("debug", namespaces);
|
|
468
|
-
} else {
|
|
469
|
-
exports2.storage.removeItem("debug");
|
|
470
|
-
}
|
|
471
|
-
} catch (error) {
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
function load() {
|
|
475
|
-
let r;
|
|
476
|
-
try {
|
|
477
|
-
r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
|
|
478
|
-
} catch (error) {
|
|
479
|
-
}
|
|
480
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
481
|
-
r = process.env.DEBUG;
|
|
482
|
-
}
|
|
483
|
-
return r;
|
|
484
|
-
}
|
|
485
|
-
function localstorage() {
|
|
486
|
-
try {
|
|
487
|
-
return localStorage;
|
|
488
|
-
} catch (error) {
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
module2.exports = require_common()(exports2);
|
|
492
|
-
var { formatters } = module2.exports;
|
|
493
|
-
formatters.j = function(v) {
|
|
494
|
-
try {
|
|
495
|
-
return JSON.stringify(v);
|
|
496
|
-
} catch (error) {
|
|
497
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
// ../../node_modules/has-flag/index.js
|
|
504
|
-
var require_has_flag = __commonJS({
|
|
505
|
-
"../../node_modules/has-flag/index.js"(exports2, module2) {
|
|
506
|
-
"use strict";
|
|
507
|
-
module2.exports = (flag, argv = process.argv) => {
|
|
508
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
509
|
-
const position = argv.indexOf(prefix + flag);
|
|
510
|
-
const terminatorPosition = argv.indexOf("--");
|
|
511
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
// ../../node_modules/supports-color/index.js
|
|
517
|
-
var require_supports_color = __commonJS({
|
|
518
|
-
"../../node_modules/supports-color/index.js"(exports2, module2) {
|
|
519
|
-
"use strict";
|
|
520
|
-
var os = require("os");
|
|
521
|
-
var tty = require("tty");
|
|
522
|
-
var hasFlag = require_has_flag();
|
|
523
|
-
var { env } = process;
|
|
524
|
-
var forceColor;
|
|
525
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
526
|
-
forceColor = 0;
|
|
527
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
528
|
-
forceColor = 1;
|
|
529
|
-
}
|
|
530
|
-
if ("FORCE_COLOR" in env) {
|
|
531
|
-
if (env.FORCE_COLOR === "true") {
|
|
532
|
-
forceColor = 1;
|
|
533
|
-
} else if (env.FORCE_COLOR === "false") {
|
|
534
|
-
forceColor = 0;
|
|
535
|
-
} else {
|
|
536
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function translateLevel(level) {
|
|
540
|
-
if (level === 0) {
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
return {
|
|
544
|
-
level,
|
|
545
|
-
hasBasic: true,
|
|
546
|
-
has256: level >= 2,
|
|
547
|
-
has16m: level >= 3
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
551
|
-
if (forceColor === 0) {
|
|
552
|
-
return 0;
|
|
553
|
-
}
|
|
554
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
555
|
-
return 3;
|
|
556
|
-
}
|
|
557
|
-
if (hasFlag("color=256")) {
|
|
558
|
-
return 2;
|
|
559
|
-
}
|
|
560
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
561
|
-
return 0;
|
|
562
|
-
}
|
|
563
|
-
const min = forceColor || 0;
|
|
564
|
-
if (env.TERM === "dumb") {
|
|
565
|
-
return min;
|
|
566
|
-
}
|
|
567
|
-
if (process.platform === "win32") {
|
|
568
|
-
const osRelease = os.release().split(".");
|
|
569
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
570
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
571
|
-
}
|
|
572
|
-
return 1;
|
|
573
|
-
}
|
|
574
|
-
if ("CI" in env) {
|
|
575
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
576
|
-
return 1;
|
|
577
|
-
}
|
|
578
|
-
return min;
|
|
579
|
-
}
|
|
580
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
581
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
582
|
-
}
|
|
583
|
-
if (env.COLORTERM === "truecolor") {
|
|
584
|
-
return 3;
|
|
585
|
-
}
|
|
586
|
-
if ("TERM_PROGRAM" in env) {
|
|
587
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
588
|
-
switch (env.TERM_PROGRAM) {
|
|
589
|
-
case "iTerm.app":
|
|
590
|
-
return version >= 3 ? 3 : 2;
|
|
591
|
-
case "Apple_Terminal":
|
|
592
|
-
return 2;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
596
|
-
return 2;
|
|
597
|
-
}
|
|
598
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
599
|
-
return 1;
|
|
600
|
-
}
|
|
601
|
-
if ("COLORTERM" in env) {
|
|
602
|
-
return 1;
|
|
603
|
-
}
|
|
604
|
-
return min;
|
|
605
|
-
}
|
|
606
|
-
function getSupportLevel(stream) {
|
|
607
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
608
|
-
return translateLevel(level);
|
|
609
|
-
}
|
|
610
|
-
module2.exports = {
|
|
611
|
-
supportsColor: getSupportLevel,
|
|
612
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
613
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
// ../../node_modules/list-it/node_modules/debug/src/node.js
|
|
619
|
-
var require_node = __commonJS({
|
|
620
|
-
"../../node_modules/list-it/node_modules/debug/src/node.js"(exports2, module2) {
|
|
621
|
-
"use strict";
|
|
622
|
-
var tty = require("tty");
|
|
623
|
-
var util = require("util");
|
|
624
|
-
exports2.init = init;
|
|
625
|
-
exports2.log = log;
|
|
626
|
-
exports2.formatArgs = formatArgs;
|
|
627
|
-
exports2.save = save;
|
|
628
|
-
exports2.load = load;
|
|
629
|
-
exports2.useColors = useColors;
|
|
630
|
-
exports2.destroy = util.deprecate(
|
|
631
|
-
() => {
|
|
632
|
-
},
|
|
633
|
-
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
634
|
-
);
|
|
635
|
-
exports2.colors = [6, 2, 3, 4, 5, 1];
|
|
636
|
-
try {
|
|
637
|
-
const supportsColor = require_supports_color();
|
|
638
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
639
|
-
exports2.colors = [
|
|
640
|
-
20,
|
|
641
|
-
21,
|
|
642
|
-
26,
|
|
643
|
-
27,
|
|
644
|
-
32,
|
|
645
|
-
33,
|
|
646
|
-
38,
|
|
647
|
-
39,
|
|
648
|
-
40,
|
|
649
|
-
41,
|
|
650
|
-
42,
|
|
651
|
-
43,
|
|
652
|
-
44,
|
|
653
|
-
45,
|
|
654
|
-
56,
|
|
655
|
-
57,
|
|
656
|
-
62,
|
|
657
|
-
63,
|
|
658
|
-
68,
|
|
659
|
-
69,
|
|
660
|
-
74,
|
|
661
|
-
75,
|
|
662
|
-
76,
|
|
663
|
-
77,
|
|
664
|
-
78,
|
|
665
|
-
79,
|
|
666
|
-
80,
|
|
667
|
-
81,
|
|
668
|
-
92,
|
|
669
|
-
93,
|
|
670
|
-
98,
|
|
671
|
-
99,
|
|
672
|
-
112,
|
|
673
|
-
113,
|
|
674
|
-
128,
|
|
675
|
-
129,
|
|
676
|
-
134,
|
|
677
|
-
135,
|
|
678
|
-
148,
|
|
679
|
-
149,
|
|
680
|
-
160,
|
|
681
|
-
161,
|
|
682
|
-
162,
|
|
683
|
-
163,
|
|
684
|
-
164,
|
|
685
|
-
165,
|
|
686
|
-
166,
|
|
687
|
-
167,
|
|
688
|
-
168,
|
|
689
|
-
169,
|
|
690
|
-
170,
|
|
691
|
-
171,
|
|
692
|
-
172,
|
|
693
|
-
173,
|
|
694
|
-
178,
|
|
695
|
-
179,
|
|
696
|
-
184,
|
|
697
|
-
185,
|
|
698
|
-
196,
|
|
699
|
-
197,
|
|
700
|
-
198,
|
|
701
|
-
199,
|
|
702
|
-
200,
|
|
703
|
-
201,
|
|
704
|
-
202,
|
|
705
|
-
203,
|
|
706
|
-
204,
|
|
707
|
-
205,
|
|
708
|
-
206,
|
|
709
|
-
207,
|
|
710
|
-
208,
|
|
711
|
-
209,
|
|
712
|
-
214,
|
|
713
|
-
215,
|
|
714
|
-
220,
|
|
715
|
-
221
|
|
716
|
-
];
|
|
717
|
-
}
|
|
718
|
-
} catch (error) {
|
|
719
|
-
}
|
|
720
|
-
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
721
|
-
return /^debug_/i.test(key);
|
|
722
|
-
}).reduce((obj, key) => {
|
|
723
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
724
|
-
return k.toUpperCase();
|
|
725
|
-
});
|
|
726
|
-
let val = process.env[key];
|
|
727
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
728
|
-
val = true;
|
|
729
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
730
|
-
val = false;
|
|
731
|
-
} else if (val === "null") {
|
|
732
|
-
val = null;
|
|
733
|
-
} else {
|
|
734
|
-
val = Number(val);
|
|
735
|
-
}
|
|
736
|
-
obj[prop] = val;
|
|
737
|
-
return obj;
|
|
738
|
-
}, {});
|
|
739
|
-
function useColors() {
|
|
740
|
-
return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
741
|
-
}
|
|
742
|
-
function formatArgs(args2) {
|
|
743
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
744
|
-
if (useColors2) {
|
|
745
|
-
const c = this.color;
|
|
746
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
747
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
748
|
-
args2[0] = prefix + args2[0].split("\n").join("\n" + prefix);
|
|
749
|
-
args2.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
|
|
750
|
-
} else {
|
|
751
|
-
args2[0] = getDate() + name + " " + args2[0];
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
function getDate() {
|
|
755
|
-
if (exports2.inspectOpts.hideDate) {
|
|
756
|
-
return "";
|
|
757
|
-
}
|
|
758
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
759
|
-
}
|
|
760
|
-
function log(...args2) {
|
|
761
|
-
return process.stderr.write(util.formatWithOptions(exports2.inspectOpts, ...args2) + "\n");
|
|
762
|
-
}
|
|
763
|
-
function save(namespaces) {
|
|
764
|
-
if (namespaces) {
|
|
765
|
-
process.env.DEBUG = namespaces;
|
|
766
|
-
} else {
|
|
767
|
-
delete process.env.DEBUG;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
function load() {
|
|
771
|
-
return process.env.DEBUG;
|
|
772
|
-
}
|
|
773
|
-
function init(debug) {
|
|
774
|
-
debug.inspectOpts = {};
|
|
775
|
-
const keys = Object.keys(exports2.inspectOpts);
|
|
776
|
-
for (let i = 0; i < keys.length; i++) {
|
|
777
|
-
debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
module2.exports = require_common()(exports2);
|
|
781
|
-
var { formatters } = module2.exports;
|
|
782
|
-
formatters.o = function(v) {
|
|
783
|
-
this.inspectOpts.colors = this.useColors;
|
|
784
|
-
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
785
|
-
};
|
|
786
|
-
formatters.O = function(v) {
|
|
787
|
-
this.inspectOpts.colors = this.useColors;
|
|
788
|
-
return util.inspect(v, this.inspectOpts);
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
|
|
793
|
-
// ../../node_modules/list-it/node_modules/debug/src/index.js
|
|
794
|
-
var require_src = __commonJS({
|
|
795
|
-
"../../node_modules/list-it/node_modules/debug/src/index.js"(exports2, module2) {
|
|
796
|
-
"use strict";
|
|
797
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
798
|
-
module2.exports = require_browser();
|
|
799
|
-
} else {
|
|
800
|
-
module2.exports = require_node();
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
|
|
805
|
-
// ../../node_modules/eastasianwidth/eastasianwidth.js
|
|
806
|
-
var require_eastasianwidth = __commonJS({
|
|
807
|
-
"../../node_modules/eastasianwidth/eastasianwidth.js"(exports2, module2) {
|
|
808
|
-
"use strict";
|
|
809
|
-
var eaw = {};
|
|
810
|
-
if ("undefined" == typeof module2) {
|
|
811
|
-
window.eastasianwidth = eaw;
|
|
812
|
-
} else {
|
|
813
|
-
module2.exports = eaw;
|
|
814
|
-
}
|
|
815
|
-
eaw.eastAsianWidth = function(character) {
|
|
816
|
-
var x = character.charCodeAt(0);
|
|
817
|
-
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
|
818
|
-
var codePoint = x;
|
|
819
|
-
if (55296 <= x && x <= 56319 && (56320 <= y && y <= 57343)) {
|
|
820
|
-
x &= 1023;
|
|
821
|
-
y &= 1023;
|
|
822
|
-
codePoint = x << 10 | y;
|
|
823
|
-
codePoint += 65536;
|
|
824
|
-
}
|
|
825
|
-
if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
|
|
826
|
-
return "F";
|
|
827
|
-
}
|
|
828
|
-
if (8361 == codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518) {
|
|
829
|
-
return "H";
|
|
830
|
-
}
|
|
831
|
-
if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
|
|
832
|
-
return "W";
|
|
833
|
-
}
|
|
834
|
-
if (32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 == codePoint || 175 == codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630) {
|
|
835
|
-
return "Na";
|
|
836
|
-
}
|
|
837
|
-
if (161 == codePoint || 164 == codePoint || 167 <= codePoint && codePoint <= 168 || 170 == codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 == codePoint || 208 == codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 == codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 == codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 == codePoint || 254 == codePoint || 257 == codePoint || 273 == codePoint || 275 == codePoint || 283 == codePoint || 294 <= codePoint && codePoint <= 295 || 299 == codePoint || 305 <= codePoint && codePoint <= 307 || 312 == codePoint || 319 <= codePoint && codePoint <= 322 || 324 == codePoint || 328 <= codePoint && codePoint <= 331 || 333 == codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 == codePoint || 462 == codePoint || 464 == codePoint || 466 == codePoint || 468 == codePoint || 470 == codePoint || 472 == codePoint || 474 == codePoint || 476 == codePoint || 593 == codePoint || 609 == codePoint || 708 == codePoint || 711 == codePoint || 713 <= codePoint && codePoint <= 715 || 717 == codePoint || 720 == codePoint || 728 <= codePoint && codePoint <= 731 || 733 == codePoint || 735 == codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 == codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 == codePoint || 8208 == codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 == codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 == codePoint || 8251 == codePoint || 8254 == codePoint || 8308 == codePoint || 8319 == codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 == codePoint || 8451 == codePoint || 8453 == codePoint || 8457 == codePoint || 8467 == codePoint || 8470 == codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 == codePoint || 8491 == codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 == codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 == codePoint || 8660 == codePoint || 8679 == codePoint || 8704 == codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 == codePoint || 8719 == codePoint || 8721 == codePoint || 8725 == codePoint || 8730 == codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 == codePoint || 8741 == codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 == codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 == codePoint || 8780 == codePoint || 8786 == codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 == codePoint || 8857 == codePoint || 8869 == codePoint || 8895 == codePoint || 8978 == codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 == codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 == codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 == codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 == codePoint || 9758 == codePoint || 9792 == codePoint || 9794 == codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 == codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 == codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 == codePoint || 10071 == codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 == codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109) {
|
|
838
|
-
return "A";
|
|
839
|
-
}
|
|
840
|
-
return "N";
|
|
841
|
-
};
|
|
842
|
-
eaw.characterLength = function(character) {
|
|
843
|
-
var code = this.eastAsianWidth(character);
|
|
844
|
-
if (code == "F" || code == "W" || code == "A") {
|
|
845
|
-
return 2;
|
|
846
|
-
} else {
|
|
847
|
-
return 1;
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
function stringToArray(string) {
|
|
851
|
-
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
852
|
-
}
|
|
853
|
-
eaw.length = function(string) {
|
|
854
|
-
var characters = stringToArray(string);
|
|
855
|
-
var len = 0;
|
|
856
|
-
for (var i = 0; i < characters.length; i++) {
|
|
857
|
-
len = len + this.characterLength(characters[i]);
|
|
858
|
-
}
|
|
859
|
-
return len;
|
|
860
|
-
};
|
|
861
|
-
eaw.slice = function(text, start, end) {
|
|
862
|
-
textLen = eaw.length(text);
|
|
863
|
-
start = start ? start : 0;
|
|
864
|
-
end = end ? end : 1;
|
|
865
|
-
if (start < 0) {
|
|
866
|
-
start = textLen + start;
|
|
867
|
-
}
|
|
868
|
-
if (end < 0) {
|
|
869
|
-
end = textLen + end;
|
|
870
|
-
}
|
|
871
|
-
var result = "";
|
|
872
|
-
var eawLen = 0;
|
|
873
|
-
var chars = stringToArray(text);
|
|
874
|
-
for (var i = 0; i < chars.length; i++) {
|
|
875
|
-
var char = chars[i];
|
|
876
|
-
var charLen = eaw.length(char);
|
|
877
|
-
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
|
878
|
-
if (eawLen + charLen <= end) {
|
|
879
|
-
result += char;
|
|
880
|
-
} else {
|
|
881
|
-
break;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
eawLen += charLen;
|
|
885
|
-
}
|
|
886
|
-
return result;
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
});
|
|
890
|
-
|
|
891
|
-
// ../../node_modules/list-it/lib/data-cell.js
|
|
892
|
-
var require_data_cell = __commonJS({
|
|
893
|
-
"../../node_modules/list-it/lib/data-cell.js"(exports2, module2) {
|
|
894
|
-
"use strict";
|
|
895
|
-
var eaw = require_eastasianwidth();
|
|
896
|
-
function DataCell() {
|
|
897
|
-
this.data = "";
|
|
898
|
-
}
|
|
899
|
-
module2.exports = DataCell;
|
|
900
|
-
DataCell.prototype.getData = function() {
|
|
901
|
-
return this.data;
|
|
902
|
-
};
|
|
903
|
-
DataCell.prototype.setData = function(data) {
|
|
904
|
-
this.data = data;
|
|
905
|
-
};
|
|
906
|
-
DataCell.prototype.visibleLength = function() {
|
|
907
|
-
if (typeof this.data != "string") {
|
|
908
|
-
return ("" + this.data).length;
|
|
909
|
-
}
|
|
910
|
-
return DataCell.visibleLength(this.data);
|
|
911
|
-
};
|
|
912
|
-
DataCell.visibleLength = function(data) {
|
|
913
|
-
const s = data.replace(/\x1b[^m]*m/g, "");
|
|
914
|
-
return eaw.length(s);
|
|
915
|
-
};
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
// ../../node_modules/list-it/lib/row.js
|
|
920
|
-
var require_row = __commonJS({
|
|
921
|
-
"../../node_modules/list-it/lib/row.js"(exports2, module2) {
|
|
922
|
-
"use strict";
|
|
923
|
-
function Row() {
|
|
924
|
-
this.cells = [];
|
|
925
|
-
this.empty = true;
|
|
926
|
-
this.fixed = false;
|
|
927
|
-
}
|
|
928
|
-
module2.exports = Row;
|
|
929
|
-
Row.prototype.getCellLength = function() {
|
|
930
|
-
return this.cells.length;
|
|
931
|
-
};
|
|
932
|
-
Row.prototype.getCell = function(idx) {
|
|
933
|
-
return this.cells[idx];
|
|
934
|
-
};
|
|
935
|
-
Row.prototype.pushCell = function(cell) {
|
|
936
|
-
if (this.isFixed()) {
|
|
937
|
-
throw "pushCell Fail, The row was already fixed.";
|
|
938
|
-
}
|
|
939
|
-
this.empty = false;
|
|
940
|
-
return this.cells.push(cell);
|
|
941
|
-
};
|
|
942
|
-
Row.prototype.fix = function() {
|
|
943
|
-
this.fixed = true;
|
|
944
|
-
};
|
|
945
|
-
Row.prototype.isEmpty = function() {
|
|
946
|
-
return this.empty;
|
|
947
|
-
};
|
|
948
|
-
Row.prototype.isFixed = function() {
|
|
949
|
-
return this.fixed;
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
|
|
954
|
-
// ../../node_modules/list-it/lib/column.js
|
|
955
|
-
var require_column = __commonJS({
|
|
956
|
-
"../../node_modules/list-it/lib/column.js"(exports2, module2) {
|
|
957
|
-
"use strict";
|
|
958
|
-
var DataCell = require_data_cell();
|
|
959
|
-
function Column() {
|
|
960
|
-
this.opt = {
|
|
961
|
-
"autoAlign": false
|
|
962
|
-
};
|
|
963
|
-
this.width = 0;
|
|
964
|
-
this.textWidth = null;
|
|
965
|
-
this.intLen = 0;
|
|
966
|
-
this.fracLen = 0;
|
|
967
|
-
this.expLen = 0;
|
|
968
|
-
this.cellAtRow = {};
|
|
969
|
-
this.header = null;
|
|
970
|
-
}
|
|
971
|
-
module2.exports = Column;
|
|
972
|
-
Column.prototype.getWidth = function() {
|
|
973
|
-
return this.width;
|
|
974
|
-
};
|
|
975
|
-
Column.prototype.setTextWidth = function(textWidth) {
|
|
976
|
-
this.textWidth = textWidth;
|
|
977
|
-
};
|
|
978
|
-
Column.prototype.setCellAt = function(row, cell) {
|
|
979
|
-
this.cellAtRow[row] = cell;
|
|
980
|
-
};
|
|
981
|
-
Column.prototype.setHeader = function(header) {
|
|
982
|
-
this.header = header;
|
|
983
|
-
};
|
|
984
|
-
Column.prototype.hasHeader = function() {
|
|
985
|
-
return this.header != null;
|
|
986
|
-
};
|
|
987
|
-
Column.prototype.updateWidth = function() {
|
|
988
|
-
const headerWidth = !this.hasHeader() ? 0 : DataCell.visibleLength("" + this.header);
|
|
989
|
-
this.width = headerWidth;
|
|
990
|
-
Object.keys(this.cellAtRow).forEach((key) => {
|
|
991
|
-
const cell = this.cellAtRow[key];
|
|
992
|
-
const data = cell.getData();
|
|
993
|
-
let width = cell.visibleLength();
|
|
994
|
-
if (typeof data == "number") {
|
|
995
|
-
if (this.opt.autoAlign) {
|
|
996
|
-
this.updateNumWidth(data);
|
|
997
|
-
width = this.getNumMaxWidth();
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
if (width > this.width) {
|
|
1001
|
-
this.width = width;
|
|
1002
|
-
}
|
|
1003
|
-
if (typeof data == "string") {
|
|
1004
|
-
if (this.textWidth && this.textWidth > headerWidth) {
|
|
1005
|
-
if (this.width > this.textWidth) {
|
|
1006
|
-
this.width = this.textWidth;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
1011
|
-
};
|
|
1012
|
-
Column.prototype.formatColumnHeader = function() {
|
|
1013
|
-
if (!this.hasHeader()) {
|
|
1014
|
-
return null;
|
|
1015
|
-
}
|
|
1016
|
-
const width = this.getWidth();
|
|
1017
|
-
const header = this.header;
|
|
1018
|
-
const headerWidth = DataCell.visibleLength("" + header);
|
|
1019
|
-
if (header.length == headerWidth && width - headerWidth <= 0) {
|
|
1020
|
-
return ("" + header).substring(0, width);
|
|
1021
|
-
}
|
|
1022
|
-
return "" + header + " ".repeat(width - headerWidth);
|
|
1023
|
-
};
|
|
1024
|
-
Column.prototype.formatCell = function(data) {
|
|
1025
|
-
const width = this.getWidth();
|
|
1026
|
-
if (this.opt.autoAlign) {
|
|
1027
|
-
if (typeof data == "number") {
|
|
1028
|
-
return this.makeAutoAlignNum(data).padStart(width, " ");
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
const dataWidth = DataCell.visibleLength("" + data);
|
|
1032
|
-
if (data.length == dataWidth && width - dataWidth <= 0) {
|
|
1033
|
-
return ("" + data).substring(0, width);
|
|
1034
|
-
}
|
|
1035
|
-
return "" + data + " ".repeat(width - dataWidth);
|
|
1036
|
-
};
|
|
1037
|
-
Column.prototype.setAutoAlign = function(autoAlign) {
|
|
1038
|
-
this.opt.autoAlign = autoAlign;
|
|
1039
|
-
};
|
|
1040
|
-
Column.prototype.updateNumWidth = function(num) {
|
|
1041
|
-
const numInfo = this.analyzeNumber(num);
|
|
1042
|
-
const intLen = numInfo.intStr.length;
|
|
1043
|
-
const fracLen = numInfo.fracStr.length;
|
|
1044
|
-
const expLen = numInfo.expStr.length;
|
|
1045
|
-
if (intLen > this.intLen) {
|
|
1046
|
-
this.intLen = intLen;
|
|
1047
|
-
}
|
|
1048
|
-
if (fracLen > this.fracLen) {
|
|
1049
|
-
this.fracLen = fracLen;
|
|
1050
|
-
}
|
|
1051
|
-
if (expLen > this.expLen) {
|
|
1052
|
-
this.expLen = expLen;
|
|
1053
|
-
}
|
|
1054
|
-
};
|
|
1055
|
-
Column.prototype.getNumMaxWidth = function() {
|
|
1056
|
-
return this.intLen + this.fracLen + (this.fracLen > 0 ? 1 : 0) + this.expLen + (this.expLen > 0 ? 1 : 0);
|
|
1057
|
-
};
|
|
1058
|
-
Column.prototype.makeAutoAlignNum = function(num) {
|
|
1059
|
-
const numInfo = this.analyzeNumber(num);
|
|
1060
|
-
const intStr = numInfo.intStr.padStart(this.intLen, " ");
|
|
1061
|
-
const fracStr = numInfo.expStr != "" ? numInfo.fracStr.padEnd(this.fracLen, "0") : numInfo.fracStr.padEnd(this.fracLen, " ");
|
|
1062
|
-
const expStr = numInfo.expStr.padEnd(this.expLen, " ");
|
|
1063
|
-
if (numInfo.expStr != "") {
|
|
1064
|
-
return [intStr, ".", fracStr, "e", expStr].join("");
|
|
1065
|
-
}
|
|
1066
|
-
if (numInfo.pointPos >= 0) {
|
|
1067
|
-
if (this.expLen > 0) {
|
|
1068
|
-
return [intStr, ".", fracStr, " ", expStr].join("");
|
|
1069
|
-
}
|
|
1070
|
-
return [intStr, ".", fracStr].join("");
|
|
1071
|
-
} else if (this.fracLen == 0) {
|
|
1072
|
-
return intStr;
|
|
1073
|
-
}
|
|
1074
|
-
if (this.expLen > 0) {
|
|
1075
|
-
return [intStr, ".0", fracStr.substr(1), " ", expStr].join("");
|
|
1076
|
-
}
|
|
1077
|
-
return [intStr, ".0", fracStr.substr(1)].join("");
|
|
1078
|
-
};
|
|
1079
|
-
Column.prototype.analyzeNumber = function(num) {
|
|
1080
|
-
const s = "" + num;
|
|
1081
|
-
let intStr = "";
|
|
1082
|
-
let fracStr = "";
|
|
1083
|
-
const pointPos = s.indexOf(".");
|
|
1084
|
-
const expIndex = s.indexOf("e");
|
|
1085
|
-
if (expIndex >= 0) {
|
|
1086
|
-
if (pointPos < 0) {
|
|
1087
|
-
return {
|
|
1088
|
-
pointPos: expIndex,
|
|
1089
|
-
intStr: s.substr(0, expIndex),
|
|
1090
|
-
fracStr: "0",
|
|
1091
|
-
expStr: s.substr(expIndex + 1)
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
return {
|
|
1095
|
-
pointPos,
|
|
1096
|
-
intStr: s.substr(0, pointPos),
|
|
1097
|
-
fracStr: s.substring(pointPos + 1, expIndex),
|
|
1098
|
-
expStr: s.substr(expIndex + 1)
|
|
1099
|
-
};
|
|
1100
|
-
}
|
|
1101
|
-
if (pointPos < 0) {
|
|
1102
|
-
intStr = s;
|
|
1103
|
-
} else {
|
|
1104
|
-
intStr = s.substr(0, pointPos);
|
|
1105
|
-
fracStr = s.substr(pointPos + 1);
|
|
1106
|
-
}
|
|
1107
|
-
return {
|
|
1108
|
-
"pointPos": pointPos,
|
|
1109
|
-
"intStr": intStr,
|
|
1110
|
-
"fracStr": fracStr,
|
|
1111
|
-
"expStr": ""
|
|
1112
|
-
};
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
|
-
|
|
1117
|
-
// ../../node_modules/ansi-escape-sequences/dist/index.cjs
|
|
1118
|
-
var require_dist = __commonJS({
|
|
1119
|
-
"../../node_modules/ansi-escape-sequences/dist/index.cjs"(exports2, module2) {
|
|
1120
|
-
"use strict";
|
|
1121
|
-
function isObject(input) {
|
|
1122
|
-
return typeof input === "object" && input !== null;
|
|
1123
|
-
}
|
|
1124
|
-
function isArrayLike(input) {
|
|
1125
|
-
return isObject(input) && typeof input.length === "number";
|
|
1126
|
-
}
|
|
1127
|
-
function arrayify(input) {
|
|
1128
|
-
if (Array.isArray(input)) {
|
|
1129
|
-
return input;
|
|
1130
|
-
} else if (input === void 0) {
|
|
1131
|
-
return [];
|
|
1132
|
-
} else if (isArrayLike(input) || input instanceof Set) {
|
|
1133
|
-
return Array.from(input);
|
|
1134
|
-
} else {
|
|
1135
|
-
return [input];
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
var csi = "\x1B[";
|
|
1139
|
-
var ansi = {};
|
|
1140
|
-
ansi.style = {
|
|
1141
|
-
reset: "\x1B[0m",
|
|
1142
|
-
bold: "\x1B[1m",
|
|
1143
|
-
italic: "\x1B[3m",
|
|
1144
|
-
underline: "\x1B[4m",
|
|
1145
|
-
fontDefault: "\x1B[10m",
|
|
1146
|
-
font2: "\x1B[11m",
|
|
1147
|
-
font3: "\x1B[12m",
|
|
1148
|
-
font4: "\x1B[13m",
|
|
1149
|
-
font5: "\x1B[14m",
|
|
1150
|
-
font6: "\x1B[15m",
|
|
1151
|
-
imageNegative: "\x1B[7m",
|
|
1152
|
-
imagePositive: "\x1B[27m",
|
|
1153
|
-
black: "\x1B[30m",
|
|
1154
|
-
red: "\x1B[31m",
|
|
1155
|
-
green: "\x1B[32m",
|
|
1156
|
-
yellow: "\x1B[33m",
|
|
1157
|
-
blue: "\x1B[34m",
|
|
1158
|
-
magenta: "\x1B[35m",
|
|
1159
|
-
cyan: "\x1B[36m",
|
|
1160
|
-
white: "\x1B[37m",
|
|
1161
|
-
grey: "\x1B[90m",
|
|
1162
|
-
gray: "\x1B[90m",
|
|
1163
|
-
brightRed: "\x1B[91m",
|
|
1164
|
-
brightGreen: "\x1B[92m",
|
|
1165
|
-
brightYellow: "\x1B[93m",
|
|
1166
|
-
brightBlue: "\x1B[94m",
|
|
1167
|
-
brightMagenta: "\x1B[95m",
|
|
1168
|
-
brightCyan: "\x1B[96m",
|
|
1169
|
-
brightWhite: "\x1B[97m",
|
|
1170
|
-
"bg-black": "\x1B[40m",
|
|
1171
|
-
"bg-red": "\x1B[41m",
|
|
1172
|
-
"bg-green": "\x1B[42m",
|
|
1173
|
-
"bg-yellow": "\x1B[43m",
|
|
1174
|
-
"bg-blue": "\x1B[44m",
|
|
1175
|
-
"bg-magenta": "\x1B[45m",
|
|
1176
|
-
"bg-cyan": "\x1B[46m",
|
|
1177
|
-
"bg-white": "\x1B[47m",
|
|
1178
|
-
"bg-grey": "\x1B[100m",
|
|
1179
|
-
"bg-gray": "\x1B[100m",
|
|
1180
|
-
"bg-brightRed": "\x1B[101m",
|
|
1181
|
-
"bg-brightGreen": "\x1B[102m",
|
|
1182
|
-
"bg-brightYellow": "\x1B[103m",
|
|
1183
|
-
"bg-brightBlue": "\x1B[104m",
|
|
1184
|
-
"bg-brightMagenta": "\x1B[105m",
|
|
1185
|
-
"bg-brightCyan": "\x1B[106m",
|
|
1186
|
-
"bg-brightWhite": "\x1B[107m"
|
|
1187
|
-
};
|
|
1188
|
-
ansi.rgb = function(r, g, b) {
|
|
1189
|
-
return `\x1B[38;2;${r};${g};${b}m`;
|
|
1190
|
-
};
|
|
1191
|
-
ansi.bgRgb = function(r, g, b) {
|
|
1192
|
-
return `\x1B[48;2;${r};${g};${b}m`;
|
|
1193
|
-
};
|
|
1194
|
-
ansi.styles = function(styles) {
|
|
1195
|
-
styles = arrayify(styles);
|
|
1196
|
-
return styles.map(function(effect) {
|
|
1197
|
-
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
1198
|
-
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
1199
|
-
if (bgRgbMatches) {
|
|
1200
|
-
const [full, r, g, b] = bgRgbMatches;
|
|
1201
|
-
return ansi.bgRgb(r, g, b);
|
|
1202
|
-
} else if (rgbMatches) {
|
|
1203
|
-
const [full, r, g, b] = rgbMatches;
|
|
1204
|
-
return ansi.rgb(r, g, b);
|
|
1205
|
-
} else {
|
|
1206
|
-
return ansi.style[effect];
|
|
1207
|
-
}
|
|
1208
|
-
}).join("");
|
|
1209
|
-
};
|
|
1210
|
-
ansi.format = function(str, styleArray) {
|
|
1211
|
-
const re = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
1212
|
-
let matches;
|
|
1213
|
-
str = String(str);
|
|
1214
|
-
if (!str) return "";
|
|
1215
|
-
while (matches = str.match(re)) {
|
|
1216
|
-
const inlineStyles = matches[1].split(/\s+/);
|
|
1217
|
-
const inlineString = matches[2];
|
|
1218
|
-
str = str.replace(matches[0], ansi.format(inlineString, inlineStyles));
|
|
1219
|
-
}
|
|
1220
|
-
return styleArray && styleArray.length ? ansi.styles(styleArray) + str + ansi.style.reset : str;
|
|
1221
|
-
};
|
|
1222
|
-
ansi.cursor = {
|
|
1223
|
-
/**
|
|
1224
|
-
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
1225
|
-
* @param [lines=1] {number}
|
|
1226
|
-
* @return {string}
|
|
1227
|
-
*/
|
|
1228
|
-
up: function(lines) {
|
|
1229
|
-
return csi + (lines || 1) + "A";
|
|
1230
|
-
},
|
|
1231
|
-
/**
|
|
1232
|
-
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
1233
|
-
* @param [lines=1] {number}
|
|
1234
|
-
* @return {string}
|
|
1235
|
-
*/
|
|
1236
|
-
down: function(lines) {
|
|
1237
|
-
return csi + (lines || 1) + "B";
|
|
1238
|
-
},
|
|
1239
|
-
/**
|
|
1240
|
-
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
1241
|
-
* @param [lines=1] {number}
|
|
1242
|
-
* @return {string}
|
|
1243
|
-
*/
|
|
1244
|
-
forward: function(lines) {
|
|
1245
|
-
return csi + (lines || 1) + "C";
|
|
1246
|
-
},
|
|
1247
|
-
/**
|
|
1248
|
-
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
1249
|
-
* @param [lines=1] {number}
|
|
1250
|
-
* @return {string}
|
|
1251
|
-
*/
|
|
1252
|
-
back: function(lines) {
|
|
1253
|
-
return csi + (lines || 1) + "D";
|
|
1254
|
-
},
|
|
1255
|
-
/**
|
|
1256
|
-
* Moves cursor to beginning of the line n lines down.
|
|
1257
|
-
* @param [lines=1] {number}
|
|
1258
|
-
* @return {string}
|
|
1259
|
-
*/
|
|
1260
|
-
nextLine: function(lines) {
|
|
1261
|
-
return csi + (lines || 1) + "E";
|
|
1262
|
-
},
|
|
1263
|
-
/**
|
|
1264
|
-
* Moves cursor to beginning of the line n lines up.
|
|
1265
|
-
* @param [lines=1] {number}
|
|
1266
|
-
* @return {string}
|
|
1267
|
-
*/
|
|
1268
|
-
previousLine: function(lines) {
|
|
1269
|
-
return csi + (lines || 1) + "F";
|
|
1270
|
-
},
|
|
1271
|
-
/**
|
|
1272
|
-
* Moves the cursor to column n.
|
|
1273
|
-
* @param n {number} - column number
|
|
1274
|
-
* @return {string}
|
|
1275
|
-
*/
|
|
1276
|
-
horizontalAbsolute: function(n) {
|
|
1277
|
-
return csi + n + "G";
|
|
1278
|
-
},
|
|
1279
|
-
/**
|
|
1280
|
-
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
1281
|
-
* @param n {number} - row number
|
|
1282
|
-
* @param m {number} - column number
|
|
1283
|
-
* @return {string}
|
|
1284
|
-
*/
|
|
1285
|
-
position: function(n, m) {
|
|
1286
|
-
return csi + (n || 1) + ";" + (m || 1) + "H";
|
|
1287
|
-
},
|
|
1288
|
-
/**
|
|
1289
|
-
* Hides the cursor
|
|
1290
|
-
*/
|
|
1291
|
-
hide: csi + "?25l",
|
|
1292
|
-
/**
|
|
1293
|
-
* Shows the cursor
|
|
1294
|
-
*/
|
|
1295
|
-
show: csi + "?25h"
|
|
1296
|
-
};
|
|
1297
|
-
ansi.erase = {
|
|
1298
|
-
/**
|
|
1299
|
-
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
1300
|
-
* @param n {number}
|
|
1301
|
-
* @return {string}
|
|
1302
|
-
*/
|
|
1303
|
-
display: function(n) {
|
|
1304
|
-
return csi + (n || 0) + "J";
|
|
1305
|
-
},
|
|
1306
|
-
/**
|
|
1307
|
-
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
1308
|
-
* @param n {number}
|
|
1309
|
-
* @return {string}
|
|
1310
|
-
*/
|
|
1311
|
-
inLine: function(n) {
|
|
1312
|
-
return csi + (n || 0) + "K";
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
module2.exports = ansi;
|
|
1316
|
-
}
|
|
1317
|
-
});
|
|
1318
|
-
|
|
1319
|
-
// ../../node_modules/list-it/lib/list-it-buffer.js
|
|
1320
|
-
var require_list_it_buffer = __commonJS({
|
|
1321
|
-
"../../node_modules/list-it/lib/list-it-buffer.js"(exports2, module2) {
|
|
1322
|
-
"use strict";
|
|
1323
|
-
var debug = require_src()("list-it-buffer");
|
|
1324
|
-
var DataCell = require_data_cell();
|
|
1325
|
-
var Row = require_row();
|
|
1326
|
-
var Column = require_column();
|
|
1327
|
-
var ansi = require_dist();
|
|
1328
|
-
function ListItBuffer(opt) {
|
|
1329
|
-
opt = opt || {};
|
|
1330
|
-
this.opt = {
|
|
1331
|
-
"autoAlign": true,
|
|
1332
|
-
"columnWidth": null,
|
|
1333
|
-
"header": null,
|
|
1334
|
-
"headerBold": false,
|
|
1335
|
-
"headerColor": "",
|
|
1336
|
-
"headerUnderline": false
|
|
1337
|
-
};
|
|
1338
|
-
if (opt.header != null && !Array.isArray(opt.header)) {
|
|
1339
|
-
throw new Error([
|
|
1340
|
-
`Invalid header was specified. It must be an array, but (${JSON.stringify(opt.header)}):${typeof opt.header} was specified.`
|
|
1341
|
-
].join(" "));
|
|
1342
|
-
}
|
|
1343
|
-
if (opt.headerColor && !(opt.headerColor in COLORS)) {
|
|
1344
|
-
throw new Error([
|
|
1345
|
-
`Invalid color ${JSON.stringify(opt.headerColor)} was specified.`,
|
|
1346
|
-
"Available color names:",
|
|
1347
|
-
...AVAILABLE_COLORS.map((color) => `* ${JSON.stringify(color)}`)
|
|
1348
|
-
].join("\n"));
|
|
1349
|
-
}
|
|
1350
|
-
Object.keys(this.opt).forEach((key) => {
|
|
1351
|
-
if (key in opt) {
|
|
1352
|
-
this.opt[key] = opt[key];
|
|
1353
|
-
}
|
|
1354
|
-
});
|
|
1355
|
-
this.lines = [];
|
|
1356
|
-
this.columns = [];
|
|
1357
|
-
this.columnWidth = this.opt.columnWidth;
|
|
1358
|
-
if (this.opt.header) {
|
|
1359
|
-
this.setHeaderRow(this.opt.header);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
module2.exports = ListItBuffer;
|
|
1363
|
-
ListItBuffer.prototype.nl = function() {
|
|
1364
|
-
const lastRowIndex = this.lines.length - 1;
|
|
1365
|
-
if (lastRowIndex >= 0 && !this.lines[lastRowIndex].isFixed()) {
|
|
1366
|
-
this.lines[lastRowIndex].fix();
|
|
1367
|
-
}
|
|
1368
|
-
this.pushNewRow();
|
|
1369
|
-
return this;
|
|
1370
|
-
};
|
|
1371
|
-
ListItBuffer.prototype.d = function(data) {
|
|
1372
|
-
if (arguments.length > 1) {
|
|
1373
|
-
const array = Array.apply(null, arguments);
|
|
1374
|
-
if (ListItBuffer.isMultiDimensionalArray(array)) {
|
|
1375
|
-
array.forEach((row) => this.addRow(row));
|
|
1376
|
-
} else {
|
|
1377
|
-
array.forEach((data2) => this.d(data2));
|
|
1378
|
-
}
|
|
1379
|
-
return this;
|
|
1380
|
-
}
|
|
1381
|
-
if (Array.isArray(data)) {
|
|
1382
|
-
if (ListItBuffer.isMultiDimensionalArray(data)) {
|
|
1383
|
-
data.forEach((row) => this.addRow(row));
|
|
1384
|
-
} else if (ListItBuffer.isObjectArray(data)) {
|
|
1385
|
-
data = objectArrayToTable(data);
|
|
1386
|
-
if (!this.header && (this.opt.headerBold || this.opt.headerColor || this.opt.headerUnderline)) {
|
|
1387
|
-
this.setHeaderRow(data.shift());
|
|
1388
|
-
}
|
|
1389
|
-
data.forEach((row) => this.addRow(row));
|
|
1390
|
-
} else {
|
|
1391
|
-
this.addRow(data);
|
|
1392
|
-
}
|
|
1393
|
-
return this;
|
|
1394
|
-
}
|
|
1395
|
-
const rowidx = this.lines.length - 1;
|
|
1396
|
-
if (rowidx < 0 || this.lines[rowidx].isFixed()) {
|
|
1397
|
-
this.pushNewRow();
|
|
1398
|
-
}
|
|
1399
|
-
const cell = new DataCell();
|
|
1400
|
-
cell.setData(data);
|
|
1401
|
-
const iRow = this.lines.length - 1;
|
|
1402
|
-
let iCol = this.lines[iRow].getCellLength();
|
|
1403
|
-
if (iCol >= this.columns.length) {
|
|
1404
|
-
this.addColumn();
|
|
1405
|
-
}
|
|
1406
|
-
this.columns[iCol].setCellAt(iRow, cell);
|
|
1407
|
-
this.lines[iRow].pushCell(cell);
|
|
1408
|
-
return this;
|
|
1409
|
-
};
|
|
1410
|
-
ListItBuffer.isMultiDimensionalArray = function(arr) {
|
|
1411
|
-
if (!Array.isArray(arr)) {
|
|
1412
|
-
throw Error("The parameter arr must be array");
|
|
1413
|
-
}
|
|
1414
|
-
for (let element of arr) {
|
|
1415
|
-
if (!Array.isArray(element)) {
|
|
1416
|
-
return false;
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
return true;
|
|
1420
|
-
};
|
|
1421
|
-
ListItBuffer.isObjectArray = function(arr) {
|
|
1422
|
-
if (!Array.isArray(arr)) {
|
|
1423
|
-
throw Error("The parameter arr must be array");
|
|
1424
|
-
}
|
|
1425
|
-
const ctor = arr[0].constructor;
|
|
1426
|
-
for (let element of arr) {
|
|
1427
|
-
if (typeof element != "object") {
|
|
1428
|
-
return false;
|
|
1429
|
-
} else {
|
|
1430
|
-
if (element.constructor.name != ctor.name) {
|
|
1431
|
-
return false;
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
return true;
|
|
1436
|
-
};
|
|
1437
|
-
ListItBuffer.prototype.addRow = function(row) {
|
|
1438
|
-
row.forEach((col) => {
|
|
1439
|
-
switch (typeof col) {
|
|
1440
|
-
case "string":
|
|
1441
|
-
case "number":
|
|
1442
|
-
this.d(col);
|
|
1443
|
-
break;
|
|
1444
|
-
default:
|
|
1445
|
-
this.d(col != null ? col.toString() : "(null)");
|
|
1446
|
-
break;
|
|
1447
|
-
}
|
|
1448
|
-
});
|
|
1449
|
-
this.nl();
|
|
1450
|
-
};
|
|
1451
|
-
ListItBuffer.prototype.pushNewRow = function() {
|
|
1452
|
-
this.lines.push(new Row());
|
|
1453
|
-
};
|
|
1454
|
-
ListItBuffer.prototype.toString = function() {
|
|
1455
|
-
const rows = [];
|
|
1456
|
-
this.columns.forEach((column, iCol) => {
|
|
1457
|
-
if (this.header != null) {
|
|
1458
|
-
column.setHeader(this.header[iCol] || "");
|
|
1459
|
-
}
|
|
1460
|
-
column.setTextWidth(this.getColumnWidth(iCol));
|
|
1461
|
-
column.updateWidth();
|
|
1462
|
-
});
|
|
1463
|
-
if (this.header != null) {
|
|
1464
|
-
const headerLine = this.applyHeaderStyleOption(
|
|
1465
|
-
this.columns.map((column) => column.formatColumnHeader()).join(" ")
|
|
1466
|
-
);
|
|
1467
|
-
rows.push(headerLine);
|
|
1468
|
-
const headerUnderline = this.generateHeaderUnderline();
|
|
1469
|
-
if (headerUnderline) {
|
|
1470
|
-
rows.push(headerUnderline);
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
this.lines.forEach((line) => {
|
|
1474
|
-
if (line.isFixed() || !line.isEmpty()) {
|
|
1475
|
-
if (line.isEmpty()) {
|
|
1476
|
-
rows.push("\n");
|
|
1477
|
-
} else {
|
|
1478
|
-
rows.push(this.columns.map((column, iCol) => {
|
|
1479
|
-
const cell = line.getCell(iCol);
|
|
1480
|
-
const data = cell.getData();
|
|
1481
|
-
return column.formatCell(data);
|
|
1482
|
-
}).join(" "));
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
return rows.join("\n");
|
|
1487
|
-
};
|
|
1488
|
-
var COLORS = {};
|
|
1489
|
-
var BGCOLORS = {};
|
|
1490
|
-
Object.keys(ansi.style).forEach((key) => {
|
|
1491
|
-
const value = ansi.style[key];
|
|
1492
|
-
if (/^bg-/.test(key)) {
|
|
1493
|
-
BGCOLORS[key.substr(3)] = value;
|
|
1494
|
-
} else {
|
|
1495
|
-
COLORS[key] = value;
|
|
1496
|
-
debug(`COLOR-KEY: ${key}`);
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1499
|
-
Object.keys(COLORS).forEach((key) => {
|
|
1500
|
-
if (!(key in BGCOLORS)) {
|
|
1501
|
-
delete COLORS[key];
|
|
1502
|
-
debug(`remove COLOR-KEY: ${key}`);
|
|
1503
|
-
}
|
|
1504
|
-
});
|
|
1505
|
-
var AVAILABLE_COLORS = Object.keys(COLORS);
|
|
1506
|
-
debug(`AVAILABLE_COLORS:${JSON.stringify(AVAILABLE_COLORS)}`);
|
|
1507
|
-
ListItBuffer.prototype.applyHeaderStyleOption = function(line) {
|
|
1508
|
-
if (!this.opt.headerBold && !this.opt.headerColor) {
|
|
1509
|
-
return line;
|
|
1510
|
-
}
|
|
1511
|
-
const textBuffer = [];
|
|
1512
|
-
if (this.opt.headerBold) {
|
|
1513
|
-
textBuffer.push(ansi.style.bold);
|
|
1514
|
-
}
|
|
1515
|
-
if (this.opt.headerColor) {
|
|
1516
|
-
textBuffer.push(COLORS[this.opt.headerColor]);
|
|
1517
|
-
}
|
|
1518
|
-
textBuffer.push(line);
|
|
1519
|
-
textBuffer.push(ansi.style.reset);
|
|
1520
|
-
return textBuffer.join("");
|
|
1521
|
-
};
|
|
1522
|
-
ListItBuffer.prototype.generateHeaderUnderline = function() {
|
|
1523
|
-
if (!this.opt.headerUnderline) {
|
|
1524
|
-
return null;
|
|
1525
|
-
}
|
|
1526
|
-
if (this.header == null) {
|
|
1527
|
-
return null;
|
|
1528
|
-
}
|
|
1529
|
-
return this.columns.map(
|
|
1530
|
-
(column) => "-".repeat(column.getWidth())
|
|
1531
|
-
).join(" ");
|
|
1532
|
-
};
|
|
1533
|
-
function objectArrayToTable(objects) {
|
|
1534
|
-
const keys = Object.keys(objects[0]);
|
|
1535
|
-
const body = objects.map((item) => keys.map((key) => {
|
|
1536
|
-
if (item[key] != null && typeof item[key] == "object" && item[key].constructor.name == "Date") {
|
|
1537
|
-
return item[key].toISOString();
|
|
1538
|
-
}
|
|
1539
|
-
return item[key];
|
|
1540
|
-
}));
|
|
1541
|
-
return [keys, ...body];
|
|
1542
|
-
}
|
|
1543
|
-
ListItBuffer.prototype.setColumnWidth = function(indexOfColumns, width) {
|
|
1544
|
-
this.columnWidth = this.columnWidth || [];
|
|
1545
|
-
if (typeof indexOfColumns !== "number") {
|
|
1546
|
-
throw new Error("indexOfColumns must be a number");
|
|
1547
|
-
}
|
|
1548
|
-
if (!width) {
|
|
1549
|
-
delete this.columnWidth[indexOfColumns];
|
|
1550
|
-
} else {
|
|
1551
|
-
if (typeof width !== "number") {
|
|
1552
|
-
throw new Error("width must be a number");
|
|
1553
|
-
}
|
|
1554
|
-
this.columnWidth[indexOfColumns] = width;
|
|
1555
|
-
}
|
|
1556
|
-
return this;
|
|
1557
|
-
};
|
|
1558
|
-
ListItBuffer.prototype.setColumnWidthAll = function(widthForAll) {
|
|
1559
|
-
if (widthForAll != null && !Array.isArray(widthForAll) && typeof widthForAll !== "number") {
|
|
1560
|
-
throw new Error(
|
|
1561
|
-
"widthForAll must be one of a null, an Array or a number"
|
|
1562
|
-
);
|
|
1563
|
-
}
|
|
1564
|
-
if (Array.isArray(widthForAll)) {
|
|
1565
|
-
for (let i = 0; i < widthForAll.length; i++) {
|
|
1566
|
-
const width = widthForAll[i];
|
|
1567
|
-
if (width != void 0 && typeof width !== "number") {
|
|
1568
|
-
throw new Error(
|
|
1569
|
-
`widthForAll[${i}] must be an undefined or a number`
|
|
1570
|
-
);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
this.columnWidth = widthForAll;
|
|
1575
|
-
return this;
|
|
1576
|
-
};
|
|
1577
|
-
ListItBuffer.prototype.getColumnWidth = function(indexOfColumns) {
|
|
1578
|
-
if (Array.isArray(this.columnWidth)) {
|
|
1579
|
-
return this.columnWidth[indexOfColumns];
|
|
1580
|
-
}
|
|
1581
|
-
return this.columnWidth;
|
|
1582
|
-
};
|
|
1583
|
-
ListItBuffer.prototype.setHeaderRow = function(header) {
|
|
1584
|
-
if (header && !Array.isArray(header)) {
|
|
1585
|
-
throw new Error([
|
|
1586
|
-
"The header must be an array,",
|
|
1587
|
-
`but ${typeof header} was specified.`,
|
|
1588
|
-
`header: ${JSON.stringify(header)}`
|
|
1589
|
-
].join(" "));
|
|
1590
|
-
}
|
|
1591
|
-
this.header = header;
|
|
1592
|
-
if (this.header == null) {
|
|
1593
|
-
this.columns.forEach((column) => column.setHeader(null));
|
|
1594
|
-
} else {
|
|
1595
|
-
this.header.forEach((headerText, iCol) => {
|
|
1596
|
-
if (iCol >= this.columns.length) {
|
|
1597
|
-
this.addColumn(headerText);
|
|
1598
|
-
}
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
return this;
|
|
1602
|
-
};
|
|
1603
|
-
ListItBuffer.prototype.addColumn = function(headerText) {
|
|
1604
|
-
const column = new Column();
|
|
1605
|
-
if (headerText) {
|
|
1606
|
-
column.setHeader(headerText);
|
|
1607
|
-
}
|
|
1608
|
-
if (this.opt.autoAlign) {
|
|
1609
|
-
column.setAutoAlign(true);
|
|
1610
|
-
}
|
|
1611
|
-
this.columns.push(column);
|
|
1612
|
-
};
|
|
1613
|
-
}
|
|
1614
|
-
});
|
|
1615
|
-
|
|
1616
|
-
// ../../node_modules/list-it/index.js
|
|
1617
|
-
var require_list_it = __commonJS({
|
|
1618
|
-
"../../node_modules/list-it/index.js"(exports2, module2) {
|
|
1619
|
-
"use strict";
|
|
1620
|
-
var ListItBuffer = require_list_it_buffer();
|
|
1621
|
-
function ListIt2(opt) {
|
|
1622
|
-
ListItBuffer.call(this, opt);
|
|
1623
|
-
}
|
|
1624
|
-
ListIt2.prototype = new ListItBuffer();
|
|
1625
|
-
ListIt2.buffer = function(opt) {
|
|
1626
|
-
opt = opt || {};
|
|
1627
|
-
if (!("autoAlign" in opt)) {
|
|
1628
|
-
opt.autoAlign = false;
|
|
1629
|
-
}
|
|
1630
|
-
return new ListIt2(opt);
|
|
1631
|
-
};
|
|
1632
|
-
module2.exports = ListIt2;
|
|
1633
|
-
}
|
|
1634
|
-
});
|
|
1635
|
-
|
|
1636
30
|
// src/scripts/runtimeParity.ts
|
|
1637
31
|
var runtimeParity_exports = {};
|
|
1638
32
|
__export(runtimeParity_exports, {
|
|
@@ -1986,17 +380,7 @@ var summarizeTradeParityByStrategy = ({
|
|
|
1986
380
|
// src/lib/runtimeRedis.ts
|
|
1987
381
|
var import_redis = require("@tradejs/infra/redis");
|
|
1988
382
|
var import_time = require("@tradejs/core/time");
|
|
1989
|
-
var
|
|
1990
|
-
var RESERVED_CONFIG_IDS = /* @__PURE__ */ new Set(["results"]);
|
|
1991
|
-
var resolveStrategyConfigIdentityByKey = (userName, key) => {
|
|
1992
|
-
const parts = key.split(":");
|
|
1993
|
-
if (parts.length !== 5) return null;
|
|
1994
|
-
const [users, keyUserName, strategiesKey, strategyName, configId] = parts;
|
|
1995
|
-
if (users !== "users" || keyUserName !== userName || strategiesKey !== "strategies" || !strategyName || !configId || RESERVED_STRATEGY_NAMES.has(strategyName) || RESERVED_CONFIG_IDS.has(configId) || !/^[a-zA-Z0-9_-]+$/.test(configId)) {
|
|
1996
|
-
return null;
|
|
1997
|
-
}
|
|
1998
|
-
return { strategyName, configId };
|
|
1999
|
-
};
|
|
383
|
+
var import_runtimeStrategyConfigs = require("@tradejs/infra/runtimeStrategyConfigs");
|
|
2000
384
|
var isRuntimeTradeRecord = (value) => {
|
|
2001
385
|
if (!value || typeof value !== "object") {
|
|
2002
386
|
return false;
|
|
@@ -2004,18 +388,6 @@ var isRuntimeTradeRecord = (value) => {
|
|
|
2004
388
|
const record = value;
|
|
2005
389
|
return typeof record.orderId === "string" && typeof record.strategy === "string" && typeof record.symbol === "string" && typeof record.entryTimestamp === "number" && typeof record.entryPrice === "number" && typeof record.qty === "number" && (record.direction === "LONG" || record.direction === "SHORT");
|
|
2006
390
|
};
|
|
2007
|
-
var resolveStrategyNameByConfigKey = (userName, key) => {
|
|
2008
|
-
return resolveStrategyConfigIdentityByKey(userName, key)?.strategyName ?? null;
|
|
2009
|
-
};
|
|
2010
|
-
var getRuntimeStrategyConfigKeys = async (userName) => {
|
|
2011
|
-
const keys = await (0, import_redis.getKeys)(`${import_redis.redisKeys.strategies(userName)}:`);
|
|
2012
|
-
return keys.filter((key) => resolveStrategyConfigIdentityByKey(userName, key)).sort((left, right) => left.localeCompare(right));
|
|
2013
|
-
};
|
|
2014
|
-
var loadRuntimeStrategyNames = async (userName) => [
|
|
2015
|
-
...new Set(
|
|
2016
|
-
(await getRuntimeStrategyConfigKeys(userName)).map((key) => resolveStrategyNameByConfigKey(userName, key)).filter((value) => Boolean(value))
|
|
2017
|
-
)
|
|
2018
|
-
].sort((left, right) => left.localeCompare(right));
|
|
2019
391
|
var loadRuntimeTrades = async (userName, {
|
|
2020
392
|
startTime,
|
|
2021
393
|
endTime
|
|
@@ -2262,20 +634,20 @@ var resolveTimeWindow = ({
|
|
|
2262
634
|
const explicitStart = toEpochMs(startTime);
|
|
2263
635
|
const explicitEnd = toEpochMs(endTime);
|
|
2264
636
|
const resolvedDays = toPositiveNumber(days);
|
|
2265
|
-
const alignToLastClosedInterval = (
|
|
637
|
+
const alignToLastClosedInterval = (window, preserveDuration) => {
|
|
2266
638
|
if (typeof closedIntervalMs !== "number" || !Number.isFinite(closedIntervalMs) || closedIntervalMs <= 0) {
|
|
2267
|
-
return
|
|
639
|
+
return window;
|
|
2268
640
|
}
|
|
2269
|
-
const alignedEnd = Math.floor(
|
|
2270
|
-
const delta =
|
|
2271
|
-
const alignedStart = preserveDuration ?
|
|
641
|
+
const alignedEnd = Math.floor(window.end / closedIntervalMs) * closedIntervalMs - 1;
|
|
642
|
+
const delta = window.end - alignedEnd;
|
|
643
|
+
const alignedStart = preserveDuration ? window.start - delta : window.start;
|
|
2272
644
|
if (alignedStart >= alignedEnd) {
|
|
2273
645
|
throw new Error(
|
|
2274
646
|
`Invalid closed-candle window: start (${alignedStart}) must be less than end (${alignedEnd})`
|
|
2275
647
|
);
|
|
2276
648
|
}
|
|
2277
649
|
return {
|
|
2278
|
-
...
|
|
650
|
+
...window,
|
|
2279
651
|
start: Math.trunc(alignedStart),
|
|
2280
652
|
end: Math.trunc(alignedEnd)
|
|
2281
653
|
};
|
|
@@ -2332,7 +704,7 @@ var resolveTimeWindow = ({
|
|
|
2332
704
|
|
|
2333
705
|
// src/lib/runFormatting.ts
|
|
2334
706
|
var import_date_fns = require("date-fns");
|
|
2335
|
-
var ListIt =
|
|
707
|
+
var ListIt = require("list-it");
|
|
2336
708
|
var formatDuration = (startedAt) => {
|
|
2337
709
|
const seconds = Math.max(0, (Date.now() - startedAt) / 1e3);
|
|
2338
710
|
if (seconds < 60) return `${seconds.toFixed(1)}s`;
|
|
@@ -2351,7 +723,7 @@ var timeOperation = async (label, operation, log = console.log) => {
|
|
|
2351
723
|
|
|
2352
724
|
// src/lib/marketContextPrepare.ts
|
|
2353
725
|
var import_chalk4 = __toESM(require("chalk"));
|
|
2354
|
-
var
|
|
726
|
+
var import_marketContext3 = require("@tradejs/infra/timescale/marketContext");
|
|
2355
727
|
var import_registry = require("@tradejs/node/registry");
|
|
2356
728
|
|
|
2357
729
|
// src/lib/binanceMarketContextBackfill.ts
|
|
@@ -2360,7 +732,8 @@ var import_chalk = __toESM(require("chalk"));
|
|
|
2360
732
|
var import_connectors = require("@tradejs/connectors");
|
|
2361
733
|
var import_connectors2 = require("@tradejs/node/connectors");
|
|
2362
734
|
var import_strategies = require("@tradejs/node/strategies");
|
|
2363
|
-
var
|
|
735
|
+
var import_marketContext = require("@tradejs/infra/timescale/marketContext");
|
|
736
|
+
var import_client = require("@tradejs/infra/timescale/client");
|
|
2364
737
|
|
|
2365
738
|
// src/lib/binanceMarketData.ts
|
|
2366
739
|
var MARKET_FEATURE_INTERVAL_MS = {
|
|
@@ -2868,7 +1241,7 @@ var backfillBinanceMarketContext = async (params, enabled) => {
|
|
|
2868
1241
|
if (endMs <= Math.min(breadthStartMs, tradeFlowStartMs)) {
|
|
2869
1242
|
return skippedBackfillResult();
|
|
2870
1243
|
}
|
|
2871
|
-
await (0,
|
|
1244
|
+
await (0, import_client.waitForDbReady)();
|
|
2872
1245
|
const connector = await getBinanceConnector({
|
|
2873
1246
|
projectRoot: params.projectRoot,
|
|
2874
1247
|
userName: params.userName
|
|
@@ -2914,7 +1287,7 @@ var backfillBinanceMarketContext = async (params, enabled) => {
|
|
|
2914
1287
|
)
|
|
2915
1288
|
);
|
|
2916
1289
|
if (includeTradeFlow && referenceSymbols.length) {
|
|
2917
|
-
const coverage = await (0,
|
|
1290
|
+
const coverage = await (0, import_marketContext.getMarketTradeFlowCoverage)({
|
|
2918
1291
|
symbols: referenceSymbols,
|
|
2919
1292
|
interval: interval2,
|
|
2920
1293
|
startMs: tradeFlowStartMs,
|
|
@@ -2998,7 +1371,7 @@ var backfillBinanceMarketContext = async (params, enabled) => {
|
|
|
2998
1371
|
const ts = row.ts.getTime();
|
|
2999
1372
|
return ts >= chunk.startMs && ts <= chunk.endMs;
|
|
3000
1373
|
});
|
|
3001
|
-
await (0,
|
|
1374
|
+
await (0, import_marketContext.upsertMarketTradeFlowRows)(boundedRows);
|
|
3002
1375
|
tradeFlowRows += boundedRows.length;
|
|
3003
1376
|
chunkBar?.tick(1, {
|
|
3004
1377
|
rows: tradeFlowRows,
|
|
@@ -3026,7 +1399,7 @@ var backfillBinanceMarketContext = async (params, enabled) => {
|
|
|
3026
1399
|
});
|
|
3027
1400
|
const plans = await Promise.all(
|
|
3028
1401
|
breadthUniverses.map(async (definition) => {
|
|
3029
|
-
const coverage = await (0,
|
|
1402
|
+
const coverage = await (0, import_marketContext.getMarketBreadthCoverage)({
|
|
3030
1403
|
universe: definition.universe,
|
|
3031
1404
|
interval: interval2,
|
|
3032
1405
|
startMs: breadthStartMs,
|
|
@@ -3127,7 +1500,7 @@ var backfillBinanceMarketContext = async (params, enabled) => {
|
|
|
3127
1500
|
const ts = row.ts.getTime();
|
|
3128
1501
|
return ts >= chunk.startMs && ts <= chunk.endMs;
|
|
3129
1502
|
});
|
|
3130
|
-
await (0,
|
|
1503
|
+
await (0, import_marketContext.upsertMarketBreadthRows)(rows);
|
|
3131
1504
|
breadthRows += rows.length;
|
|
3132
1505
|
}
|
|
3133
1506
|
}
|
|
@@ -3155,7 +1528,8 @@ var import_progress2 = __toESM(require("progress"));
|
|
|
3155
1528
|
var import_async = require("@tradejs/core/async");
|
|
3156
1529
|
var import_constants2 = require("@tradejs/core/constants");
|
|
3157
1530
|
var import_indicators = require("@tradejs/core/indicators");
|
|
3158
|
-
var
|
|
1531
|
+
var import_derivatives = require("@tradejs/infra/timescale/derivatives");
|
|
1532
|
+
var import_client2 = require("@tradejs/infra/timescale/client");
|
|
3159
1533
|
var import_userSettings = require("@tradejs/infra/userSettings");
|
|
3160
1534
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
3161
1535
|
var DAY_MS2 = 24 * HOUR_MS;
|
|
@@ -3668,13 +2042,13 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3668
2042
|
if (!intervalWindows.length) {
|
|
3669
2043
|
return skippedBackfillResult2();
|
|
3670
2044
|
}
|
|
3671
|
-
await (0,
|
|
2045
|
+
await (0, import_client2.waitForDbReady)();
|
|
3672
2046
|
const edgesByInterval = /* @__PURE__ */ new Map();
|
|
3673
2047
|
await Promise.all(
|
|
3674
2048
|
intervalWindows.map(async ({ interval: interval2 }) => {
|
|
3675
2049
|
edgesByInterval.set(
|
|
3676
2050
|
interval2,
|
|
3677
|
-
await (0,
|
|
2051
|
+
await (0, import_derivatives.getDerivativesDataEdgesForSymbols)(symbols, interval2)
|
|
3678
2052
|
);
|
|
3679
2053
|
})
|
|
3680
2054
|
);
|
|
@@ -3683,32 +2057,32 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3683
2057
|
const liquidationCoverageRangesByInterval = /* @__PURE__ */ new Map();
|
|
3684
2058
|
const coverageNowMs = Date.now();
|
|
3685
2059
|
await Promise.all(
|
|
3686
|
-
intervalWindows.map(async (
|
|
2060
|
+
intervalWindows.map(async (window) => {
|
|
3687
2061
|
const confirmedLiquidationWindow = (0, import_indicators.resolveCoinalyzeConfirmedIntradayCoverage)({
|
|
3688
|
-
interval:
|
|
3689
|
-
fromMs:
|
|
3690
|
-
toMs:
|
|
2062
|
+
interval: window.interval,
|
|
2063
|
+
fromMs: window.fromMs,
|
|
2064
|
+
toMs: window.toMs,
|
|
3691
2065
|
nowMs: coverageNowMs
|
|
3692
2066
|
});
|
|
3693
2067
|
const [coverageRows, liquidationCoverageRows] = await Promise.all([
|
|
3694
|
-
(0,
|
|
2068
|
+
(0, import_derivatives.getDerivativesBackfillCoverage)({
|
|
3695
2069
|
source: "coinalyze",
|
|
3696
2070
|
symbols,
|
|
3697
|
-
interval:
|
|
3698
|
-
fromMs:
|
|
3699
|
-
toMs:
|
|
2071
|
+
interval: window.interval,
|
|
2072
|
+
fromMs: window.fromMs,
|
|
2073
|
+
toMs: window.toMs
|
|
3700
2074
|
}),
|
|
3701
|
-
confirmedLiquidationWindow ? (0,
|
|
2075
|
+
confirmedLiquidationWindow ? (0, import_derivatives.getDerivativesMetricCoverage)({
|
|
3702
2076
|
source: "coinalyze",
|
|
3703
2077
|
metric: "liquidation",
|
|
3704
2078
|
symbols,
|
|
3705
|
-
interval:
|
|
2079
|
+
interval: window.interval,
|
|
3706
2080
|
fromMs: confirmedLiquidationWindow.fromMs,
|
|
3707
2081
|
toMs: confirmedLiquidationWindow.toMs
|
|
3708
2082
|
}) : Promise.resolve([])
|
|
3709
2083
|
]);
|
|
3710
2084
|
coverageKeysByInterval.set(
|
|
3711
|
-
|
|
2085
|
+
window.interval,
|
|
3712
2086
|
new Set(
|
|
3713
2087
|
coverageRows.map(
|
|
3714
2088
|
(row) => coverageKey({
|
|
@@ -3727,7 +2101,7 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3727
2101
|
ranges.push({ fromMs: row.fromMs, toMs: row.toMs });
|
|
3728
2102
|
rangesBySymbol.set(symbol, ranges);
|
|
3729
2103
|
}
|
|
3730
|
-
coverageRangesByInterval.set(
|
|
2104
|
+
coverageRangesByInterval.set(window.interval, rangesBySymbol);
|
|
3731
2105
|
const liquidationRangesBySymbol = /* @__PURE__ */ new Map();
|
|
3732
2106
|
for (const row of liquidationCoverageRows) {
|
|
3733
2107
|
const symbol = row.symbol.toUpperCase();
|
|
@@ -3736,33 +2110,33 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3736
2110
|
liquidationRangesBySymbol.set(symbol, ranges);
|
|
3737
2111
|
}
|
|
3738
2112
|
liquidationCoverageRangesByInterval.set(
|
|
3739
|
-
|
|
2113
|
+
window.interval,
|
|
3740
2114
|
liquidationRangesBySymbol
|
|
3741
2115
|
);
|
|
3742
2116
|
})
|
|
3743
2117
|
);
|
|
3744
2118
|
const cachedWindows = intervalWindows.reduce(
|
|
3745
|
-
(sum,
|
|
3746
|
-
fromMs:
|
|
3747
|
-
toMs:
|
|
2119
|
+
(sum, window) => sum + countBackfillWindows({
|
|
2120
|
+
fromMs: window.fromMs,
|
|
2121
|
+
toMs: window.toMs,
|
|
3748
2122
|
batchMs,
|
|
3749
|
-
intervalMs:
|
|
2123
|
+
intervalMs: window.intervalMs
|
|
3750
2124
|
}),
|
|
3751
2125
|
0
|
|
3752
2126
|
);
|
|
3753
|
-
const allBackfillWindowsCached = mode !== "signals" && intervalWindows.every((
|
|
3754
|
-
const edgesBySymbol = edgesByInterval.get(
|
|
3755
|
-
const coverageKeys = coverageKeysByInterval.get(
|
|
2127
|
+
const allBackfillWindowsCached = mode !== "signals" && intervalWindows.every((window) => {
|
|
2128
|
+
const edgesBySymbol = edgesByInterval.get(window.interval);
|
|
2129
|
+
const coverageKeys = coverageKeysByInterval.get(window.interval);
|
|
3756
2130
|
const backfillWindows = buildBackfillWindows({
|
|
3757
|
-
fromMs:
|
|
3758
|
-
toMs:
|
|
2131
|
+
fromMs: window.fromMs,
|
|
2132
|
+
toMs: window.toMs,
|
|
3759
2133
|
batchMs,
|
|
3760
|
-
intervalMs:
|
|
2134
|
+
intervalMs: window.intervalMs
|
|
3761
2135
|
});
|
|
3762
2136
|
return symbols.every(
|
|
3763
2137
|
(symbol) => backfillWindows.every((backfillWindow) => {
|
|
3764
2138
|
const normalizedSymbol = symbol.toUpperCase();
|
|
3765
|
-
const coverageRanges = coverageRangesByInterval.get(
|
|
2139
|
+
const coverageRanges = coverageRangesByInterval.get(window.interval)?.get(normalizedSymbol) ?? [];
|
|
3766
2140
|
const dataCovered = hasDerivativesWindowCoverage({
|
|
3767
2141
|
edges: edgesBySymbol?.get(normalizedSymbol),
|
|
3768
2142
|
fromMs: backfillWindow.fromMs,
|
|
@@ -3771,26 +2145,26 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3771
2145
|
ranges: coverageRanges,
|
|
3772
2146
|
fromMs: backfillWindow.fromMs,
|
|
3773
2147
|
toMs: backfillWindow.toMs,
|
|
3774
|
-
intervalMs:
|
|
2148
|
+
intervalMs: window.intervalMs
|
|
3775
2149
|
}) == null || coverageKeys?.has(
|
|
3776
2150
|
coverageKey({
|
|
3777
2151
|
symbol: normalizedSymbol,
|
|
3778
|
-
interval:
|
|
2152
|
+
interval: window.interval,
|
|
3779
2153
|
fromMs: backfillWindow.fromMs,
|
|
3780
2154
|
toMs: backfillWindow.toMs
|
|
3781
2155
|
})
|
|
3782
2156
|
);
|
|
3783
2157
|
const confirmedLiquidationWindow = (0, import_indicators.resolveCoinalyzeConfirmedIntradayCoverage)({
|
|
3784
|
-
interval:
|
|
2158
|
+
interval: window.interval,
|
|
3785
2159
|
fromMs: backfillWindow.fromMs,
|
|
3786
2160
|
toMs: backfillWindow.toMs,
|
|
3787
2161
|
nowMs: coverageNowMs
|
|
3788
2162
|
});
|
|
3789
2163
|
const liquidationCovered = confirmedLiquidationWindow == null || resolveDerivativesContextMissingCoverageFetchFromMs({
|
|
3790
|
-
ranges: liquidationCoverageRangesByInterval.get(
|
|
2164
|
+
ranges: liquidationCoverageRangesByInterval.get(window.interval)?.get(normalizedSymbol) ?? [],
|
|
3791
2165
|
fromMs: confirmedLiquidationWindow.fromMs,
|
|
3792
2166
|
toMs: confirmedLiquidationWindow.toMs,
|
|
3793
|
-
intervalMs:
|
|
2167
|
+
intervalMs: window.intervalMs
|
|
3794
2168
|
}) == null;
|
|
3795
2169
|
return dataCovered && liquidationCovered;
|
|
3796
2170
|
})
|
|
@@ -3840,11 +2214,11 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3840
2214
|
);
|
|
3841
2215
|
const symbolBatches = chunkArray(matches, symbolBatchSize);
|
|
3842
2216
|
const windowsPerPair = intervalWindows.reduce(
|
|
3843
|
-
(sum,
|
|
3844
|
-
fromMs:
|
|
3845
|
-
toMs:
|
|
2217
|
+
(sum, window) => sum + countBackfillWindows({
|
|
2218
|
+
fromMs: window.fromMs,
|
|
2219
|
+
toMs: window.toMs,
|
|
3846
2220
|
batchMs,
|
|
3847
|
-
intervalMs:
|
|
2221
|
+
intervalMs: window.intervalMs
|
|
3848
2222
|
}),
|
|
3849
2223
|
0
|
|
3850
2224
|
);
|
|
@@ -3867,9 +2241,9 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3867
2241
|
`derivatives context backfill: symbols=${matches.length}, requestedSymbols=${requestedSymbols.length}, unmatched=${unmatched.length}, intervals=${intervals.join(",")}, window=${new Date(fromMs).toISOString()}..${new Date(safeEndMs).toISOString()}, testStart=${new Date(safeStartMs).toISOString()}`
|
|
3868
2242
|
)
|
|
3869
2243
|
);
|
|
3870
|
-
for (const
|
|
3871
|
-
const { interval: interval2, intervalMs } =
|
|
3872
|
-
const edgesBySymbol = edgesByInterval.get(interval2) ?? await (0,
|
|
2244
|
+
for (const window of intervalWindows) {
|
|
2245
|
+
const { interval: interval2, intervalMs } = window;
|
|
2246
|
+
const edgesBySymbol = edgesByInterval.get(interval2) ?? await (0, import_derivatives.getDerivativesDataEdgesForSymbols)(
|
|
3873
2247
|
matches.map((item) => item.symbol),
|
|
3874
2248
|
interval2
|
|
3875
2249
|
);
|
|
@@ -3884,9 +2258,9 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3884
2258
|
);
|
|
3885
2259
|
for (let batchIdx = 0; batchIdx < symbolBatches.length; batchIdx += 1) {
|
|
3886
2260
|
const batch = symbolBatches[batchIdx];
|
|
3887
|
-
let cursor =
|
|
3888
|
-
while (cursor <
|
|
3889
|
-
const toMs = Math.min(
|
|
2261
|
+
let cursor = window.fromMs;
|
|
2262
|
+
while (cursor < window.toMs) {
|
|
2263
|
+
const toMs = Math.min(window.toMs, cursor + batchMs);
|
|
3890
2264
|
const missingRanges = batch.map((item) => {
|
|
3891
2265
|
const key = coverageKey({
|
|
3892
2266
|
symbol: item.symbol,
|
|
@@ -3992,7 +2366,7 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
3992
2366
|
);
|
|
3993
2367
|
}
|
|
3994
2368
|
if (rows.length) {
|
|
3995
|
-
await (0,
|
|
2369
|
+
await (0, import_derivatives.upsertDerivatives)(rows);
|
|
3996
2370
|
totalRows += rows.length;
|
|
3997
2371
|
}
|
|
3998
2372
|
const confirmedLiquidationWindow = (0, import_indicators.resolveCoinalyzeConfirmedIntradayCoverage)({
|
|
@@ -4020,7 +2394,7 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
4020
2394
|
eventRowsCount
|
|
4021
2395
|
};
|
|
4022
2396
|
});
|
|
4023
|
-
await (0,
|
|
2397
|
+
await (0, import_derivatives.applyDerivativesMetricCoverage)(metricCoverageRows);
|
|
4024
2398
|
for (const coverageRow of metricCoverageRows) {
|
|
4025
2399
|
const symbol = coverageRow.symbol.toUpperCase();
|
|
4026
2400
|
const ranges = liquidationCoverageRangesBySymbol.get(symbol) ?? [];
|
|
@@ -4052,7 +2426,7 @@ var backfillDerivativesContext = async (params, enabled, mode) => {
|
|
|
4052
2426
|
rowsCount
|
|
4053
2427
|
};
|
|
4054
2428
|
});
|
|
4055
|
-
await (0,
|
|
2429
|
+
await (0, import_derivatives.upsertDerivativesBackfillCoverage)(coverageRows);
|
|
4056
2430
|
for (const coverageRow of coverageRows) {
|
|
4057
2431
|
const symbol = coverageRow.symbol.toUpperCase();
|
|
4058
2432
|
edgesBySymbol.set(
|
|
@@ -4129,7 +2503,8 @@ var backfillDerivativesContextForSignals = async (params) => backfillDerivatives
|
|
|
4129
2503
|
// src/lib/coinMarketCapContextBackfill.ts
|
|
4130
2504
|
var import_chalk3 = __toESM(require("chalk"));
|
|
4131
2505
|
var import_async2 = require("@tradejs/core/async");
|
|
4132
|
-
var
|
|
2506
|
+
var import_marketContext2 = require("@tradejs/infra/timescale/marketContext");
|
|
2507
|
+
var import_client3 = require("@tradejs/infra/timescale/client");
|
|
4133
2508
|
var import_userSettings2 = require("@tradejs/infra/userSettings");
|
|
4134
2509
|
var DAY_MS3 = 864e5;
|
|
4135
2510
|
var DEFAULT_CONTEXT_MAX_AGE_MS = 48 * 60 * 6e4;
|
|
@@ -4393,7 +2768,7 @@ var logBackfillSourceDone = (params) => {
|
|
|
4393
2768
|
)
|
|
4394
2769
|
);
|
|
4395
2770
|
};
|
|
4396
|
-
var markBackfillCoverage = (rows) => (0,
|
|
2771
|
+
var markBackfillCoverage = (rows) => (0, import_marketContext2.upsertMarketContextBackfillCoverage)(rows);
|
|
4397
2772
|
var coinMarketCapFetch = async (params) => {
|
|
4398
2773
|
const url = new URL(`${getBaseUrl()}${params.path}`);
|
|
4399
2774
|
for (const [key, value] of Object.entries(params.searchParams)) {
|
|
@@ -4722,7 +3097,7 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
4722
3097
|
if (toMs <= fromMs) return skippedResult();
|
|
4723
3098
|
const exchangeLiquidityEnabled = isExchangeLiquidityBackfillEnabled();
|
|
4724
3099
|
const fearGreedEnabled = isFearGreedBackfillEnabled();
|
|
4725
|
-
await (0,
|
|
3100
|
+
await (0, import_client3.waitForDbReady)();
|
|
4726
3101
|
const [
|
|
4727
3102
|
globalDailyCoverage,
|
|
4728
3103
|
referenceDailyCoverage,
|
|
@@ -4735,66 +3110,66 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
4735
3110
|
fearGreedBackfillCoverage,
|
|
4736
3111
|
indexBackfillCoverage
|
|
4737
3112
|
] = await Promise.all([
|
|
4738
|
-
(0,
|
|
3113
|
+
(0, import_marketContext2.getMarketGlobalContextCoverage)({
|
|
4739
3114
|
source: SOURCE_GLOBAL_DAILY,
|
|
4740
3115
|
startMs: fromMs,
|
|
4741
3116
|
endMs: toMs
|
|
4742
3117
|
}),
|
|
4743
|
-
(0,
|
|
3118
|
+
(0, import_marketContext2.getMarketReferenceAssetContextCoverage)({
|
|
4744
3119
|
source: SOURCE_REFERENCE,
|
|
4745
3120
|
symbols: REFERENCE_ASSETS.map((item) => item.symbol),
|
|
4746
3121
|
interval: "1d",
|
|
4747
3122
|
startMs: fromMs,
|
|
4748
3123
|
endMs: toMs
|
|
4749
3124
|
}),
|
|
4750
|
-
exchangeLiquidityEnabled ? (0,
|
|
3125
|
+
exchangeLiquidityEnabled ? (0, import_marketContext2.getMarketCmcExchangeLiquidityContextCoverage)({
|
|
4751
3126
|
source: SOURCE_EXCHANGE_LIQUIDITY,
|
|
4752
3127
|
interval: "1d",
|
|
4753
3128
|
startMs: fromMs,
|
|
4754
3129
|
endMs: toMs
|
|
4755
3130
|
}) : Promise.resolve(null),
|
|
4756
|
-
fearGreedEnabled ? (0,
|
|
3131
|
+
fearGreedEnabled ? (0, import_marketContext2.getMarketCmcFearGreedContextCoverage)({
|
|
4757
3132
|
source: SOURCE_FEAR_GREED,
|
|
4758
3133
|
interval: "1d",
|
|
4759
3134
|
startMs: fromMs,
|
|
4760
3135
|
endMs: toMs
|
|
4761
3136
|
}) : Promise.resolve(null),
|
|
4762
|
-
(0,
|
|
3137
|
+
(0, import_marketContext2.getMarketCmcIndexContextCoverage)({
|
|
4763
3138
|
source: SOURCE_INDEX,
|
|
4764
3139
|
indexSlugs: CMC_INDEXES.map((index) => index.slug),
|
|
4765
3140
|
interval: "1d",
|
|
4766
3141
|
startMs: fromMs,
|
|
4767
3142
|
endMs: toMs
|
|
4768
3143
|
}),
|
|
4769
|
-
(0,
|
|
3144
|
+
(0, import_marketContext2.getMarketContextBackfillCoverage)({
|
|
4770
3145
|
source: SOURCE_GLOBAL_DAILY,
|
|
4771
3146
|
scopes: [COVERAGE_SCOPE_ALL],
|
|
4772
3147
|
interval: "1d",
|
|
4773
3148
|
fromMs,
|
|
4774
3149
|
toMs
|
|
4775
3150
|
}),
|
|
4776
|
-
(0,
|
|
3151
|
+
(0, import_marketContext2.getMarketContextBackfillCoverage)({
|
|
4777
3152
|
source: SOURCE_REFERENCE,
|
|
4778
3153
|
scopes: REFERENCE_ASSETS.map((item) => item.symbol),
|
|
4779
3154
|
interval: "1d",
|
|
4780
3155
|
fromMs,
|
|
4781
3156
|
toMs
|
|
4782
3157
|
}),
|
|
4783
|
-
exchangeLiquidityEnabled ? (0,
|
|
3158
|
+
exchangeLiquidityEnabled ? (0, import_marketContext2.getMarketContextBackfillCoverage)({
|
|
4784
3159
|
source: SOURCE_EXCHANGE_LIQUIDITY,
|
|
4785
3160
|
scopes: [COVERAGE_SCOPE_ALL],
|
|
4786
3161
|
interval: "1d",
|
|
4787
3162
|
fromMs,
|
|
4788
3163
|
toMs
|
|
4789
3164
|
}) : Promise.resolve([]),
|
|
4790
|
-
fearGreedEnabled ? (0,
|
|
3165
|
+
fearGreedEnabled ? (0, import_marketContext2.getMarketContextBackfillCoverage)({
|
|
4791
3166
|
source: SOURCE_FEAR_GREED,
|
|
4792
3167
|
scopes: [COVERAGE_SCOPE_ALL],
|
|
4793
3168
|
interval: "1d",
|
|
4794
3169
|
fromMs,
|
|
4795
3170
|
toMs
|
|
4796
3171
|
}) : Promise.resolve([]),
|
|
4797
|
-
(0,
|
|
3172
|
+
(0, import_marketContext2.getMarketContextBackfillCoverage)({
|
|
4798
3173
|
source: SOURCE_INDEX,
|
|
4799
3174
|
scopes: CMC_INDEXES.map((index) => index.slug),
|
|
4800
3175
|
interval: "1d",
|
|
@@ -4985,7 +3360,7 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
4985
3360
|
}
|
|
4986
3361
|
});
|
|
4987
3362
|
const rows = coinMarketCapGlobalPayloadToRows(payload, SOURCE_GLOBAL_DAILY);
|
|
4988
|
-
await (0,
|
|
3363
|
+
await (0, import_marketContext2.upsertMarketGlobalContextRows)(rows);
|
|
4989
3364
|
await markBackfillCoverage([
|
|
4990
3365
|
{
|
|
4991
3366
|
source: SOURCE_GLOBAL_DAILY,
|
|
@@ -5019,7 +3394,7 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
5019
3394
|
}
|
|
5020
3395
|
});
|
|
5021
3396
|
const rows = coinMarketCapHistoricalQuotesPayloadToRows(payload, "1d");
|
|
5022
|
-
await (0,
|
|
3397
|
+
await (0, import_marketContext2.upsertMarketReferenceAssetContextRows)(rows);
|
|
5023
3398
|
await markBackfillCoverage(
|
|
5024
3399
|
REFERENCE_ASSETS.map((asset) => ({
|
|
5025
3400
|
source: SOURCE_REFERENCE,
|
|
@@ -5058,7 +3433,7 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
5058
3433
|
payload,
|
|
5059
3434
|
"1d"
|
|
5060
3435
|
);
|
|
5061
|
-
await (0,
|
|
3436
|
+
await (0, import_marketContext2.upsertMarketCmcExchangeLiquidityContextRows)(rows);
|
|
5062
3437
|
await markBackfillCoverage([
|
|
5063
3438
|
{
|
|
5064
3439
|
source: SOURCE_EXCHANGE_LIQUIDITY,
|
|
@@ -5103,7 +3478,7 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
5103
3478
|
const oldestPageTs = Math.min(...pageRows.map((row) => row.ts.getTime()));
|
|
5104
3479
|
if (oldestPageTs < fromMs || pageRows.length < pageSize) break;
|
|
5105
3480
|
}
|
|
5106
|
-
await (0,
|
|
3481
|
+
await (0, import_marketContext2.upsertMarketCmcFearGreedContextRows)(rows);
|
|
5107
3482
|
await markBackfillCoverage([
|
|
5108
3483
|
{
|
|
5109
3484
|
source: SOURCE_FEAR_GREED,
|
|
@@ -5137,7 +3512,7 @@ var backfillCoinMarketCapContext = async (params) => {
|
|
|
5137
3512
|
}))
|
|
5138
3513
|
);
|
|
5139
3514
|
const rows = rowsByIndex.flatMap((item) => item.result.rows);
|
|
5140
|
-
await (0,
|
|
3515
|
+
await (0, import_marketContext2.upsertMarketCmcIndexContextRows)(rows);
|
|
5141
3516
|
await markBackfillCoverage(
|
|
5142
3517
|
rowsByIndex.map(({ index, result }) => ({
|
|
5143
3518
|
source: SOURCE_INDEX,
|
|
@@ -5189,7 +3564,7 @@ var backfillCoinMarketCapContextForSignals = (params) => backfillCoinMarketCapCo
|
|
|
5189
3564
|
|
|
5190
3565
|
// src/lib/hyperliquidWhaleBackfill.ts
|
|
5191
3566
|
var import_progress3 = __toESM(require("progress"));
|
|
5192
|
-
var
|
|
3567
|
+
var import_hyperliquidWhales = require("@tradejs/infra/timescale/hyperliquidWhales");
|
|
5193
3568
|
var import_strategies2 = require("@tradejs/node/strategies");
|
|
5194
3569
|
|
|
5195
3570
|
// src/lib/hyperliquidWhaleData.ts
|
|
@@ -5444,7 +3819,7 @@ var backfillHyperliquidWhaleContext = async (params) => {
|
|
|
5444
3819
|
};
|
|
5445
3820
|
const fromMs = Math.floor(params.startMs / HYPERLIQUID_WHALE_BUCKET_MS) * HYPERLIQUID_WHALE_BUCKET_MS;
|
|
5446
3821
|
const toMs = minuteCeil(params.endMs);
|
|
5447
|
-
const cached = await (0,
|
|
3822
|
+
const cached = await (0, import_hyperliquidWhales.hasHyperliquidWhaleBackfillCoverage)({
|
|
5448
3823
|
fromMs,
|
|
5449
3824
|
toMs,
|
|
5450
3825
|
...identity
|
|
@@ -5493,7 +3868,7 @@ var backfillHyperliquidWhaleContext = async (params) => {
|
|
|
5493
3868
|
items: whales.addresses,
|
|
5494
3869
|
concurrency,
|
|
5495
3870
|
worker: async (address) => {
|
|
5496
|
-
const previous = await (0,
|
|
3871
|
+
const previous = await (0, import_hyperliquidWhales.getHyperliquidWhaleWalletCoverage)({
|
|
5497
3872
|
address,
|
|
5498
3873
|
fromMs,
|
|
5499
3874
|
toMs,
|
|
@@ -5520,8 +3895,8 @@ var backfillHyperliquidWhaleContext = async (params) => {
|
|
|
5520
3895
|
identity
|
|
5521
3896
|
})
|
|
5522
3897
|
).filter((row) => row != null);
|
|
5523
|
-
await (0,
|
|
5524
|
-
await (0,
|
|
3898
|
+
await (0, import_hyperliquidWhales.upsertHyperliquidWhaleTradeEvents)(addressEvents);
|
|
3899
|
+
await (0, import_hyperliquidWhales.upsertHyperliquidWhaleWalletCoverage)({
|
|
5525
3900
|
address,
|
|
5526
3901
|
fromMs,
|
|
5527
3902
|
toMs,
|
|
@@ -5539,7 +3914,7 @@ var backfillHyperliquidWhaleContext = async (params) => {
|
|
|
5539
3914
|
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
5540
3915
|
failures.push(normalizedError);
|
|
5541
3916
|
failedWallets += 1;
|
|
5542
|
-
await (0,
|
|
3917
|
+
await (0, import_hyperliquidWhales.upsertHyperliquidWhaleWalletCoverage)({
|
|
5543
3918
|
address,
|
|
5544
3919
|
fromMs,
|
|
5545
3920
|
toMs,
|
|
@@ -5558,7 +3933,7 @@ var backfillHyperliquidWhaleContext = async (params) => {
|
|
|
5558
3933
|
);
|
|
5559
3934
|
}
|
|
5560
3935
|
});
|
|
5561
|
-
const buckets = await (0,
|
|
3936
|
+
const buckets = await (0, import_hyperliquidWhales.rebuildHyperliquidWhaleFlowRows)({
|
|
5562
3937
|
fromMs,
|
|
5563
3938
|
toMs,
|
|
5564
3939
|
...identity
|
|
@@ -5574,7 +3949,7 @@ var backfillHyperliquidWhaleContext = async (params) => {
|
|
|
5574
3949
|
}
|
|
5575
3950
|
);
|
|
5576
3951
|
let displayedCoverageBuckets = 0;
|
|
5577
|
-
const coverageBuckets = await (0,
|
|
3952
|
+
const coverageBuckets = await (0, import_hyperliquidWhales.rebuildHyperliquidWhaleCoverageRows)({
|
|
5578
3953
|
fromMs,
|
|
5579
3954
|
toMs,
|
|
5580
3955
|
expectedWhales: whales.addresses.length,
|
|
@@ -5780,7 +4155,7 @@ var prepareMarketContextForRun = async (params) => {
|
|
|
5780
4155
|
if (readableSources.length) {
|
|
5781
4156
|
await timeOperation2(
|
|
5782
4157
|
"market context schema ensure",
|
|
5783
|
-
() => (0,
|
|
4158
|
+
() => (0, import_marketContext3.ensureMarketContextSchemas)(readableSources)
|
|
5784
4159
|
);
|
|
5785
4160
|
}
|
|
5786
4161
|
if (requirements.derivatives.backfill) {
|
|
@@ -6037,7 +4412,7 @@ var buildReplayTargets = async ({
|
|
|
6037
4412
|
includeConnectorUniverse
|
|
6038
4413
|
}) => {
|
|
6039
4414
|
const targets = /* @__PURE__ */ new Map();
|
|
6040
|
-
let configuredStrategies = (await loadRuntimeStrategyNames(userName)).filter(
|
|
4415
|
+
let configuredStrategies = (await (0, import_runtimeStrategyConfigs.loadRuntimeStrategyNames)(userName)).filter(
|
|
6041
4416
|
(strategy) => !strategyFilter || strategy === strategyFilter
|
|
6042
4417
|
);
|
|
6043
4418
|
if (strategyFilter && !configuredStrategies.some((strategy) => strategy === strategyFilter)) {
|
|
@@ -6931,7 +5306,7 @@ var getBacktestOnlyRecommendedChecks = (classification) => {
|
|
|
6931
5306
|
}
|
|
6932
5307
|
};
|
|
6933
5308
|
var buildRuntimeParityMismatchAttachment = ({
|
|
6934
|
-
window
|
|
5309
|
+
window,
|
|
6935
5310
|
connectorName,
|
|
6936
5311
|
replayEnv,
|
|
6937
5312
|
toleranceBars,
|
|
@@ -7042,9 +5417,9 @@ var buildRuntimeParityMismatchAttachment = ({
|
|
|
7042
5417
|
generatedAt: Date.now(),
|
|
7043
5418
|
codexQuestion: "For each mismatch case, explain why runtime and replay/backtest diverged. Use why.classification first, then confirm with decisionTrace, timing, and artifacts.",
|
|
7044
5419
|
window: {
|
|
7045
|
-
start:
|
|
7046
|
-
end:
|
|
7047
|
-
source:
|
|
5420
|
+
start: window.start,
|
|
5421
|
+
end: window.end,
|
|
5422
|
+
source: window.source
|
|
7048
5423
|
},
|
|
7049
5424
|
connectorName,
|
|
7050
5425
|
replayEnv,
|
|
@@ -7110,7 +5485,7 @@ var buildRuntimeParityMismatchAttachment = ({
|
|
|
7110
5485
|
}
|
|
7111
5486
|
};
|
|
7112
5487
|
return {
|
|
7113
|
-
filename: `runtime-parity-mismatches-${connectorName}-${
|
|
5488
|
+
filename: `runtime-parity-mismatches-${connectorName}-${window.start}-${window.end}.json`,
|
|
7114
5489
|
content: JSON.stringify(payload, null, 2),
|
|
7115
5490
|
caption: "Runtime parity mismatch JSON"
|
|
7116
5491
|
};
|
|
@@ -7223,7 +5598,7 @@ var summarizeByStrategy = ({
|
|
|
7223
5598
|
);
|
|
7224
5599
|
};
|
|
7225
5600
|
var buildRuntimeParityMessage = ({
|
|
7226
|
-
window
|
|
5601
|
+
window,
|
|
7227
5602
|
connectorName,
|
|
7228
5603
|
replayEnv,
|
|
7229
5604
|
runtimeGatesEnabled,
|
|
@@ -7252,7 +5627,7 @@ var buildRuntimeParityMessage = ({
|
|
|
7252
5627
|
lines.push("");
|
|
7253
5628
|
lines.push("\u{1F552} <b>Window</b>");
|
|
7254
5629
|
lines.push(
|
|
7255
|
-
`<b>${escapeHtml(formatMskDateTime(
|
|
5630
|
+
`<b>${escapeHtml(formatMskDateTime(window.start))} - ${escapeHtml(formatMskDateTime(window.end))} ${SUMMARY_TIMEZONE_LABEL}</b>`
|
|
7256
5631
|
);
|
|
7257
5632
|
lines.push("");
|
|
7258
5633
|
lines.push(`\u{1F50C} Connector: <b>${escapeHtml(connectorName)}</b>`);
|
|
@@ -7358,7 +5733,7 @@ var buildRuntimeParityMessage = ({
|
|
|
7358
5733
|
return lines.join("\n");
|
|
7359
5734
|
};
|
|
7360
5735
|
var buildRuntimeParityNoTargetsMessage = ({
|
|
7361
|
-
window
|
|
5736
|
+
window,
|
|
7362
5737
|
connectorName,
|
|
7363
5738
|
replayEnv,
|
|
7364
5739
|
runtimeGatesEnabled,
|
|
@@ -7367,7 +5742,7 @@ var buildRuntimeParityNoTargetsMessage = ({
|
|
|
7367
5742
|
"\u{1F9EA} <b>TradeJS runtime parity</b>",
|
|
7368
5743
|
"",
|
|
7369
5744
|
"\u{1F552} <b>Window</b>",
|
|
7370
|
-
`<b>${escapeHtml(formatMskDateTime(
|
|
5745
|
+
`<b>${escapeHtml(formatMskDateTime(window.start))} - ${escapeHtml(formatMskDateTime(window.end))} ${SUMMARY_TIMEZONE_LABEL}</b>`,
|
|
7371
5746
|
"",
|
|
7372
5747
|
`\u{1F50C} Connector: <b>${escapeHtml(connectorName)}</b>`,
|
|
7373
5748
|
`\u{1F9EC} Replay env: <b>${escapeHtml(replayEnv)}</b>`,
|
|
@@ -7375,7 +5750,7 @@ var buildRuntimeParityNoTargetsMessage = ({
|
|
|
7375
5750
|
`\u26A0\uFE0F No replay targets found for user <b>${escapeHtml(userName)}</b>.`
|
|
7376
5751
|
].join("\n");
|
|
7377
5752
|
var runtimeParity = async () => {
|
|
7378
|
-
const
|
|
5753
|
+
const window = resolveTimeWindow({
|
|
7379
5754
|
days: flags.days ?? DEFAULT_LOOKBACK_DAYS,
|
|
7380
5755
|
startTime: flags.startTime,
|
|
7381
5756
|
endTime: flags.endTime,
|
|
@@ -7398,26 +5773,26 @@ var runtimeParity = async () => {
|
|
|
7398
5773
|
});
|
|
7399
5774
|
const [allRuntimeTrades, allRuntimeSignals, allRuntimeSignalEvaluations] = await Promise.all([
|
|
7400
5775
|
loadRuntimeTrades(flags.user, {
|
|
7401
|
-
startTime:
|
|
7402
|
-
endTime:
|
|
5776
|
+
startTime: window.start,
|
|
5777
|
+
endTime: window.end
|
|
7403
5778
|
}),
|
|
7404
5779
|
loadRuntimeSignals(flags.user, {
|
|
7405
|
-
startTime:
|
|
7406
|
-
endTime:
|
|
5780
|
+
startTime: window.start,
|
|
5781
|
+
endTime: window.end
|
|
7407
5782
|
}),
|
|
7408
5783
|
loadRuntimeSignalEvaluations(flags.user, {
|
|
7409
|
-
startTime:
|
|
7410
|
-
endTime:
|
|
5784
|
+
startTime: window.start,
|
|
5785
|
+
endTime: window.end
|
|
7411
5786
|
})
|
|
7412
5787
|
]);
|
|
7413
5788
|
const runtimeTrades = allRuntimeTrades.filter(
|
|
7414
|
-
(trade) => trade.entryTimestamp >=
|
|
5789
|
+
(trade) => trade.entryTimestamp >= window.start && trade.entryTimestamp <= window.end && (!flags.strategy || trade.strategy === flags.strategy) && (!requestedSymbolSet || requestedSymbolSet.has(trade.symbol))
|
|
7415
5790
|
);
|
|
7416
5791
|
const runtimeSignals = allRuntimeSignals.filter(
|
|
7417
|
-
(signal) => signal.timestamp >=
|
|
5792
|
+
(signal) => signal.timestamp >= window.start && signal.timestamp <= window.end && (!flags.strategy || signal.strategy === flags.strategy) && (!requestedSymbolSet || requestedSymbolSet.has(signal.symbol))
|
|
7418
5793
|
);
|
|
7419
5794
|
const runtimeSignalEvaluations = allRuntimeSignalEvaluations.filter(
|
|
7420
|
-
(evaluation) => evaluation.timestamp >=
|
|
5795
|
+
(evaluation) => evaluation.timestamp >= window.start && evaluation.timestamp <= window.end && (!flags.strategy || evaluation.strategy === flags.strategy) && (!requestedSymbolSet || requestedSymbolSet.has(evaluation.symbol))
|
|
7421
5796
|
);
|
|
7422
5797
|
const connectorSymbols = requestedSymbols.length ? requestedSymbols : await (0, import_cli3.getTickers)(parityConnector);
|
|
7423
5798
|
const replayInputsIndex = buildReplayInputsIndex({
|
|
@@ -7435,13 +5810,13 @@ var runtimeParity = async () => {
|
|
|
7435
5810
|
if (!replayTargets.length) {
|
|
7436
5811
|
console.log(
|
|
7437
5812
|
import_chalk6.default.yellow(
|
|
7438
|
-
`No replay targets found for ${flags.user} in ${(0, import_time3.formatUnix)(
|
|
5813
|
+
`No replay targets found for ${flags.user} in ${(0, import_time3.formatUnix)(window.start)} -> ${(0, import_time3.formatUnix)(window.end)}.`
|
|
7439
5814
|
)
|
|
7440
5815
|
);
|
|
7441
5816
|
if (flags.notify) {
|
|
7442
5817
|
await sendTelegramReport(
|
|
7443
5818
|
buildRuntimeParityNoTargetsMessage({
|
|
7444
|
-
window
|
|
5819
|
+
window,
|
|
7445
5820
|
connectorName,
|
|
7446
5821
|
replayEnv: DEFAULT_REPLAY_ENV,
|
|
7447
5822
|
runtimeGatesEnabled: Boolean(flags.runtimeGates),
|
|
@@ -7454,7 +5829,7 @@ var runtimeParity = async () => {
|
|
|
7454
5829
|
}
|
|
7455
5830
|
const sourceCounts = countReplayTargetSources(replayTargets);
|
|
7456
5831
|
const preloadStart = (0, import_time3.getBacktestPreloadStart)(
|
|
7457
|
-
|
|
5832
|
+
window.start,
|
|
7458
5833
|
import_constants3.BACKTEST_PRELOAD_DAYS
|
|
7459
5834
|
);
|
|
7460
5835
|
const replayStartedAt = Date.now();
|
|
@@ -7490,8 +5865,8 @@ var runtimeParity = async () => {
|
|
|
7490
5865
|
projectRoot,
|
|
7491
5866
|
symbols: replayTargets.map((target) => target.symbol),
|
|
7492
5867
|
interval,
|
|
7493
|
-
startMs:
|
|
7494
|
-
endMs:
|
|
5868
|
+
startMs: window.start,
|
|
5869
|
+
endMs: window.end,
|
|
7495
5870
|
preloadStartMs: preloadStart,
|
|
7496
5871
|
cacheOnly: Boolean(flags.cacheOnly),
|
|
7497
5872
|
aiEnabled: hasParityAiTargets,
|
|
@@ -7505,7 +5880,7 @@ var runtimeParity = async () => {
|
|
|
7505
5880
|
connectorName,
|
|
7506
5881
|
targets: replayTargets,
|
|
7507
5882
|
preloadStart,
|
|
7508
|
-
preloadEnd:
|
|
5883
|
+
preloadEnd: window.end
|
|
7509
5884
|
});
|
|
7510
5885
|
}
|
|
7511
5886
|
const backtestEntries = [];
|
|
@@ -7531,8 +5906,8 @@ var runtimeParity = async () => {
|
|
|
7531
5906
|
userName: flags.user,
|
|
7532
5907
|
symbol: target.symbol,
|
|
7533
5908
|
options: {
|
|
7534
|
-
start:
|
|
7535
|
-
end:
|
|
5909
|
+
start: window.start,
|
|
5910
|
+
end: window.end
|
|
7536
5911
|
},
|
|
7537
5912
|
name: `${target.symbol}_${target.strategy}_${(0, import_node_crypto.randomUUID)().slice(0, 8)}`,
|
|
7538
5913
|
testId: (0, import_node_crypto.randomUUID)().slice(0, 8),
|
|
@@ -7599,7 +5974,7 @@ var runtimeParity = async () => {
|
|
|
7599
5974
|
const summary = summarizeMatchedParity(comparison.matched);
|
|
7600
5975
|
console.log(import_chalk6.default.cyan("TradeJS runtime parity"));
|
|
7601
5976
|
console.log(
|
|
7602
|
-
`Window: ${(0, import_time3.formatUnix)(
|
|
5977
|
+
`Window: ${(0, import_time3.formatUnix)(window.start)} -> ${(0, import_time3.formatUnix)(window.end)} (${window.source})`
|
|
7603
5978
|
);
|
|
7604
5979
|
console.log(`Connector: ${connectorName}`);
|
|
7605
5980
|
console.log(
|
|
@@ -7705,7 +6080,7 @@ var runtimeParity = async () => {
|
|
|
7705
6080
|
}
|
|
7706
6081
|
if (flags.notify) {
|
|
7707
6082
|
const mismatchAttachment = buildRuntimeParityMismatchAttachment({
|
|
7708
|
-
window
|
|
6083
|
+
window,
|
|
7709
6084
|
connectorName,
|
|
7710
6085
|
replayEnv: replayEnvSummary,
|
|
7711
6086
|
toleranceBars,
|
|
@@ -7729,7 +6104,7 @@ var runtimeParity = async () => {
|
|
|
7729
6104
|
});
|
|
7730
6105
|
await sendTelegramReport(
|
|
7731
6106
|
buildRuntimeParityMessage({
|
|
7732
|
-
window
|
|
6107
|
+
window,
|
|
7733
6108
|
connectorName,
|
|
7734
6109
|
replayEnv: replayEnvSummary,
|
|
7735
6110
|
runtimeGatesEnabled: Boolean(flags.runtimeGates) || replayEnvSummary.includes("PARITY"),
|