@tradejs/node 3.1.8-beta.207 → 3.1.8-beta.210
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/ai.mjs +3 -3
- package/dist/backtest.js +8 -6
- package/dist/backtest.mjs +7 -7
- package/dist/{chunk-SEQJ6V6B.mjs → chunk-733VVTWU.mjs} +1 -1
- package/dist/chunk-F7ODY5W4.mjs +322 -0
- package/dist/{chunk-WS5DYEVZ.mjs → chunk-LZDXRXIU.mjs} +3 -1
- package/dist/{chunk-XN7BC7XK.mjs → chunk-MEZIXBZ3.mjs} +1 -1
- package/dist/{chunk-3TWULKHV.mjs → chunk-QVKUROR2.mjs} +1 -1
- package/dist/{chunk-MCDICN3I.mjs → chunk-SVAUSZUE.mjs} +8 -8
- package/dist/cli.d.mts +2 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +3 -1
- package/dist/cli.mjs +3 -3
- package/dist/connectors.js +3 -1
- package/dist/connectors.mjs +2 -2
- package/dist/registry.js +8 -6
- package/dist/registry.mjs +4 -4
- package/dist/runtimeDashboard.js +548 -275
- package/dist/runtimeDashboard.mjs +46 -267
- package/dist/runtimeStrategies.d.mts +16 -5
- package/dist/runtimeStrategies.d.ts +16 -5
- package/dist/runtimeStrategies.js +204 -103
- package/dist/runtimeStrategies.mjs +12 -219
- package/dist/strategies.js +8 -6
- package/dist/strategies.mjs +4 -4
- package/package.json +4 -4
package/dist/ai.mjs
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
runAiPrompt,
|
|
15
15
|
runAiPromptLocal,
|
|
16
16
|
trimSeriesDeep
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-733VVTWU.mjs";
|
|
18
|
+
import "./chunk-MEZIXBZ3.mjs";
|
|
19
|
+
import "./chunk-LZDXRXIU.mjs";
|
|
20
20
|
import "./chunk-Y6FXYEAI.mjs";
|
|
21
21
|
export {
|
|
22
22
|
DEFAULT_AI_MODEL,
|
package/dist/backtest.js
CHANGED
|
@@ -680,11 +680,13 @@ var normalizeConfig = (rawConfig) => {
|
|
|
680
680
|
const hooks = (0, import_config.normalizeTradejsConfigHooks)(
|
|
681
681
|
config.hooks
|
|
682
682
|
);
|
|
683
|
+
const runtime = config.runtime && typeof config.runtime === "object" && !Array.isArray(config.runtime) ? config.runtime : void 0;
|
|
683
684
|
return {
|
|
684
685
|
strategies: strategies2,
|
|
685
686
|
indicators,
|
|
686
687
|
connectors,
|
|
687
|
-
...hooks ? { hooks } : {}
|
|
688
|
+
...hooks ? { hooks } : {},
|
|
689
|
+
...runtime ? { runtime } : {}
|
|
688
690
|
};
|
|
689
691
|
};
|
|
690
692
|
var getNodeCreateRequire = () => {
|
|
@@ -4426,7 +4428,7 @@ var executeEntryOrder = async ({
|
|
|
4426
4428
|
deploymentId: signal.deploymentId,
|
|
4427
4429
|
policyProfileId: signal.policyProfileId,
|
|
4428
4430
|
runtimeConfigId: signal.runtimeConfigId,
|
|
4429
|
-
|
|
4431
|
+
runtimeVersion: signal.runtimeVersion,
|
|
4430
4432
|
runtimeLineage: signal.runtimeLineage,
|
|
4431
4433
|
...signal.aiAnalysis ? { aiAnalysis: signal.aiAnalysis } : {}
|
|
4432
4434
|
});
|
|
@@ -5337,7 +5339,7 @@ var createStrategyRuntime = ({
|
|
|
5337
5339
|
deploymentId: requestedDeploymentId,
|
|
5338
5340
|
policyProfileId,
|
|
5339
5341
|
runtimeConfigId,
|
|
5340
|
-
|
|
5342
|
+
runtimeVersion,
|
|
5341
5343
|
entriesPaused = false,
|
|
5342
5344
|
runtimeLineage,
|
|
5343
5345
|
runtimeConfigSnapshot,
|
|
@@ -6009,8 +6011,8 @@ var createStrategyRuntime = ({
|
|
|
6009
6011
|
signal.signalId = `${signal.signalId}:${runtimeConfigId}`;
|
|
6010
6012
|
}
|
|
6011
6013
|
}
|
|
6012
|
-
if (
|
|
6013
|
-
signal.
|
|
6014
|
+
if (runtimeVersion) {
|
|
6015
|
+
signal.runtimeVersion = runtimeVersion;
|
|
6014
6016
|
}
|
|
6015
6017
|
if (decisionHookCtx.policyProfileId) {
|
|
6016
6018
|
signal.policyProfileId = decisionHookCtx.policyProfileId;
|
|
@@ -6123,7 +6125,7 @@ var createStrategyRuntime = ({
|
|
|
6123
6125
|
if (signal) {
|
|
6124
6126
|
signal.orderStatus = "skipped";
|
|
6125
6127
|
signal.orderSkipReason = skipReason;
|
|
6126
|
-
signal.
|
|
6128
|
+
signal.runtimeVersion = runtimeVersion;
|
|
6127
6129
|
}
|
|
6128
6130
|
return signal ?? skipReason;
|
|
6129
6131
|
}
|
package/dist/backtest.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildMlPayload,
|
|
3
3
|
enrichSignalWithMarketContextStages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SVAUSZUE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
buildAiPayload
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
getStrategyCreator
|
|
10
|
-
} from "./chunk-XN7BC7XK.mjs";
|
|
7
|
+
} from "./chunk-733VVTWU.mjs";
|
|
11
8
|
import {
|
|
12
9
|
BUILTIN_CONNECTOR_NAMES,
|
|
13
10
|
getConnectorCreatorByName
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QVKUROR2.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getStrategyCreator
|
|
14
|
+
} from "./chunk-MEZIXBZ3.mjs";
|
|
15
15
|
import {
|
|
16
16
|
getTradejsProjectCwd
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LZDXRXIU.mjs";
|
|
18
18
|
import "./chunk-Y6FXYEAI.mjs";
|
|
19
19
|
|
|
20
20
|
// src/backtest.ts
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getStrategyCreator,
|
|
3
|
+
getStrategyPluginSource
|
|
4
|
+
} from "./chunk-MEZIXBZ3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
loadTradejsConfig
|
|
7
|
+
} from "./chunk-LZDXRXIU.mjs";
|
|
8
|
+
|
|
9
|
+
// src/runtimeStrategies.ts
|
|
10
|
+
import { readFile } from "fs/promises";
|
|
11
|
+
import path from "path";
|
|
12
|
+
import { getRuntimeControls } from "@tradejs/infra/runtimeControls";
|
|
13
|
+
import { resolveTradingAccount } from "@tradejs/infra/tradingAccounts";
|
|
14
|
+
var INTERVALS = /* @__PURE__ */ new Set([
|
|
15
|
+
"1",
|
|
16
|
+
"3",
|
|
17
|
+
"5",
|
|
18
|
+
"15",
|
|
19
|
+
"30",
|
|
20
|
+
"60",
|
|
21
|
+
"120",
|
|
22
|
+
"240",
|
|
23
|
+
"360",
|
|
24
|
+
"720",
|
|
25
|
+
"D",
|
|
26
|
+
"W",
|
|
27
|
+
"M"
|
|
28
|
+
]);
|
|
29
|
+
var RUNTIME_KEYS = /* @__PURE__ */ new Set(["deployments"]);
|
|
30
|
+
var DEPLOYMENT_KEYS = /* @__PURE__ */ new Set([
|
|
31
|
+
"label",
|
|
32
|
+
"connectorName",
|
|
33
|
+
"provider",
|
|
34
|
+
"accountId",
|
|
35
|
+
"enabled",
|
|
36
|
+
"strategies",
|
|
37
|
+
"assetClasses",
|
|
38
|
+
"tickers"
|
|
39
|
+
]);
|
|
40
|
+
var STRATEGY_KEYS = /* @__PURE__ */ new Set(["version", "enabled", "config"]);
|
|
41
|
+
var FORBIDDEN_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
42
|
+
"ACCOUNT_ID",
|
|
43
|
+
"DEPLOYMENT_ID",
|
|
44
|
+
"CONNECTOR_NAME",
|
|
45
|
+
"ENABLE"
|
|
46
|
+
]);
|
|
47
|
+
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
48
|
+
var readPackageManifest = async (projectRoot) => {
|
|
49
|
+
const candidates = [
|
|
50
|
+
process.env.TRADEJS_RUNTIME_PACKAGE_MANIFEST,
|
|
51
|
+
path.join(projectRoot, "runtime-package-manifest.json"),
|
|
52
|
+
"/app/runtime-package-manifest.json"
|
|
53
|
+
].filter((candidate) => Boolean(candidate));
|
|
54
|
+
for (const candidate of candidates) {
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(
|
|
57
|
+
await readFile(candidate, "utf8")
|
|
58
|
+
);
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { packages: {} };
|
|
63
|
+
};
|
|
64
|
+
var resolveInstalledPackageVersion = async (projectRoot, packageName, manifest) => {
|
|
65
|
+
if (!packageName || packageName === "runtime") return null;
|
|
66
|
+
const manifestVersion = manifest.packages?.[packageName];
|
|
67
|
+
if (manifestVersion) return manifestVersion;
|
|
68
|
+
try {
|
|
69
|
+
const packageJsonPath = path.join(
|
|
70
|
+
projectRoot,
|
|
71
|
+
"node_modules",
|
|
72
|
+
...packageName.split("/"),
|
|
73
|
+
"package.json"
|
|
74
|
+
);
|
|
75
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
76
|
+
return packageJson.version ?? null;
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var resolveStrategyPackageName = async ({
|
|
82
|
+
pluginSource,
|
|
83
|
+
projectRoot
|
|
84
|
+
}) => {
|
|
85
|
+
if (!pluginSource) return null;
|
|
86
|
+
if (!pluginSource.startsWith(".") && !path.isAbsolute(pluginSource)) {
|
|
87
|
+
return pluginSource;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const packageJson = JSON.parse(
|
|
91
|
+
await readFile(path.join(projectRoot, "package.json"), "utf8")
|
|
92
|
+
);
|
|
93
|
+
return typeof packageJson.name === "string" && packageJson.name.trim() ? packageJson.name : null;
|
|
94
|
+
} catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var verifyStringArray = (value) => value === void 0 || Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
99
|
+
var verifyDeploymentDeclaration = (deploymentId, value) => {
|
|
100
|
+
if (!deploymentId.trim() || !isRecord(value) || Object.keys(value).some((key) => !DEPLOYMENT_KEYS.has(key)) || typeof value.connectorName !== "string" || !value.connectorName.trim() || typeof value.accountId !== "string" || !value.accountId.trim() || value.label !== void 0 && typeof value.label !== "string" || value.provider !== void 0 && typeof value.provider !== "string" || value.enabled !== void 0 && typeof value.enabled !== "boolean" || !verifyStringArray(value.assetClasses) || !verifyStringArray(value.tickers) || !isRecord(value.strategies) || !Object.keys(value.strategies).length) {
|
|
101
|
+
throw new Error(`Invalid runtime deployment declaration: ${deploymentId}`);
|
|
102
|
+
}
|
|
103
|
+
for (const [strategyName, strategyValue] of Object.entries(
|
|
104
|
+
value.strategies
|
|
105
|
+
)) {
|
|
106
|
+
if (!strategyName.trim() || !isRecord(strategyValue) || Object.keys(strategyValue).some((key) => !STRATEGY_KEYS.has(key)) || !Number.isSafeInteger(strategyValue.version) || Number(strategyValue.version) <= 0 || typeof strategyValue.enabled !== "boolean" || !isRecord(strategyValue.config) || Object.keys(strategyValue.config).some(
|
|
107
|
+
(key) => FORBIDDEN_CONFIG_KEYS.has(key)
|
|
108
|
+
) || !INTERVALS.has(String(strategyValue.config.INTERVAL)) || !["crypto", "tradfi"].includes(String(strategyValue.config.UNIVERSE))) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Invalid runtime strategy declaration: ${deploymentId}/${strategyName}`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return value;
|
|
115
|
+
};
|
|
116
|
+
var verifyRuntimeDeclaration = (value) => {
|
|
117
|
+
if (!isRecord(value) || Object.keys(value).some((key) => !RUNTIME_KEYS.has(key)) || !isRecord(value.deployments) || !Object.keys(value.deployments).length) {
|
|
118
|
+
throw new Error("Invalid runtime declaration");
|
|
119
|
+
}
|
|
120
|
+
for (const [deploymentId, deployment] of Object.entries(value.deployments)) {
|
|
121
|
+
verifyDeploymentDeclaration(deploymentId, deployment);
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
124
|
+
};
|
|
125
|
+
var toRuntimeDeployment = ({
|
|
126
|
+
id,
|
|
127
|
+
declaration,
|
|
128
|
+
controls
|
|
129
|
+
}) => {
|
|
130
|
+
const deploymentEnabled = declaration.enabled ?? true;
|
|
131
|
+
return {
|
|
132
|
+
id,
|
|
133
|
+
label: declaration.label?.trim() || id,
|
|
134
|
+
connectorName: declaration.connectorName.trim(),
|
|
135
|
+
provider: (declaration.provider || declaration.connectorName).trim().toLowerCase(),
|
|
136
|
+
accountId: declaration.accountId.trim(),
|
|
137
|
+
enabled: deploymentEnabled,
|
|
138
|
+
strategies: Object.entries(declaration.strategies).map(
|
|
139
|
+
([strategyName, strategy]) => ({
|
|
140
|
+
strategyName,
|
|
141
|
+
version: strategy.version,
|
|
142
|
+
enabled: strategy.enabled,
|
|
143
|
+
controlState: deploymentEnabled && strategy.enabled && !controls.deployments[id]?.[strategyName]?.entriesPaused ? "active" : "entries_paused"
|
|
144
|
+
})
|
|
145
|
+
),
|
|
146
|
+
...declaration.assetClasses ? { assetClasses: declaration.assetClasses } : {},
|
|
147
|
+
...declaration.tickers ? { tickers: declaration.tickers } : {}
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
var loadRuntimeDeclaration = async (projectRoot) => {
|
|
151
|
+
const projectConfig = await loadTradejsConfig(projectRoot);
|
|
152
|
+
if (!projectConfig.runtime) {
|
|
153
|
+
throw new Error("Runtime declaration is required in tradejs.config.ts");
|
|
154
|
+
}
|
|
155
|
+
return verifyRuntimeDeclaration(projectConfig.runtime);
|
|
156
|
+
};
|
|
157
|
+
var listRuntimeDeployments = async ({
|
|
158
|
+
userName,
|
|
159
|
+
projectRoot
|
|
160
|
+
}) => {
|
|
161
|
+
const [runtime, controls] = await Promise.all([
|
|
162
|
+
loadRuntimeDeclaration(projectRoot),
|
|
163
|
+
getRuntimeControls(userName)
|
|
164
|
+
]);
|
|
165
|
+
return Object.entries(runtime.deployments).map(
|
|
166
|
+
([id, declaration]) => toRuntimeDeployment({ id, declaration, controls })
|
|
167
|
+
).sort((left, right) => left.label.localeCompare(right.label));
|
|
168
|
+
};
|
|
169
|
+
var getRuntimeDeployment = async ({
|
|
170
|
+
userName,
|
|
171
|
+
projectRoot,
|
|
172
|
+
deploymentId
|
|
173
|
+
}) => {
|
|
174
|
+
const deployments = await listRuntimeDeployments({ userName, projectRoot });
|
|
175
|
+
return deployments.find((deployment) => deployment.id === deploymentId) ?? null;
|
|
176
|
+
};
|
|
177
|
+
var resolveAccountId = async ({
|
|
178
|
+
userName,
|
|
179
|
+
deployment,
|
|
180
|
+
universe
|
|
181
|
+
}) => {
|
|
182
|
+
const account = await resolveTradingAccount({
|
|
183
|
+
userName,
|
|
184
|
+
accountId: deployment.accountId,
|
|
185
|
+
provider: deployment.provider,
|
|
186
|
+
universe
|
|
187
|
+
});
|
|
188
|
+
if (!account) {
|
|
189
|
+
throw new Error(`Trading account not found: ${deployment.accountId}`);
|
|
190
|
+
}
|
|
191
|
+
return account.id;
|
|
192
|
+
};
|
|
193
|
+
var loadResolvedRuntimeStrategies = async ({
|
|
194
|
+
userName,
|
|
195
|
+
projectRoot,
|
|
196
|
+
deploymentId,
|
|
197
|
+
universe,
|
|
198
|
+
accountId,
|
|
199
|
+
interval
|
|
200
|
+
}) => {
|
|
201
|
+
const [runtime, controls, packageManifest] = await Promise.all([
|
|
202
|
+
loadRuntimeDeclaration(projectRoot),
|
|
203
|
+
getRuntimeControls(userName),
|
|
204
|
+
readPackageManifest(projectRoot)
|
|
205
|
+
]);
|
|
206
|
+
const declaration = runtime.deployments[deploymentId];
|
|
207
|
+
if (!declaration) {
|
|
208
|
+
throw new Error(`Runtime deployment not found: ${deploymentId}`);
|
|
209
|
+
}
|
|
210
|
+
const deployment = toRuntimeDeployment({
|
|
211
|
+
id: deploymentId,
|
|
212
|
+
declaration,
|
|
213
|
+
controls
|
|
214
|
+
});
|
|
215
|
+
const strategies = await Promise.all(
|
|
216
|
+
Object.entries(declaration.strategies).map(
|
|
217
|
+
async ([strategyName, strategyDeclaration]) => {
|
|
218
|
+
const strategyCreator = await getStrategyCreator(
|
|
219
|
+
strategyName,
|
|
220
|
+
projectRoot
|
|
221
|
+
);
|
|
222
|
+
if (!strategyCreator) {
|
|
223
|
+
throw new Error(`Unknown strategy: ${strategyName}`);
|
|
224
|
+
}
|
|
225
|
+
const pluginSource = await getStrategyPluginSource(strategyName, projectRoot) ?? null;
|
|
226
|
+
const strategyPackage = await resolveStrategyPackageName({
|
|
227
|
+
pluginSource,
|
|
228
|
+
projectRoot
|
|
229
|
+
});
|
|
230
|
+
const [strategyPackageVersion, runtimePackageVersion] = await Promise.all([
|
|
231
|
+
resolveInstalledPackageVersion(
|
|
232
|
+
projectRoot,
|
|
233
|
+
strategyPackage,
|
|
234
|
+
packageManifest
|
|
235
|
+
),
|
|
236
|
+
resolveInstalledPackageVersion(
|
|
237
|
+
projectRoot,
|
|
238
|
+
"@tradejs/node",
|
|
239
|
+
packageManifest
|
|
240
|
+
)
|
|
241
|
+
]);
|
|
242
|
+
if (!strategyPackage || !strategyPackageVersion) {
|
|
243
|
+
throw new Error(
|
|
244
|
+
`Installed strategy package not found: ${strategyName}`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
if (!runtimePackageVersion) {
|
|
248
|
+
throw new Error("Installed @tradejs/node package version not found");
|
|
249
|
+
}
|
|
250
|
+
const strategyView = deployment.strategies.find(
|
|
251
|
+
(candidate) => candidate.strategyName === strategyName
|
|
252
|
+
);
|
|
253
|
+
const strategyConfig = strategyDeclaration.config;
|
|
254
|
+
const strategyUniverse = strategyConfig.UNIVERSE;
|
|
255
|
+
const resolvedAccountId = await resolveAccountId({
|
|
256
|
+
userName,
|
|
257
|
+
deployment,
|
|
258
|
+
universe: strategyUniverse
|
|
259
|
+
});
|
|
260
|
+
return {
|
|
261
|
+
strategyName,
|
|
262
|
+
version: strategyDeclaration.version,
|
|
263
|
+
enabled: strategyDeclaration.enabled,
|
|
264
|
+
controlState: strategyView?.controlState ?? "entries_paused",
|
|
265
|
+
interval: String(strategyConfig.INTERVAL),
|
|
266
|
+
universe: strategyUniverse,
|
|
267
|
+
accountId: resolvedAccountId,
|
|
268
|
+
strategyPackage,
|
|
269
|
+
strategyPackageVersion,
|
|
270
|
+
runtimePackageVersion,
|
|
271
|
+
strategyCreator,
|
|
272
|
+
sourceStrategyConfig: strategyConfig,
|
|
273
|
+
strategyConfig
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
const filtered = strategies.filter(
|
|
279
|
+
(candidate) => (!universe || candidate.universe === universe) && (!interval || String(candidate.interval) === String(interval)) && (!accountId || candidate.accountId === accountId)
|
|
280
|
+
);
|
|
281
|
+
const identities = /* @__PURE__ */ new Set();
|
|
282
|
+
for (const candidate of filtered) {
|
|
283
|
+
const identity = `${candidate.strategyName}:${candidate.accountId ?? "default"}`;
|
|
284
|
+
if (identities.has(identity)) {
|
|
285
|
+
throw new Error(`Runtime strategy conflict: ${identity}`);
|
|
286
|
+
}
|
|
287
|
+
identities.add(identity);
|
|
288
|
+
}
|
|
289
|
+
return filtered;
|
|
290
|
+
};
|
|
291
|
+
var getRuntimeStrategyPackageMetadata = async ({
|
|
292
|
+
strategyName,
|
|
293
|
+
projectRoot
|
|
294
|
+
}) => {
|
|
295
|
+
const packageManifest = await readPackageManifest(projectRoot);
|
|
296
|
+
const pluginSource = await getStrategyPluginSource(strategyName, projectRoot) ?? null;
|
|
297
|
+
const strategyPackage = await resolveStrategyPackageName({
|
|
298
|
+
pluginSource,
|
|
299
|
+
projectRoot
|
|
300
|
+
});
|
|
301
|
+
return {
|
|
302
|
+
strategyPackage,
|
|
303
|
+
strategyPackageVersion: await resolveInstalledPackageVersion(
|
|
304
|
+
projectRoot,
|
|
305
|
+
strategyPackage,
|
|
306
|
+
packageManifest
|
|
307
|
+
),
|
|
308
|
+
runtimePackageVersion: await resolveInstalledPackageVersion(
|
|
309
|
+
projectRoot,
|
|
310
|
+
"@tradejs/node",
|
|
311
|
+
packageManifest
|
|
312
|
+
)
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export {
|
|
317
|
+
verifyRuntimeDeclaration,
|
|
318
|
+
listRuntimeDeployments,
|
|
319
|
+
getRuntimeDeployment,
|
|
320
|
+
loadResolvedRuntimeStrategies,
|
|
321
|
+
getRuntimeStrategyPackageMetadata
|
|
322
|
+
};
|
|
@@ -41,11 +41,13 @@ var normalizeConfig = (rawConfig) => {
|
|
|
41
41
|
const hooks = normalizeTradejsConfigHooks(
|
|
42
42
|
config.hooks
|
|
43
43
|
);
|
|
44
|
+
const runtime = config.runtime && typeof config.runtime === "object" && !Array.isArray(config.runtime) ? config.runtime : void 0;
|
|
44
45
|
return {
|
|
45
46
|
strategies,
|
|
46
47
|
indicators,
|
|
47
48
|
connectors,
|
|
48
|
-
...hooks ? { hooks } : {}
|
|
49
|
+
...hooks ? { hooks } : {},
|
|
50
|
+
...runtime ? { runtime } : {}
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
var getNodeCreateRequire = () => {
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
getStrategyProfileMlAdapter,
|
|
4
4
|
resolveStrategyPolicyProfile,
|
|
5
5
|
runAiPromptLocal
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-733VVTWU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getStrategyManifest,
|
|
9
9
|
setStrategyRuntimeFactory
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MEZIXBZ3.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getTradejsProjectCwd,
|
|
13
13
|
loadTradejsConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LZDXRXIU.mjs";
|
|
15
15
|
|
|
16
16
|
// src/binanceBreadthUniverses.ts
|
|
17
17
|
import { createHash } from "crypto";
|
|
@@ -2776,7 +2776,7 @@ var executeEntryOrder = async ({
|
|
|
2776
2776
|
deploymentId: signal.deploymentId,
|
|
2777
2777
|
policyProfileId: signal.policyProfileId,
|
|
2778
2778
|
runtimeConfigId: signal.runtimeConfigId,
|
|
2779
|
-
|
|
2779
|
+
runtimeVersion: signal.runtimeVersion,
|
|
2780
2780
|
runtimeLineage: signal.runtimeLineage,
|
|
2781
2781
|
...signal.aiAnalysis ? { aiAnalysis: signal.aiAnalysis } : {}
|
|
2782
2782
|
});
|
|
@@ -3705,7 +3705,7 @@ var createStrategyRuntime = ({
|
|
|
3705
3705
|
deploymentId: requestedDeploymentId,
|
|
3706
3706
|
policyProfileId,
|
|
3707
3707
|
runtimeConfigId,
|
|
3708
|
-
|
|
3708
|
+
runtimeVersion,
|
|
3709
3709
|
entriesPaused = false,
|
|
3710
3710
|
runtimeLineage,
|
|
3711
3711
|
runtimeConfigSnapshot,
|
|
@@ -4377,8 +4377,8 @@ var createStrategyRuntime = ({
|
|
|
4377
4377
|
signal.signalId = `${signal.signalId}:${runtimeConfigId}`;
|
|
4378
4378
|
}
|
|
4379
4379
|
}
|
|
4380
|
-
if (
|
|
4381
|
-
signal.
|
|
4380
|
+
if (runtimeVersion) {
|
|
4381
|
+
signal.runtimeVersion = runtimeVersion;
|
|
4382
4382
|
}
|
|
4383
4383
|
if (decisionHookCtx.policyProfileId) {
|
|
4384
4384
|
signal.policyProfileId = decisionHookCtx.policyProfileId;
|
|
@@ -4491,7 +4491,7 @@ var createStrategyRuntime = ({
|
|
|
4491
4491
|
if (signal) {
|
|
4492
4492
|
signal.orderStatus = "skipped";
|
|
4493
4493
|
signal.orderSkipReason = skipReason;
|
|
4494
|
-
signal.
|
|
4494
|
+
signal.runtimeVersion = runtimeVersion;
|
|
4495
4495
|
}
|
|
4496
4496
|
return signal ?? skipReason;
|
|
4497
4497
|
}
|
package/dist/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestStat, TestThresholdsKey, RuntimeStrategyCloseNotification, Connector, Signal, Interval } from '@tradejs/types';
|
|
1
|
+
import { TradejsRuntimeDeclaration, TestStat, TestThresholdsKey, RuntimeStrategyCloseNotification, Connector, Signal, Interval } from '@tradejs/types';
|
|
2
2
|
import { TradejsConfigHooks } from '@tradejs/core/config';
|
|
3
3
|
|
|
4
4
|
declare const sendTextToTG: (message: string, options?: {
|
|
@@ -18,6 +18,7 @@ interface TradejsProjectConfig {
|
|
|
18
18
|
indicators?: string[];
|
|
19
19
|
connectors?: string[];
|
|
20
20
|
hooks?: TradejsConfigHooks;
|
|
21
|
+
runtime?: TradejsRuntimeDeclaration;
|
|
21
22
|
}
|
|
22
23
|
declare const loadTradejsConfig: (cwd?: string) => Promise<TradejsProjectConfig>;
|
|
23
24
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestStat, TestThresholdsKey, RuntimeStrategyCloseNotification, Connector, Signal, Interval } from '@tradejs/types';
|
|
1
|
+
import { TradejsRuntimeDeclaration, TestStat, TestThresholdsKey, RuntimeStrategyCloseNotification, Connector, Signal, Interval } from '@tradejs/types';
|
|
2
2
|
import { TradejsConfigHooks } from '@tradejs/core/config';
|
|
3
3
|
|
|
4
4
|
declare const sendTextToTG: (message: string, options?: {
|
|
@@ -18,6 +18,7 @@ interface TradejsProjectConfig {
|
|
|
18
18
|
indicators?: string[];
|
|
19
19
|
connectors?: string[];
|
|
20
20
|
hooks?: TradejsConfigHooks;
|
|
21
|
+
runtime?: TradejsRuntimeDeclaration;
|
|
21
22
|
}
|
|
22
23
|
declare const loadTradejsConfig: (cwd?: string) => Promise<TradejsProjectConfig>;
|
|
23
24
|
|
package/dist/cli.js
CHANGED
|
@@ -698,11 +698,13 @@ var normalizeConfig = (rawConfig) => {
|
|
|
698
698
|
const hooks = (0, import_config.normalizeTradejsConfigHooks)(
|
|
699
699
|
config.hooks
|
|
700
700
|
);
|
|
701
|
+
const runtime = config.runtime && typeof config.runtime === "object" && !Array.isArray(config.runtime) ? config.runtime : void 0;
|
|
701
702
|
return {
|
|
702
703
|
strategies: strategies2,
|
|
703
704
|
indicators,
|
|
704
705
|
connectors,
|
|
705
|
-
...hooks ? { hooks } : {}
|
|
706
|
+
...hooks ? { hooks } : {},
|
|
707
|
+
...runtime ? { runtime } : {}
|
|
706
708
|
};
|
|
707
709
|
};
|
|
708
710
|
var getNodeCreateRequire = () => {
|
package/dist/cli.mjs
CHANGED
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
} from "./chunk-KMJQQ53K.mjs";
|
|
6
6
|
import {
|
|
7
7
|
askAI
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-733VVTWU.mjs";
|
|
9
9
|
import {
|
|
10
10
|
ensureStrategyPluginsLoaded
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MEZIXBZ3.mjs";
|
|
12
12
|
import {
|
|
13
13
|
getTradejsProjectCwd,
|
|
14
14
|
loadTradejsConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LZDXRXIU.mjs";
|
|
16
16
|
import "./chunk-Y6FXYEAI.mjs";
|
|
17
17
|
|
|
18
18
|
// src/cli.ts
|
package/dist/connectors.js
CHANGED
|
@@ -90,11 +90,13 @@ var normalizeConfig = (rawConfig) => {
|
|
|
90
90
|
const hooks = (0, import_config.normalizeTradejsConfigHooks)(
|
|
91
91
|
config.hooks
|
|
92
92
|
);
|
|
93
|
+
const runtime = config.runtime && typeof config.runtime === "object" && !Array.isArray(config.runtime) ? config.runtime : void 0;
|
|
93
94
|
return {
|
|
94
95
|
strategies,
|
|
95
96
|
indicators,
|
|
96
97
|
connectors,
|
|
97
|
-
...hooks ? { hooks } : {}
|
|
98
|
+
...hooks ? { hooks } : {},
|
|
99
|
+
...runtime ? { runtime } : {}
|
|
98
100
|
};
|
|
99
101
|
};
|
|
100
102
|
var getNodeCreateRequire = () => {
|
package/dist/connectors.mjs
CHANGED
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
registerConnectorEntries,
|
|
13
13
|
resetConnectorRegistryCache,
|
|
14
14
|
resolveConnectorName
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-QVKUROR2.mjs";
|
|
16
|
+
import "./chunk-LZDXRXIU.mjs";
|
|
17
17
|
import "./chunk-Y6FXYEAI.mjs";
|
|
18
18
|
export {
|
|
19
19
|
BUILTIN_CONNECTOR_NAMES,
|
package/dist/registry.js
CHANGED
|
@@ -676,11 +676,13 @@ var normalizeConfig = (rawConfig) => {
|
|
|
676
676
|
const hooks = (0, import_config.normalizeTradejsConfigHooks)(
|
|
677
677
|
config.hooks
|
|
678
678
|
);
|
|
679
|
+
const runtime = config.runtime && typeof config.runtime === "object" && !Array.isArray(config.runtime) ? config.runtime : void 0;
|
|
679
680
|
return {
|
|
680
681
|
strategies: strategies2,
|
|
681
682
|
indicators,
|
|
682
683
|
connectors,
|
|
683
|
-
...hooks ? { hooks } : {}
|
|
684
|
+
...hooks ? { hooks } : {},
|
|
685
|
+
...runtime ? { runtime } : {}
|
|
684
686
|
};
|
|
685
687
|
};
|
|
686
688
|
var getNodeCreateRequire = () => {
|
|
@@ -4460,7 +4462,7 @@ var executeEntryOrder = async ({
|
|
|
4460
4462
|
deploymentId: signal.deploymentId,
|
|
4461
4463
|
policyProfileId: signal.policyProfileId,
|
|
4462
4464
|
runtimeConfigId: signal.runtimeConfigId,
|
|
4463
|
-
|
|
4465
|
+
runtimeVersion: signal.runtimeVersion,
|
|
4464
4466
|
runtimeLineage: signal.runtimeLineage,
|
|
4465
4467
|
...signal.aiAnalysis ? { aiAnalysis: signal.aiAnalysis } : {}
|
|
4466
4468
|
});
|
|
@@ -5371,7 +5373,7 @@ var createStrategyRuntime = ({
|
|
|
5371
5373
|
deploymentId: requestedDeploymentId,
|
|
5372
5374
|
policyProfileId,
|
|
5373
5375
|
runtimeConfigId,
|
|
5374
|
-
|
|
5376
|
+
runtimeVersion,
|
|
5375
5377
|
entriesPaused = false,
|
|
5376
5378
|
runtimeLineage,
|
|
5377
5379
|
runtimeConfigSnapshot,
|
|
@@ -6043,8 +6045,8 @@ var createStrategyRuntime = ({
|
|
|
6043
6045
|
signal.signalId = `${signal.signalId}:${runtimeConfigId}`;
|
|
6044
6046
|
}
|
|
6045
6047
|
}
|
|
6046
|
-
if (
|
|
6047
|
-
signal.
|
|
6048
|
+
if (runtimeVersion) {
|
|
6049
|
+
signal.runtimeVersion = runtimeVersion;
|
|
6048
6050
|
}
|
|
6049
6051
|
if (decisionHookCtx.policyProfileId) {
|
|
6050
6052
|
signal.policyProfileId = decisionHookCtx.policyProfileId;
|
|
@@ -6157,7 +6159,7 @@ var createStrategyRuntime = ({
|
|
|
6157
6159
|
if (signal) {
|
|
6158
6160
|
signal.orderStatus = "skipped";
|
|
6159
6161
|
signal.orderSkipReason = skipReason;
|
|
6160
|
-
signal.
|
|
6162
|
+
signal.runtimeVersion = runtimeVersion;
|
|
6161
6163
|
}
|
|
6162
6164
|
return signal ?? skipReason;
|
|
6163
6165
|
}
|
package/dist/registry.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-SVAUSZUE.mjs";
|
|
2
|
+
import "./chunk-733VVTWU.mjs";
|
|
3
3
|
import {
|
|
4
4
|
ensureIndicatorPluginsLoaded,
|
|
5
5
|
ensureStrategyPluginsLoaded,
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
registerStrategyEntries,
|
|
14
14
|
resetStrategyRegistryCache,
|
|
15
15
|
strategies
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-MEZIXBZ3.mjs";
|
|
17
|
+
import "./chunk-LZDXRXIU.mjs";
|
|
18
18
|
import "./chunk-Y6FXYEAI.mjs";
|
|
19
19
|
export {
|
|
20
20
|
ensureIndicatorPluginsLoaded,
|