@tradejs/cli 1.0.9 → 1.0.10
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 +29497 -13537
- package/dist/lib/aiPocketSearch.js +1316 -0
- package/dist/lib/aiTrainCharts.js +711 -0
- package/dist/lib/aiTrainDataset.js +40 -0
- package/dist/lib/aiTrainEvaluationDump.js +76 -0
- package/dist/lib/aiTrainMetrics.js +148 -8
- package/dist/lib/aiTrainOptions.js +130 -0
- package/dist/lib/aiTrainQuarantine.js +199 -0
- package/dist/lib/aiTrainResearch.js +467 -0
- package/dist/lib/binanceMarketContextBackfill.js +841 -0
- package/dist/lib/binanceMarketData.js +392 -0
- package/dist/lib/coinMarketCapContextBackfill.js +1088 -0
- package/dist/lib/continuity.js +60 -0
- package/dist/lib/derivativesContextBackfill.js +490 -77
- package/dist/lib/executionCalibration.js +705 -0
- package/dist/lib/marketContextPrepare.js +4403 -0
- package/dist/lib/paritySummary.js +101 -0
- package/dist/lib/runBot.js +1 -0
- package/dist/lib/runEnvironment.js +2254 -0
- package/dist/lib/runFormatting.js +1657 -0
- package/dist/lib/runtimeDebugEvidence.js +526 -0
- package/dist/lib/runtimeModeConfig.js +53 -0
- package/dist/lib/runtimeParity.js +88 -11
- package/dist/lib/runtimeParityDetails.js +751 -0
- package/dist/lib/runtimeRedis.js +157 -0
- package/dist/lib/runtimeSignalsLoader.js +40 -6
- package/dist/lib/runtimeSignalsStorage.js +45 -22
- package/dist/lib/runtimeStrategyBacktest.js +134 -0
- package/dist/lib/runtimeTradeSync.js +263 -0
- package/dist/lib/telegramReports.js +9 -0
- package/dist/lib/tickerUniverseCache.js +116 -0
- package/dist/lib/timeWindow.js +3 -3
- package/dist/scripts/agentRun.js +14 -8
- package/dist/scripts/aiExport.js +1721 -7
- package/dist/scripts/aiExportSelect.js +16 -4
- package/dist/scripts/aiPocketSearch.js +4190 -0
- package/dist/scripts/aiTrain.js +1866 -87
- package/dist/scripts/backtest.js +4509 -818
- package/dist/scripts/binanceMarketIngest.js +565 -0
- package/dist/scripts/bot.js +16 -2
- package/dist/scripts/candlesMigrateProvider.js +32 -22
- package/dist/scripts/cleanDir.js +15 -2
- package/dist/scripts/cleanRedis.js +15 -2
- package/dist/scripts/cleanTests.js +38 -2
- package/dist/scripts/cleanupMarketContext.js +69 -0
- package/dist/scripts/continuity.js +148 -67
- package/dist/scripts/derivativesIngest.js +14 -4
- package/dist/scripts/derivativesIngestCoinalyzeAll.js +14 -4
- package/dist/scripts/doctor.js +14 -4
- package/dist/scripts/executionCalibration.js +792 -0
- package/dist/scripts/infraCommon.js +10 -0
- package/dist/scripts/infraDown.js +14 -4
- package/dist/scripts/infraInit.js +24 -4
- package/dist/scripts/infraUp.js +14 -4
- package/dist/scripts/marketWs.js +222 -0
- package/dist/scripts/migration.js +15 -2
- package/dist/scripts/mlExport.js +1698 -10
- package/dist/scripts/mlExportSelect.js +16 -4
- package/dist/scripts/mlInspect.js +13 -3
- package/dist/scripts/mlTrainLatestSelect.js +14 -4
- package/dist/scripts/replay.js +8824 -0
- package/dist/scripts/replayRunner.js +8827 -0
- package/dist/scripts/replayRuntimeEvidence.js +868 -0
- package/dist/scripts/researchAuto.js +286 -59
- package/dist/scripts/results.js +3 -3
- package/dist/scripts/runtimeEvidence.js +605 -0
- package/dist/scripts/runtimeParity.js +6362 -1043
- package/dist/scripts/serverHealth.js +588 -0
- package/dist/scripts/signals.js +5590 -511
- package/dist/scripts/signalsDaemon.js +6167 -0
- package/dist/scripts/signalsSummary.js +833 -248
- package/dist/scripts/test-ml.js +25 -3
- package/dist/scripts/test.js +26 -1
- package/dist/scripts/user-add.js +15 -2
- package/dist/workers/testerWorker.js +130 -21
- package/package.json +18 -12
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/paritySummary.ts
|
|
21
|
+
var paritySummary_exports = {};
|
|
22
|
+
__export(paritySummary_exports, {
|
|
23
|
+
summarizeRuntimeTradesByStrategy: () => summarizeRuntimeTradesByStrategy,
|
|
24
|
+
summarizeTradeParityByStrategy: () => summarizeTradeParityByStrategy
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(paritySummary_exports);
|
|
27
|
+
var summarizeRuntimeTradesByStrategy = (trades) => {
|
|
28
|
+
const summaryByStrategy = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const trade of trades) {
|
|
30
|
+
const summary = summaryByStrategy.get(trade.strategy) ?? {
|
|
31
|
+
strategyName: trade.strategy,
|
|
32
|
+
trades: 0,
|
|
33
|
+
activeTrades: 0,
|
|
34
|
+
closedTrades: 0,
|
|
35
|
+
totalPnl: 0
|
|
36
|
+
};
|
|
37
|
+
summary.trades += 1;
|
|
38
|
+
if (trade.status === "active") {
|
|
39
|
+
summary.activeTrades += 1;
|
|
40
|
+
} else {
|
|
41
|
+
summary.closedTrades += 1;
|
|
42
|
+
}
|
|
43
|
+
const pnl = trade.status === "active" ? trade.currentPnl : trade.closedPnl ?? trade.currentPnl;
|
|
44
|
+
if (typeof pnl === "number" && Number.isFinite(pnl)) {
|
|
45
|
+
summary.totalPnl += pnl;
|
|
46
|
+
}
|
|
47
|
+
summaryByStrategy.set(trade.strategy, summary);
|
|
48
|
+
}
|
|
49
|
+
return [...summaryByStrategy.values()].map((summary) => ({
|
|
50
|
+
...summary,
|
|
51
|
+
totalPnl: Number(summary.totalPnl.toFixed(2))
|
|
52
|
+
})).sort((left, right) => left.strategyName.localeCompare(right.strategyName));
|
|
53
|
+
};
|
|
54
|
+
var summarizeTradeParityByStrategy = ({
|
|
55
|
+
runtimeEntries,
|
|
56
|
+
runtimeDuplicateEntries,
|
|
57
|
+
backtestEntries,
|
|
58
|
+
matchedEntries,
|
|
59
|
+
runtimeOnlyEntries,
|
|
60
|
+
backtestOnlyEntries
|
|
61
|
+
}) => {
|
|
62
|
+
const rows = /* @__PURE__ */ new Map();
|
|
63
|
+
const ensureRow = (strategyName) => {
|
|
64
|
+
const row = rows.get(strategyName) ?? {
|
|
65
|
+
runtime: 0,
|
|
66
|
+
runtimeDuplicates: 0,
|
|
67
|
+
backtest: 0,
|
|
68
|
+
matched: 0,
|
|
69
|
+
runtimeOnly: 0,
|
|
70
|
+
backtestOnly: 0
|
|
71
|
+
};
|
|
72
|
+
rows.set(strategyName, row);
|
|
73
|
+
return row;
|
|
74
|
+
};
|
|
75
|
+
for (const entry of runtimeEntries) {
|
|
76
|
+
ensureRow(entry.strategy).runtime += 1;
|
|
77
|
+
}
|
|
78
|
+
for (const entry of runtimeDuplicateEntries) {
|
|
79
|
+
ensureRow(entry.strategy).runtimeDuplicates += 1;
|
|
80
|
+
}
|
|
81
|
+
for (const entry of backtestEntries) {
|
|
82
|
+
ensureRow(entry.strategy).backtest += 1;
|
|
83
|
+
}
|
|
84
|
+
for (const entry of matchedEntries) {
|
|
85
|
+
ensureRow(entry.runtime.strategy).matched += 1;
|
|
86
|
+
}
|
|
87
|
+
for (const entry of runtimeOnlyEntries) {
|
|
88
|
+
ensureRow(entry.strategy).runtimeOnly += 1;
|
|
89
|
+
}
|
|
90
|
+
for (const entry of backtestOnlyEntries) {
|
|
91
|
+
ensureRow(entry.strategy).backtestOnly += 1;
|
|
92
|
+
}
|
|
93
|
+
return [...rows.entries()].sort(
|
|
94
|
+
([left], [right]) => left.localeCompare(right)
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
summarizeRuntimeTradesByStrategy,
|
|
100
|
+
summarizeTradeParityByStrategy
|
|
101
|
+
});
|