@tradejs/cli 3.1.11 → 3.1.12-beta.218
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 +149 -78
- package/dist/lib/runEnvironment.js +6 -2
- package/dist/lib/runtimeEvidenceDeployment.js +16 -9
- package/dist/lib/runtimeLineage.js +32 -11
- package/dist/lib/runtimeScorecard.js +49 -10
- package/dist/lib/runtimeSignalsStorage.js +1 -1
- package/dist/lib/strategyRelease.js +4 -2
- package/dist/scripts/replay.js +77 -36
- package/dist/scripts/replayRunner.js +77 -36
- package/dist/scripts/runtimeControl.js +3 -2
- package/dist/scripts/runtimeEvidence.js +29 -10
- package/dist/scripts/runtimeScorecard.js +49 -10
- package/dist/scripts/signals.js +58 -36
- package/dist/scripts/signalsDaemon.js +58 -36
- package/dist/scripts/strategyRelease.js +4 -2
- package/package.json +12 -8
package/dist/scripts/signals.js
CHANGED
|
@@ -3805,7 +3805,7 @@ var toRuntimeSignalBucketRef = (signal) => ({
|
|
|
3805
3805
|
strategy: signal.strategy,
|
|
3806
3806
|
timestamp: signal.timestamp,
|
|
3807
3807
|
...signal.runtimeConfigId && signal.runtimeConfigId !== "config" ? { runtimeConfigId: signal.runtimeConfigId } : {},
|
|
3808
|
-
...signal.
|
|
3808
|
+
...signal.strategyRevision ? { strategyRevision: signal.strategyRevision } : {}
|
|
3809
3809
|
});
|
|
3810
3810
|
var shouldStoreRuntimeSignalDiagnostics = (signal) => signal.orderStatus === "completed" || signal.orderStatus === "failed";
|
|
3811
3811
|
var toStoredRuntimeSignal = (signal) => {
|
|
@@ -4169,21 +4169,38 @@ async function buildRuntimeLineage({
|
|
|
4169
4169
|
projectRoot,
|
|
4170
4170
|
strategyName,
|
|
4171
4171
|
compositionId,
|
|
4172
|
-
|
|
4172
|
+
strategyRevision,
|
|
4173
|
+
deploymentCompositionId,
|
|
4173
4174
|
strategyPackageVersion,
|
|
4175
|
+
strategyDependencyVersions,
|
|
4174
4176
|
runtimePackageVersion,
|
|
4175
4177
|
config: config2,
|
|
4176
4178
|
runContext,
|
|
4177
4179
|
env = process.env
|
|
4178
4180
|
}) {
|
|
4179
|
-
if (
|
|
4180
|
-
if (
|
|
4181
|
-
throw new Error(`Invalid
|
|
4181
|
+
if (strategyRevision != null) {
|
|
4182
|
+
if (!/^sr1:[a-f0-9]{16}$/.test(strategyRevision)) {
|
|
4183
|
+
throw new Error(`Invalid strategy revision: ${strategyRevision}`);
|
|
4184
|
+
}
|
|
4185
|
+
if (typeof deploymentCompositionId !== "string" || !/^dc1:[a-f0-9]{16}$/.test(deploymentCompositionId)) {
|
|
4186
|
+
throw new Error(
|
|
4187
|
+
`Invalid deployment composition id: ${String(deploymentCompositionId)}`
|
|
4188
|
+
);
|
|
4189
|
+
}
|
|
4190
|
+
if (typeof strategyPackageVersion !== "string" || !strategyPackageVersion.trim() || typeof runtimePackageVersion !== "string" || !runtimePackageVersion.trim()) {
|
|
4191
|
+
throw new Error("Invalid revision package versions");
|
|
4192
|
+
}
|
|
4193
|
+
if (!strategyDependencyVersions || Object.keys(strategyDependencyVersions).length === 0 || Object.entries(strategyDependencyVersions).some(
|
|
4194
|
+
([name, version]) => !name.startsWith("@tradejs/") || typeof version !== "string" || !version.trim()
|
|
4195
|
+
)) {
|
|
4196
|
+
throw new Error("Invalid strategy dependency versions");
|
|
4182
4197
|
}
|
|
4183
4198
|
return {
|
|
4184
|
-
schemaVersion:
|
|
4185
|
-
|
|
4199
|
+
schemaVersion: 3,
|
|
4200
|
+
strategyRevision,
|
|
4201
|
+
deploymentCompositionId,
|
|
4186
4202
|
strategyPackageVersion,
|
|
4203
|
+
strategyDependencyVersions,
|
|
4187
4204
|
runtimePackageVersion,
|
|
4188
4205
|
maxLossValue: resolveRuntimeMaxLossValue(config2)
|
|
4189
4206
|
};
|
|
@@ -4223,11 +4240,15 @@ async function buildRuntimeLineage({
|
|
|
4223
4240
|
maxLossValue: resolveRuntimeMaxLossValue(config2)
|
|
4224
4241
|
};
|
|
4225
4242
|
}
|
|
4226
|
-
var runtimeLineageKey = (lineage) => lineage.schemaVersion ===
|
|
4227
|
-
"
|
|
4228
|
-
lineage.
|
|
4229
|
-
lineage.
|
|
4230
|
-
lineage.
|
|
4243
|
+
var runtimeLineageKey = (lineage) => lineage.schemaVersion === 3 ? [
|
|
4244
|
+
"v3",
|
|
4245
|
+
lineage.deploymentCompositionId,
|
|
4246
|
+
lineage.strategyRevision,
|
|
4247
|
+
lineage.strategyPackageVersion,
|
|
4248
|
+
`deps:${fingerprintRuntimeValue(
|
|
4249
|
+
lineage.strategyDependencyVersions
|
|
4250
|
+
).slice(0, 16)}`,
|
|
4251
|
+
lineage.runtimePackageVersion
|
|
4231
4252
|
].join(":") : [
|
|
4232
4253
|
lineage.schemaVersion,
|
|
4233
4254
|
lineage.compositionId ?? "unbound-composition",
|
|
@@ -4247,18 +4268,14 @@ var buildRuntimeSignalEvaluationId = ({
|
|
|
4247
4268
|
symbol,
|
|
4248
4269
|
timestamp,
|
|
4249
4270
|
runtimeConfigId,
|
|
4250
|
-
|
|
4271
|
+
strategyRevision,
|
|
4251
4272
|
deploymentId,
|
|
4252
4273
|
accountId
|
|
4253
4274
|
}) => {
|
|
4254
4275
|
const runtimeScope = deploymentId ? [deploymentId, accountId ?? "default-account"] : [];
|
|
4255
|
-
return
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
`v${runtimeVersion}`,
|
|
4259
|
-
symbol,
|
|
4260
|
-
timestamp
|
|
4261
|
-
].join(":") : runtimeConfigId && runtimeConfigId !== "config" ? [
|
|
4276
|
+
return strategyRevision ? [...runtimeScope, strategyName, strategyRevision, symbol, timestamp].join(
|
|
4277
|
+
":"
|
|
4278
|
+
) : runtimeConfigId && runtimeConfigId !== "config" ? [
|
|
4262
4279
|
...runtimeScope,
|
|
4263
4280
|
strategyName,
|
|
4264
4281
|
runtimeConfigId,
|
|
@@ -4271,7 +4288,7 @@ var buildLineageField = (scope) => [
|
|
|
4271
4288
|
scope.accountId ?? "default-account",
|
|
4272
4289
|
scope.strategy,
|
|
4273
4290
|
scope.runtimeConfigId ?? "config",
|
|
4274
|
-
scope.
|
|
4291
|
+
scope.strategyRevision ?? "research",
|
|
4275
4292
|
scope.symbol,
|
|
4276
4293
|
runtimeLineageKey(scope.lineage)
|
|
4277
4294
|
].join(":");
|
|
@@ -4313,7 +4330,7 @@ var flushRuntimeSignalEvaluations = async (evaluations) => {
|
|
|
4313
4330
|
deploymentId: evaluation.deploymentId,
|
|
4314
4331
|
accountId: evaluation.accountId,
|
|
4315
4332
|
runtimeConfigId: evaluation.runtimeConfigId,
|
|
4316
|
-
|
|
4333
|
+
strategyRevision: evaluation.strategyRevision,
|
|
4317
4334
|
symbol: evaluation.symbol,
|
|
4318
4335
|
lineage: evaluation.runtimeLineage
|
|
4319
4336
|
});
|
|
@@ -4325,7 +4342,7 @@ var flushRuntimeSignalEvaluations = async (evaluations) => {
|
|
|
4325
4342
|
...evaluation.deploymentId ? { deploymentId: evaluation.deploymentId } : {},
|
|
4326
4343
|
...evaluation.accountId ? { accountId: evaluation.accountId } : {},
|
|
4327
4344
|
runtimeConfigId: evaluation.runtimeConfigId,
|
|
4328
|
-
|
|
4345
|
+
strategyRevision: evaluation.strategyRevision,
|
|
4329
4346
|
lineage: evaluation.runtimeLineage,
|
|
4330
4347
|
firstTimestamp: Math.min(
|
|
4331
4348
|
existing?.firstTimestamp ?? evaluation.timestamp,
|
|
@@ -4865,15 +4882,17 @@ var createSignalsTickerEvaluator = ({
|
|
|
4865
4882
|
for (const runtimeStrategy of runtimeStrategies) {
|
|
4866
4883
|
const {
|
|
4867
4884
|
strategyName,
|
|
4868
|
-
|
|
4885
|
+
strategyRevision,
|
|
4886
|
+
deploymentCompositionId,
|
|
4869
4887
|
controlState,
|
|
4870
4888
|
strategyPackageVersion,
|
|
4889
|
+
strategyDependencyVersions,
|
|
4871
4890
|
runtimePackageVersion,
|
|
4872
4891
|
strategyCreator,
|
|
4873
4892
|
sourceStrategyConfig,
|
|
4874
4893
|
strategyConfig
|
|
4875
4894
|
} = runtimeStrategy;
|
|
4876
|
-
const runtimeIdentity =
|
|
4895
|
+
const runtimeIdentity = strategyRevision;
|
|
4877
4896
|
const runtimeConfig = buildRuntimeModeStrategyConfig({
|
|
4878
4897
|
strategyConfig,
|
|
4879
4898
|
env: "CRON",
|
|
@@ -4883,8 +4902,10 @@ var createSignalsTickerEvaluator = ({
|
|
|
4883
4902
|
const runtimeLineage = await buildRuntimeLineage({
|
|
4884
4903
|
projectRoot,
|
|
4885
4904
|
strategyName,
|
|
4886
|
-
|
|
4905
|
+
strategyRevision,
|
|
4906
|
+
deploymentCompositionId,
|
|
4887
4907
|
strategyPackageVersion,
|
|
4908
|
+
strategyDependencyVersions,
|
|
4888
4909
|
runtimePackageVersion,
|
|
4889
4910
|
config: { strategyConfig },
|
|
4890
4911
|
runContext: {
|
|
@@ -4926,7 +4947,7 @@ var createSignalsTickerEvaluator = ({
|
|
|
4926
4947
|
userName,
|
|
4927
4948
|
connectorName,
|
|
4928
4949
|
runtimeConfigId: runtimeIdentity,
|
|
4929
|
-
|
|
4950
|
+
strategyRevision,
|
|
4930
4951
|
entriesPaused: controlState === "entries_paused",
|
|
4931
4952
|
runtimeLineage,
|
|
4932
4953
|
runtimeConfigSnapshot: {
|
|
@@ -4981,14 +5002,14 @@ var createSignalsTickerEvaluator = ({
|
|
|
4981
5002
|
symbol,
|
|
4982
5003
|
timestamp: lastCandle.timestamp,
|
|
4983
5004
|
runtimeConfigId: runtimeIdentity,
|
|
4984
|
-
|
|
5005
|
+
strategyRevision,
|
|
4985
5006
|
deploymentId,
|
|
4986
5007
|
accountId
|
|
4987
5008
|
}),
|
|
4988
5009
|
userName,
|
|
4989
5010
|
strategy: strategyName,
|
|
4990
5011
|
runtimeConfigId: runtimeIdentity,
|
|
4991
|
-
|
|
5012
|
+
strategyRevision,
|
|
4992
5013
|
runtimeLineage,
|
|
4993
5014
|
symbol,
|
|
4994
5015
|
interval,
|
|
@@ -5006,13 +5027,13 @@ var createSignalsTickerEvaluator = ({
|
|
|
5006
5027
|
}
|
|
5007
5028
|
if (stats) stats.signals += 1;
|
|
5008
5029
|
signal.runtimeConfigId = runtimeIdentity;
|
|
5009
|
-
signal.
|
|
5030
|
+
signal.strategyRevision = strategyRevision;
|
|
5010
5031
|
signal.runtimeLineage = runtimeLineage;
|
|
5011
5032
|
signal.deploymentId = deploymentId;
|
|
5012
5033
|
signal.accountId = accountId;
|
|
5013
5034
|
const signalRuntimeIdentity = [
|
|
5014
5035
|
...deploymentId ? [deploymentId, accountId ?? "default-account"] : [],
|
|
5015
|
-
|
|
5036
|
+
strategyRevision
|
|
5016
5037
|
].join(":");
|
|
5017
5038
|
if (signalRuntimeIdentity && !signal.signalId.endsWith(`:${signalRuntimeIdentity}`)) {
|
|
5018
5039
|
signal.signalId = `${signal.signalId}:${signalRuntimeIdentity}`;
|
|
@@ -5034,14 +5055,14 @@ var createSignalsTickerEvaluator = ({
|
|
|
5034
5055
|
symbol,
|
|
5035
5056
|
timestamp: lastCandle.timestamp,
|
|
5036
5057
|
runtimeConfigId: runtimeIdentity,
|
|
5037
|
-
|
|
5058
|
+
strategyRevision,
|
|
5038
5059
|
deploymentId,
|
|
5039
5060
|
accountId
|
|
5040
5061
|
}),
|
|
5041
5062
|
userName,
|
|
5042
5063
|
strategy: strategyName,
|
|
5043
5064
|
runtimeConfigId: runtimeIdentity,
|
|
5044
|
-
|
|
5065
|
+
strategyRevision,
|
|
5045
5066
|
runtimeLineage,
|
|
5046
5067
|
symbol,
|
|
5047
5068
|
interval,
|
|
@@ -5068,7 +5089,7 @@ var createSignalsTickerEvaluator = ({
|
|
|
5068
5089
|
|
|
5069
5090
|
// src/lib/signals/configuredScopes.ts
|
|
5070
5091
|
var sorted = (values) => values ? [...values].sort() : [];
|
|
5071
|
-
var formatConfiguredStrategyIdentity = (strategy) => `${strategy.strategyName}
|
|
5092
|
+
var formatConfiguredStrategyIdentity = (strategy) => `${strategy.strategyName}@${strategy.strategyRevision}[${strategy.controlState}]`;
|
|
5072
5093
|
var getConfiguredScopeActiveSymbols = ({
|
|
5073
5094
|
trades,
|
|
5074
5095
|
deploymentId,
|
|
@@ -5093,6 +5114,7 @@ var buildConfiguredSignalsScopes = ({
|
|
|
5093
5114
|
}) => {
|
|
5094
5115
|
const deploymentIdentity = JSON.stringify({
|
|
5095
5116
|
id: deployment.id,
|
|
5117
|
+
deploymentCompositionId: deployment.deploymentCompositionId,
|
|
5096
5118
|
enabled: deployment.enabled,
|
|
5097
5119
|
connectorName: deployment.connectorName,
|
|
5098
5120
|
provider: deployment.provider,
|
|
@@ -5473,7 +5495,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5473
5495
|
new Set(
|
|
5474
5496
|
tickers.flatMap(
|
|
5475
5497
|
(symbol) => runtimeStrategies.map(
|
|
5476
|
-
({ strategyName,
|
|
5498
|
+
({ strategyName, strategyRevision }) => buildSignalsStrategyLifecycleKey({
|
|
5477
5499
|
connectorName,
|
|
5478
5500
|
universe: sessionUniverse,
|
|
5479
5501
|
accountId,
|
|
@@ -5481,7 +5503,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5481
5503
|
symbol,
|
|
5482
5504
|
interval: interval2,
|
|
5483
5505
|
strategyName,
|
|
5484
|
-
configId:
|
|
5506
|
+
configId: strategyRevision
|
|
5485
5507
|
})
|
|
5486
5508
|
)
|
|
5487
5509
|
)
|
|
@@ -3803,7 +3803,7 @@ var toRuntimeSignalBucketRef = (signal) => ({
|
|
|
3803
3803
|
strategy: signal.strategy,
|
|
3804
3804
|
timestamp: signal.timestamp,
|
|
3805
3805
|
...signal.runtimeConfigId && signal.runtimeConfigId !== "config" ? { runtimeConfigId: signal.runtimeConfigId } : {},
|
|
3806
|
-
...signal.
|
|
3806
|
+
...signal.strategyRevision ? { strategyRevision: signal.strategyRevision } : {}
|
|
3807
3807
|
});
|
|
3808
3808
|
var shouldStoreRuntimeSignalDiagnostics = (signal) => signal.orderStatus === "completed" || signal.orderStatus === "failed";
|
|
3809
3809
|
var toStoredRuntimeSignal = (signal) => {
|
|
@@ -4167,21 +4167,38 @@ async function buildRuntimeLineage({
|
|
|
4167
4167
|
projectRoot,
|
|
4168
4168
|
strategyName,
|
|
4169
4169
|
compositionId,
|
|
4170
|
-
|
|
4170
|
+
strategyRevision,
|
|
4171
|
+
deploymentCompositionId,
|
|
4171
4172
|
strategyPackageVersion,
|
|
4173
|
+
strategyDependencyVersions,
|
|
4172
4174
|
runtimePackageVersion,
|
|
4173
4175
|
config: config2,
|
|
4174
4176
|
runContext,
|
|
4175
4177
|
env = process.env
|
|
4176
4178
|
}) {
|
|
4177
|
-
if (
|
|
4178
|
-
if (
|
|
4179
|
-
throw new Error(`Invalid
|
|
4179
|
+
if (strategyRevision != null) {
|
|
4180
|
+
if (!/^sr1:[a-f0-9]{16}$/.test(strategyRevision)) {
|
|
4181
|
+
throw new Error(`Invalid strategy revision: ${strategyRevision}`);
|
|
4182
|
+
}
|
|
4183
|
+
if (typeof deploymentCompositionId !== "string" || !/^dc1:[a-f0-9]{16}$/.test(deploymentCompositionId)) {
|
|
4184
|
+
throw new Error(
|
|
4185
|
+
`Invalid deployment composition id: ${String(deploymentCompositionId)}`
|
|
4186
|
+
);
|
|
4187
|
+
}
|
|
4188
|
+
if (typeof strategyPackageVersion !== "string" || !strategyPackageVersion.trim() || typeof runtimePackageVersion !== "string" || !runtimePackageVersion.trim()) {
|
|
4189
|
+
throw new Error("Invalid revision package versions");
|
|
4190
|
+
}
|
|
4191
|
+
if (!strategyDependencyVersions || Object.keys(strategyDependencyVersions).length === 0 || Object.entries(strategyDependencyVersions).some(
|
|
4192
|
+
([name, version]) => !name.startsWith("@tradejs/") || typeof version !== "string" || !version.trim()
|
|
4193
|
+
)) {
|
|
4194
|
+
throw new Error("Invalid strategy dependency versions");
|
|
4180
4195
|
}
|
|
4181
4196
|
return {
|
|
4182
|
-
schemaVersion:
|
|
4183
|
-
|
|
4197
|
+
schemaVersion: 3,
|
|
4198
|
+
strategyRevision,
|
|
4199
|
+
deploymentCompositionId,
|
|
4184
4200
|
strategyPackageVersion,
|
|
4201
|
+
strategyDependencyVersions,
|
|
4185
4202
|
runtimePackageVersion,
|
|
4186
4203
|
maxLossValue: resolveRuntimeMaxLossValue(config2)
|
|
4187
4204
|
};
|
|
@@ -4221,11 +4238,15 @@ async function buildRuntimeLineage({
|
|
|
4221
4238
|
maxLossValue: resolveRuntimeMaxLossValue(config2)
|
|
4222
4239
|
};
|
|
4223
4240
|
}
|
|
4224
|
-
var runtimeLineageKey = (lineage) => lineage.schemaVersion ===
|
|
4225
|
-
"
|
|
4226
|
-
lineage.
|
|
4227
|
-
lineage.
|
|
4228
|
-
lineage.
|
|
4241
|
+
var runtimeLineageKey = (lineage) => lineage.schemaVersion === 3 ? [
|
|
4242
|
+
"v3",
|
|
4243
|
+
lineage.deploymentCompositionId,
|
|
4244
|
+
lineage.strategyRevision,
|
|
4245
|
+
lineage.strategyPackageVersion,
|
|
4246
|
+
`deps:${fingerprintRuntimeValue(
|
|
4247
|
+
lineage.strategyDependencyVersions
|
|
4248
|
+
).slice(0, 16)}`,
|
|
4249
|
+
lineage.runtimePackageVersion
|
|
4229
4250
|
].join(":") : [
|
|
4230
4251
|
lineage.schemaVersion,
|
|
4231
4252
|
lineage.compositionId ?? "unbound-composition",
|
|
@@ -4245,18 +4266,14 @@ var buildRuntimeSignalEvaluationId = ({
|
|
|
4245
4266
|
symbol,
|
|
4246
4267
|
timestamp,
|
|
4247
4268
|
runtimeConfigId,
|
|
4248
|
-
|
|
4269
|
+
strategyRevision,
|
|
4249
4270
|
deploymentId,
|
|
4250
4271
|
accountId
|
|
4251
4272
|
}) => {
|
|
4252
4273
|
const runtimeScope = deploymentId ? [deploymentId, accountId ?? "default-account"] : [];
|
|
4253
|
-
return
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
`v${runtimeVersion}`,
|
|
4257
|
-
symbol,
|
|
4258
|
-
timestamp
|
|
4259
|
-
].join(":") : runtimeConfigId && runtimeConfigId !== "config" ? [
|
|
4274
|
+
return strategyRevision ? [...runtimeScope, strategyName, strategyRevision, symbol, timestamp].join(
|
|
4275
|
+
":"
|
|
4276
|
+
) : runtimeConfigId && runtimeConfigId !== "config" ? [
|
|
4260
4277
|
...runtimeScope,
|
|
4261
4278
|
strategyName,
|
|
4262
4279
|
runtimeConfigId,
|
|
@@ -4269,7 +4286,7 @@ var buildLineageField = (scope) => [
|
|
|
4269
4286
|
scope.accountId ?? "default-account",
|
|
4270
4287
|
scope.strategy,
|
|
4271
4288
|
scope.runtimeConfigId ?? "config",
|
|
4272
|
-
scope.
|
|
4289
|
+
scope.strategyRevision ?? "research",
|
|
4273
4290
|
scope.symbol,
|
|
4274
4291
|
runtimeLineageKey(scope.lineage)
|
|
4275
4292
|
].join(":");
|
|
@@ -4311,7 +4328,7 @@ var flushRuntimeSignalEvaluations = async (evaluations) => {
|
|
|
4311
4328
|
deploymentId: evaluation.deploymentId,
|
|
4312
4329
|
accountId: evaluation.accountId,
|
|
4313
4330
|
runtimeConfigId: evaluation.runtimeConfigId,
|
|
4314
|
-
|
|
4331
|
+
strategyRevision: evaluation.strategyRevision,
|
|
4315
4332
|
symbol: evaluation.symbol,
|
|
4316
4333
|
lineage: evaluation.runtimeLineage
|
|
4317
4334
|
});
|
|
@@ -4323,7 +4340,7 @@ var flushRuntimeSignalEvaluations = async (evaluations) => {
|
|
|
4323
4340
|
...evaluation.deploymentId ? { deploymentId: evaluation.deploymentId } : {},
|
|
4324
4341
|
...evaluation.accountId ? { accountId: evaluation.accountId } : {},
|
|
4325
4342
|
runtimeConfigId: evaluation.runtimeConfigId,
|
|
4326
|
-
|
|
4343
|
+
strategyRevision: evaluation.strategyRevision,
|
|
4327
4344
|
lineage: evaluation.runtimeLineage,
|
|
4328
4345
|
firstTimestamp: Math.min(
|
|
4329
4346
|
existing?.firstTimestamp ?? evaluation.timestamp,
|
|
@@ -4863,15 +4880,17 @@ var createSignalsTickerEvaluator = ({
|
|
|
4863
4880
|
for (const runtimeStrategy of runtimeStrategies) {
|
|
4864
4881
|
const {
|
|
4865
4882
|
strategyName,
|
|
4866
|
-
|
|
4883
|
+
strategyRevision,
|
|
4884
|
+
deploymentCompositionId,
|
|
4867
4885
|
controlState,
|
|
4868
4886
|
strategyPackageVersion,
|
|
4887
|
+
strategyDependencyVersions,
|
|
4869
4888
|
runtimePackageVersion,
|
|
4870
4889
|
strategyCreator,
|
|
4871
4890
|
sourceStrategyConfig,
|
|
4872
4891
|
strategyConfig
|
|
4873
4892
|
} = runtimeStrategy;
|
|
4874
|
-
const runtimeIdentity =
|
|
4893
|
+
const runtimeIdentity = strategyRevision;
|
|
4875
4894
|
const runtimeConfig = buildRuntimeModeStrategyConfig({
|
|
4876
4895
|
strategyConfig,
|
|
4877
4896
|
env: "CRON",
|
|
@@ -4881,8 +4900,10 @@ var createSignalsTickerEvaluator = ({
|
|
|
4881
4900
|
const runtimeLineage = await buildRuntimeLineage({
|
|
4882
4901
|
projectRoot,
|
|
4883
4902
|
strategyName,
|
|
4884
|
-
|
|
4903
|
+
strategyRevision,
|
|
4904
|
+
deploymentCompositionId,
|
|
4885
4905
|
strategyPackageVersion,
|
|
4906
|
+
strategyDependencyVersions,
|
|
4886
4907
|
runtimePackageVersion,
|
|
4887
4908
|
config: { strategyConfig },
|
|
4888
4909
|
runContext: {
|
|
@@ -4924,7 +4945,7 @@ var createSignalsTickerEvaluator = ({
|
|
|
4924
4945
|
userName,
|
|
4925
4946
|
connectorName,
|
|
4926
4947
|
runtimeConfigId: runtimeIdentity,
|
|
4927
|
-
|
|
4948
|
+
strategyRevision,
|
|
4928
4949
|
entriesPaused: controlState === "entries_paused",
|
|
4929
4950
|
runtimeLineage,
|
|
4930
4951
|
runtimeConfigSnapshot: {
|
|
@@ -4979,14 +5000,14 @@ var createSignalsTickerEvaluator = ({
|
|
|
4979
5000
|
symbol,
|
|
4980
5001
|
timestamp: lastCandle.timestamp,
|
|
4981
5002
|
runtimeConfigId: runtimeIdentity,
|
|
4982
|
-
|
|
5003
|
+
strategyRevision,
|
|
4983
5004
|
deploymentId,
|
|
4984
5005
|
accountId
|
|
4985
5006
|
}),
|
|
4986
5007
|
userName,
|
|
4987
5008
|
strategy: strategyName,
|
|
4988
5009
|
runtimeConfigId: runtimeIdentity,
|
|
4989
|
-
|
|
5010
|
+
strategyRevision,
|
|
4990
5011
|
runtimeLineage,
|
|
4991
5012
|
symbol,
|
|
4992
5013
|
interval,
|
|
@@ -5004,13 +5025,13 @@ var createSignalsTickerEvaluator = ({
|
|
|
5004
5025
|
}
|
|
5005
5026
|
if (stats) stats.signals += 1;
|
|
5006
5027
|
signal.runtimeConfigId = runtimeIdentity;
|
|
5007
|
-
signal.
|
|
5028
|
+
signal.strategyRevision = strategyRevision;
|
|
5008
5029
|
signal.runtimeLineage = runtimeLineage;
|
|
5009
5030
|
signal.deploymentId = deploymentId;
|
|
5010
5031
|
signal.accountId = accountId;
|
|
5011
5032
|
const signalRuntimeIdentity = [
|
|
5012
5033
|
...deploymentId ? [deploymentId, accountId ?? "default-account"] : [],
|
|
5013
|
-
|
|
5034
|
+
strategyRevision
|
|
5014
5035
|
].join(":");
|
|
5015
5036
|
if (signalRuntimeIdentity && !signal.signalId.endsWith(`:${signalRuntimeIdentity}`)) {
|
|
5016
5037
|
signal.signalId = `${signal.signalId}:${signalRuntimeIdentity}`;
|
|
@@ -5032,14 +5053,14 @@ var createSignalsTickerEvaluator = ({
|
|
|
5032
5053
|
symbol,
|
|
5033
5054
|
timestamp: lastCandle.timestamp,
|
|
5034
5055
|
runtimeConfigId: runtimeIdentity,
|
|
5035
|
-
|
|
5056
|
+
strategyRevision,
|
|
5036
5057
|
deploymentId,
|
|
5037
5058
|
accountId
|
|
5038
5059
|
}),
|
|
5039
5060
|
userName,
|
|
5040
5061
|
strategy: strategyName,
|
|
5041
5062
|
runtimeConfigId: runtimeIdentity,
|
|
5042
|
-
|
|
5063
|
+
strategyRevision,
|
|
5043
5064
|
runtimeLineage,
|
|
5044
5065
|
symbol,
|
|
5045
5066
|
interval,
|
|
@@ -5066,7 +5087,7 @@ var createSignalsTickerEvaluator = ({
|
|
|
5066
5087
|
|
|
5067
5088
|
// src/lib/signals/configuredScopes.ts
|
|
5068
5089
|
var sorted = (values) => values ? [...values].sort() : [];
|
|
5069
|
-
var formatConfiguredStrategyIdentity = (strategy) => `${strategy.strategyName}
|
|
5090
|
+
var formatConfiguredStrategyIdentity = (strategy) => `${strategy.strategyName}@${strategy.strategyRevision}[${strategy.controlState}]`;
|
|
5070
5091
|
var getConfiguredScopeActiveSymbols = ({
|
|
5071
5092
|
trades,
|
|
5072
5093
|
deploymentId,
|
|
@@ -5091,6 +5112,7 @@ var buildConfiguredSignalsScopes = ({
|
|
|
5091
5112
|
}) => {
|
|
5092
5113
|
const deploymentIdentity = JSON.stringify({
|
|
5093
5114
|
id: deployment.id,
|
|
5115
|
+
deploymentCompositionId: deployment.deploymentCompositionId,
|
|
5094
5116
|
enabled: deployment.enabled,
|
|
5095
5117
|
connectorName: deployment.connectorName,
|
|
5096
5118
|
provider: deployment.provider,
|
|
@@ -5471,7 +5493,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5471
5493
|
new Set(
|
|
5472
5494
|
tickers.flatMap(
|
|
5473
5495
|
(symbol) => runtimeStrategies.map(
|
|
5474
|
-
({ strategyName,
|
|
5496
|
+
({ strategyName, strategyRevision }) => buildSignalsStrategyLifecycleKey({
|
|
5475
5497
|
connectorName,
|
|
5476
5498
|
universe: sessionUniverse,
|
|
5477
5499
|
accountId,
|
|
@@ -5479,7 +5501,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5479
5501
|
symbol,
|
|
5480
5502
|
interval: interval2,
|
|
5481
5503
|
strategyName,
|
|
5482
|
-
configId:
|
|
5504
|
+
configId: strategyRevision
|
|
5483
5505
|
})
|
|
5484
5506
|
)
|
|
5485
5507
|
)
|
|
@@ -229,6 +229,8 @@ var planStrategyEvidenceRetention = ({
|
|
|
229
229
|
// src/lib/strategyRelease.ts
|
|
230
230
|
var SHA256_RE = /^[a-f0-9]{64}$/;
|
|
231
231
|
var LINEAGE_FINGERPRINT_RE = /^[a-f0-9]{16}$/;
|
|
232
|
+
var STRATEGY_REVISION_RE = /^sr1:[a-f0-9]{16}$/;
|
|
233
|
+
var DEPLOYMENT_COMPOSITION_ID_RE = /^dc1:[a-f0-9]{16}$/;
|
|
232
234
|
var REQUIRED_LONG_WINDOWS = [1095, 1460, 1825];
|
|
233
235
|
var REQUIRED_STABLE_TERMINAL_WINDOWS = [365, 180, 90];
|
|
234
236
|
var MIN_RECENT_DIRECTION_REPAIR_TRADES = 20;
|
|
@@ -251,7 +253,7 @@ var verifyFullPeriodChartArtifact = async (input) => {
|
|
|
251
253
|
}
|
|
252
254
|
};
|
|
253
255
|
var hasExactRuntimeTarget = (target, strategyName) => Boolean(
|
|
254
|
-
target?.userName.trim() && target.deploymentId.trim() && target.accountId.trim() && target.strategyName.trim() === strategyName.trim() &&
|
|
256
|
+
target?.userName.trim() && target.deploymentId.trim() && target.accountId.trim() && target.strategyName.trim() === strategyName.trim() && STRATEGY_REVISION_RE.test(target.strategyRevision) && DEPLOYMENT_COMPOSITION_ID_RE.test(target.deploymentCompositionId)
|
|
255
257
|
);
|
|
256
258
|
var deriveStrategyReleaseResearchDecision = async (input) => {
|
|
257
259
|
const blockers = [];
|
|
@@ -352,7 +354,7 @@ var deriveStrategyReleaseResearchDecision = async (input) => {
|
|
|
352
354
|
maxLossValue: 1,
|
|
353
355
|
requiresRuntimeBinding: true,
|
|
354
356
|
blockers: [],
|
|
355
|
-
summary: "The portable micro-forward handoff is ready. Commit its deployment, account binding, complete config
|
|
357
|
+
summary: "The portable micro-forward handoff is ready. Commit its deployment, account binding, and complete config in TradeJS-Project; runtime revisions are computed from the installed packages and parsed config."
|
|
356
358
|
};
|
|
357
359
|
}
|
|
358
360
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.12-beta.218",
|
|
4
4
|
"description": "Official CLI for the TradeJS TypeScript framework: infra setup, backtests, signals, bots, and ML workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"signals",
|
|
11
11
|
"bot",
|
|
12
12
|
"automation",
|
|
13
|
+
"crypto",
|
|
14
|
+
"bybit",
|
|
15
|
+
"binance",
|
|
16
|
+
"coinbase",
|
|
13
17
|
"ai",
|
|
14
18
|
"claude",
|
|
15
19
|
"codex"
|
|
@@ -32,13 +36,13 @@
|
|
|
32
36
|
"tradejs": "dist/cli.js"
|
|
33
37
|
},
|
|
34
38
|
"dependencies": {
|
|
35
|
-
"@tradejs/connectors": "^3.1.
|
|
36
|
-
"@tradejs/core": "^3.1.
|
|
37
|
-
"@tradejs/indicators": "^3.1.
|
|
38
|
-
"@tradejs/infra": "^3.1.
|
|
39
|
-
"@tradejs/node": "^3.1.
|
|
40
|
-
"@tradejs/strategy-kit": "
|
|
41
|
-
"@tradejs/types": "^3.1.
|
|
39
|
+
"@tradejs/connectors": "^3.1.12-beta.218",
|
|
40
|
+
"@tradejs/core": "^3.1.12-beta.218",
|
|
41
|
+
"@tradejs/indicators": "^3.1.12-beta.218",
|
|
42
|
+
"@tradejs/infra": "^3.1.12-beta.218",
|
|
43
|
+
"@tradejs/node": "^3.1.12-beta.218",
|
|
44
|
+
"@tradejs/strategy-kit": "3.0.2",
|
|
45
|
+
"@tradejs/types": "^3.1.12-beta.218",
|
|
42
46
|
"args": "^5.0.3",
|
|
43
47
|
"bcryptjs": "^2.4.3",
|
|
44
48
|
"chalk": "4.1.2",
|