@tradejs/cli 3.1.16-beta.230 → 3.1.17-beta.231
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 +581 -839
- package/dist/lib/runtimeDebugEvidence.js +7 -20
- package/dist/lib/runtimeEvidenceArtifacts.js +165 -0
- package/dist/lib/runtimeEvidenceDeployment.js +84 -4
- package/dist/lib/runtimeEvidenceSync.js +171 -112
- package/dist/lib/runtimeLineage.js +28 -306
- package/dist/lib/runtimeRedis.js +1 -3
- package/dist/lib/runtimeScorecard.js +177 -135
- package/dist/lib/strategyRelease.js +1 -1
- package/dist/scripts/replay.js +165 -370
- package/dist/scripts/replayRunner.js +165 -370
- package/dist/scripts/replayRuntimeEvidence.js +5 -16
- package/dist/scripts/runtimeEvidence.js +319 -187
- package/dist/scripts/runtimeEvidenceSync.js +172 -106
- package/dist/scripts/runtimeParity.js +1 -3
- package/dist/scripts/runtimeScorecard.js +220 -167
- package/dist/scripts/signals.js +47 -316
- package/dist/scripts/signalsDaemon.js +47 -316
- package/dist/scripts/signalsSummary.js +3 -8
- package/package.json +7 -7
package/dist/scripts/signals.js
CHANGED
|
@@ -46,7 +46,7 @@ var import_chalk7 = __toESM(require("chalk"));
|
|
|
46
46
|
var import_connectors6 = require("@tradejs/node/connectors");
|
|
47
47
|
var import_cli2 = require("@tradejs/node/cli");
|
|
48
48
|
var import_async3 = require("@tradejs/core/async");
|
|
49
|
-
var
|
|
49
|
+
var import_strategies4 = require("@tradejs/core/strategies");
|
|
50
50
|
var import_constants3 = require("@tradejs/core/constants");
|
|
51
51
|
var import_time3 = require("@tradejs/core/time");
|
|
52
52
|
var import_logger4 = require("@tradejs/infra/logger");
|
|
@@ -2150,27 +2150,27 @@ var createCoinMarketCapFetchStats = () => ({
|
|
|
2150
2150
|
totalCredits: 0,
|
|
2151
2151
|
byPath: /* @__PURE__ */ new Map()
|
|
2152
2152
|
});
|
|
2153
|
-
var getCoinMarketCapPathLabel = (
|
|
2154
|
-
if (
|
|
2155
|
-
if (
|
|
2156
|
-
if (
|
|
2157
|
-
if (
|
|
2158
|
-
if (
|
|
2159
|
-
if (
|
|
2160
|
-
return
|
|
2161
|
-
};
|
|
2162
|
-
var recordCoinMarketCapFetchStats = (stats,
|
|
2153
|
+
var getCoinMarketCapPathLabel = (path) => {
|
|
2154
|
+
if (path.includes("global-metrics")) return "global";
|
|
2155
|
+
if (path.includes("cryptocurrency/quotes")) return "reference";
|
|
2156
|
+
if (path.includes("exchange/quotes")) return "exchangeLiquidity";
|
|
2157
|
+
if (path.includes("fear-and-greed")) return "fearGreed";
|
|
2158
|
+
if (path.includes("cmc100")) return "cmc100";
|
|
2159
|
+
if (path.includes("cmc20")) return "cmc20";
|
|
2160
|
+
return path;
|
|
2161
|
+
};
|
|
2162
|
+
var recordCoinMarketCapFetchStats = (stats, path, creditCount) => {
|
|
2163
2163
|
if (!stats) return;
|
|
2164
|
-
const existing = stats.byPath.get(
|
|
2164
|
+
const existing = stats.byPath.get(path) ?? { requests: 0, credits: 0 };
|
|
2165
2165
|
existing.requests += 1;
|
|
2166
2166
|
existing.credits += creditCount ?? 0;
|
|
2167
2167
|
stats.requests += 1;
|
|
2168
2168
|
stats.totalCredits += creditCount ?? 0;
|
|
2169
|
-
stats.byPath.set(
|
|
2169
|
+
stats.byPath.set(path, existing);
|
|
2170
2170
|
};
|
|
2171
2171
|
var formatCoinMarketCapFetchStats = (stats) => {
|
|
2172
2172
|
const byPath = [...stats.byPath.entries()].map(
|
|
2173
|
-
([
|
|
2173
|
+
([path, item]) => `${getCoinMarketCapPathLabel(path)}=${item.requests}req/${item.credits}cr`
|
|
2174
2174
|
).join(" ");
|
|
2175
2175
|
return `apiRequests=${stats.requests} apiCredits=${stats.totalCredits}${byPath ? ` ${byPath}` : ""}`;
|
|
2176
2176
|
};
|
|
@@ -3930,105 +3930,7 @@ var logStrategySkipStats = (runtimeStrategies, strategyStats) => {
|
|
|
3930
3930
|
var import_redis2 = require("@tradejs/infra/redis");
|
|
3931
3931
|
|
|
3932
3932
|
// src/lib/runtimeLineage.ts
|
|
3933
|
-
var import_node_child_process = require("child_process");
|
|
3934
|
-
var import_node_crypto2 = require("crypto");
|
|
3935
|
-
var import_promises2 = __toESM(require("fs/promises"));
|
|
3936
|
-
var import_node_path2 = __toESM(require("path"));
|
|
3937
|
-
var import_types = require("@tradejs/types");
|
|
3938
|
-
var import_strategies3 = require("@tradejs/node/strategies");
|
|
3939
|
-
var import_strategyReleaseEvidence = require("@tradejs/infra/strategyReleaseEvidence");
|
|
3940
|
-
|
|
3941
|
-
// src/lib/strategyGateFingerprint.ts
|
|
3942
3933
|
var import_node_crypto = require("crypto");
|
|
3943
|
-
var import_node_module = require("module");
|
|
3944
|
-
var import_promises = __toESM(require("fs/promises"));
|
|
3945
|
-
var import_node_path = __toESM(require("path"));
|
|
3946
|
-
var toPackageToken = (strategyName) => strategyName.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3947
|
-
var getStrategyPackageName = (strategyName) => strategyName === "TrendLine" || strategyName === "ReverseTrendLine" ? "@tradejs/strategy-trend-line" : `@tradejs/strategy-${toPackageToken(strategyName)}`;
|
|
3948
|
-
var gateFingerprintSpecifiers = (strategyName) => [
|
|
3949
|
-
getStrategyPackageName(strategyName),
|
|
3950
|
-
"@tradejs/strategy-kit/ai-gate",
|
|
3951
|
-
"@tradejs/node/ai",
|
|
3952
|
-
"@tradejs/core/strategies"
|
|
3953
|
-
];
|
|
3954
|
-
var resolveStrategyGateFingerprint = async ({
|
|
3955
|
-
projectRoot,
|
|
3956
|
-
strategyName,
|
|
3957
|
-
gitSha
|
|
3958
|
-
}) => {
|
|
3959
|
-
const projectManifestPath = import_node_path.default.join(projectRoot, "package.json");
|
|
3960
|
-
const projectExists = await import_promises.default.access(projectManifestPath).then(() => true).catch(() => false);
|
|
3961
|
-
const requireFromProject = projectExists ? (0, import_node_module.createRequire)(projectManifestPath) : null;
|
|
3962
|
-
const candidates = requireFromProject ? await Promise.all(
|
|
3963
|
-
gateFingerprintSpecifiers(strategyName).map(async (specifier) => {
|
|
3964
|
-
let resolvedPath;
|
|
3965
|
-
try {
|
|
3966
|
-
resolvedPath = requireFromProject.resolve(specifier);
|
|
3967
|
-
} catch {
|
|
3968
|
-
return null;
|
|
3969
|
-
}
|
|
3970
|
-
const content = await import_promises.default.readFile(resolvedPath).catch(() => null);
|
|
3971
|
-
return content == null ? null : { specifier, content };
|
|
3972
|
-
})
|
|
3973
|
-
) : [];
|
|
3974
|
-
const sourceEntries = candidates.filter(
|
|
3975
|
-
(entry) => entry != null
|
|
3976
|
-
);
|
|
3977
|
-
const hash = (0, import_node_crypto.createHash)("sha256");
|
|
3978
|
-
hash.update(strategyName);
|
|
3979
|
-
if (sourceEntries.length) {
|
|
3980
|
-
for (const entry of sourceEntries) {
|
|
3981
|
-
hash.update(entry.specifier);
|
|
3982
|
-
hash.update(entry.content);
|
|
3983
|
-
}
|
|
3984
|
-
} else {
|
|
3985
|
-
hash.update(gitSha ?? "unknown-git-sha");
|
|
3986
|
-
}
|
|
3987
|
-
return {
|
|
3988
|
-
gateFingerprint: hash.digest("hex").slice(0, 16),
|
|
3989
|
-
gateFingerprintFiles: sourceEntries.map((entry) => entry.specifier)
|
|
3990
|
-
};
|
|
3991
|
-
};
|
|
3992
|
-
|
|
3993
|
-
// src/lib/runtimeLineage.ts
|
|
3994
|
-
var RUNTIME_CONTEXT_ENV_KEYS = [
|
|
3995
|
-
"AI_MODE",
|
|
3996
|
-
"MIN_AI_QUALITY",
|
|
3997
|
-
"INTERVAL",
|
|
3998
|
-
"DERIVATIVES_CONTEXT_ENABLED",
|
|
3999
|
-
"DERIVATIVES_CONTEXT_TARGET_ENABLED",
|
|
4000
|
-
"DERIVATIVES_CONTEXT_LOOKBACK_HOURS",
|
|
4001
|
-
"DERIVATIVES_CONTEXT_EXTRA_REFERENCE_SYMBOLS",
|
|
4002
|
-
"DERIVATIVES_CONTEXT_EXCHANGE_PRIORITY",
|
|
4003
|
-
"COINMARKETCAP_CONTEXT_ENABLED",
|
|
4004
|
-
"COINMARKETCAP_CONTEXT_MAX_AGE_MS",
|
|
4005
|
-
"COINMARKETCAP_CONTEXT_EXCHANGE_LIQUIDITY_ENABLED",
|
|
4006
|
-
"COINMARKETCAP_CONTEXT_EXCHANGE_SLUGS",
|
|
4007
|
-
"COINMARKETCAP_CONTEXT_FEAR_GREED_ENABLED",
|
|
4008
|
-
"COINMARKETCAP_CONTEXT_HISTORICAL_ACCESS_MONTHS",
|
|
4009
|
-
"COINMARKETCAP_CONTEXT_BACKFILL_ENABLED",
|
|
4010
|
-
"COINMARKETCAP_CONTEXT_BACKFILL_MAX_DAYS",
|
|
4011
|
-
"COINMARKETCAP_CONTEXT_BACKFILL_WARMUP_DAYS",
|
|
4012
|
-
"HYPERLIQUID_WHALE_CONTEXT_ENABLED",
|
|
4013
|
-
"HYPERLIQUID_WHALE_BACKFILL_ENABLED",
|
|
4014
|
-
"HYPERLIQUID_WHALE_MIN_COVERAGE_PCT",
|
|
4015
|
-
"HYPERLIQUID_WHALE_CONCURRENCY",
|
|
4016
|
-
"HYPERLIQUID_WHALE_RATE_LIMIT_WEIGHT"
|
|
4017
|
-
];
|
|
4018
|
-
var RUNTIME_CONTEXT_DATA_MODEL = {
|
|
4019
|
-
derivativesSourceIntervals: "15m",
|
|
4020
|
-
derivativesDerivedIntervals: "1h",
|
|
4021
|
-
derivativesHourlyFallback: "stored-1h",
|
|
4022
|
-
derivativesDataModelVersion: 2,
|
|
4023
|
-
coinMarketCapAvailabilityModel: "closed-interval-all-daily",
|
|
4024
|
-
coinMarketCapDataModelVersion: 3,
|
|
4025
|
-
binanceBreadthUniverseModel: "fixed-versioned-top5-top10-top30-top50-top100",
|
|
4026
|
-
binanceBreadthDataModelVersion: 2,
|
|
4027
|
-
hyperliquidWhaleCanonicalInterval: "1m",
|
|
4028
|
-
hyperliquidWhaleGateMinNotionalUsd: 5e4,
|
|
4029
|
-
hyperliquidWhaleMinCoveragePct: 0.8,
|
|
4030
|
-
hyperliquidWhaleDataModelVersion: import_types.HYPERLIQUID_WHALE_DATA_MODEL_VERSION
|
|
4031
|
-
};
|
|
4032
3934
|
var normalizeForStableJson = (value) => {
|
|
4033
3935
|
if (Array.isArray(value)) {
|
|
4034
3936
|
return value.map(normalizeForStableJson);
|
|
@@ -4053,210 +3955,48 @@ var resolveRuntimeMaxLossValue = (config2) => {
|
|
|
4053
3955
|
);
|
|
4054
3956
|
return Number.isFinite(maxLossValue) ? maxLossValue : null;
|
|
4055
3957
|
};
|
|
4056
|
-
var fingerprintRuntimeValue = (value) => (0,
|
|
4057
|
-
var
|
|
4058
|
-
var gateFingerprintCache = /* @__PURE__ */ new Map();
|
|
4059
|
-
var binanceBreadthFingerprintCache = /* @__PURE__ */ new Map();
|
|
4060
|
-
var snapshotFingerprintCache = /* @__PURE__ */ new Map();
|
|
4061
|
-
var resolveGitLineage = (projectRoot) => {
|
|
4062
|
-
const cached = gitLineageCache.get(projectRoot);
|
|
4063
|
-
if (cached) {
|
|
4064
|
-
return cached;
|
|
4065
|
-
}
|
|
4066
|
-
const envSha = String(process.env.TRADEJS_GIT_SHA ?? "").trim();
|
|
4067
|
-
if (envSha && envSha !== "unknown") {
|
|
4068
|
-
const result = {
|
|
4069
|
-
gitSha: envSha,
|
|
4070
|
-
gitDirty: false
|
|
4071
|
-
};
|
|
4072
|
-
gitLineageCache.set(projectRoot, result);
|
|
4073
|
-
return result;
|
|
4074
|
-
}
|
|
4075
|
-
try {
|
|
4076
|
-
const gitSha = (0, import_node_child_process.execFileSync)("git", ["rev-parse", "HEAD"], {
|
|
4077
|
-
cwd: projectRoot,
|
|
4078
|
-
encoding: "utf8",
|
|
4079
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
4080
|
-
}).trim();
|
|
4081
|
-
const status = (0, import_node_child_process.execFileSync)(
|
|
4082
|
-
"git",
|
|
4083
|
-
["status", "--porcelain", "--untracked-files=normal"],
|
|
4084
|
-
{
|
|
4085
|
-
cwd: projectRoot,
|
|
4086
|
-
encoding: "utf8",
|
|
4087
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
4088
|
-
}
|
|
4089
|
-
).trim();
|
|
4090
|
-
const result = {
|
|
4091
|
-
gitSha: gitSha || null,
|
|
4092
|
-
gitDirty: status.length > 0
|
|
4093
|
-
};
|
|
4094
|
-
gitLineageCache.set(projectRoot, result);
|
|
4095
|
-
return result;
|
|
4096
|
-
} catch {
|
|
4097
|
-
const result = {
|
|
4098
|
-
gitSha: null,
|
|
4099
|
-
gitDirty: null
|
|
4100
|
-
};
|
|
4101
|
-
gitLineageCache.set(projectRoot, result);
|
|
4102
|
-
return result;
|
|
4103
|
-
}
|
|
4104
|
-
};
|
|
4105
|
-
var readOptionalFile = async (filePath) => {
|
|
4106
|
-
try {
|
|
4107
|
-
return await import_promises2.default.readFile(filePath);
|
|
4108
|
-
} catch {
|
|
4109
|
-
return null;
|
|
4110
|
-
}
|
|
4111
|
-
};
|
|
4112
|
-
var resolveBinanceBreadthFingerprint = async (projectRoot) => {
|
|
4113
|
-
if (binanceBreadthFingerprintCache.has(projectRoot)) {
|
|
4114
|
-
return binanceBreadthFingerprintCache.get(projectRoot) ?? null;
|
|
4115
|
-
}
|
|
4116
|
-
const content = await readOptionalFile(
|
|
4117
|
-
import_node_path2.default.join(
|
|
4118
|
-
projectRoot,
|
|
4119
|
-
"packages/node/src/config/binanceBreadthUniverses.json"
|
|
4120
|
-
)
|
|
4121
|
-
);
|
|
4122
|
-
let result = null;
|
|
4123
|
-
if (content) {
|
|
4124
|
-
try {
|
|
4125
|
-
const parsed = JSON.parse(content.toString("utf8"));
|
|
4126
|
-
result = typeof parsed.fingerprint === "string" && parsed.fingerprint.trim() ? parsed.fingerprint.trim() : null;
|
|
4127
|
-
} catch {
|
|
4128
|
-
result = null;
|
|
4129
|
-
}
|
|
4130
|
-
}
|
|
4131
|
-
binanceBreadthFingerprintCache.set(projectRoot, result);
|
|
4132
|
-
return result;
|
|
4133
|
-
};
|
|
4134
|
-
var resolveSnapshotFingerprint = async (projectRoot, relativePath) => {
|
|
4135
|
-
const cacheKey = `${projectRoot}:${relativePath}`;
|
|
4136
|
-
if (snapshotFingerprintCache.has(cacheKey)) {
|
|
4137
|
-
return snapshotFingerprintCache.get(cacheKey) ?? null;
|
|
4138
|
-
}
|
|
4139
|
-
const content = await readOptionalFile(import_node_path2.default.join(projectRoot, relativePath));
|
|
4140
|
-
let result = null;
|
|
4141
|
-
if (content) {
|
|
4142
|
-
try {
|
|
4143
|
-
const parsed = JSON.parse(content.toString("utf8"));
|
|
4144
|
-
result = typeof parsed.fingerprint === "string" && parsed.fingerprint.trim() ? parsed.fingerprint.trim() : null;
|
|
4145
|
-
} catch {
|
|
4146
|
-
result = null;
|
|
4147
|
-
}
|
|
4148
|
-
}
|
|
4149
|
-
snapshotFingerprintCache.set(cacheKey, result);
|
|
4150
|
-
return result;
|
|
4151
|
-
};
|
|
4152
|
-
var resolveRuntimeGateFingerprint = async ({
|
|
4153
|
-
projectRoot,
|
|
4154
|
-
strategyName,
|
|
4155
|
-
gitSha
|
|
4156
|
-
}) => {
|
|
4157
|
-
const cacheKey = `${projectRoot}:${strategyName}:${gitSha ?? "unknown"}`;
|
|
4158
|
-
const cached = gateFingerprintCache.get(cacheKey);
|
|
4159
|
-
if (cached) return cached;
|
|
4160
|
-
const result = await resolveStrategyGateFingerprint({
|
|
4161
|
-
projectRoot,
|
|
4162
|
-
strategyName,
|
|
4163
|
-
gitSha
|
|
4164
|
-
});
|
|
4165
|
-
gateFingerprintCache.set(cacheKey, result);
|
|
4166
|
-
return result;
|
|
4167
|
-
};
|
|
4168
|
-
async function buildRuntimeLineage({
|
|
4169
|
-
projectRoot,
|
|
4170
|
-
strategyName,
|
|
4171
|
-
compositionId,
|
|
3958
|
+
var fingerprintRuntimeValue = (value) => (0, import_node_crypto.createHash)("sha256").update(JSON.stringify(normalizeForStableJson(value))).digest("hex").slice(0, 16);
|
|
3959
|
+
var buildRuntimeLineage = async ({
|
|
4172
3960
|
strategyRevision,
|
|
4173
3961
|
deploymentCompositionId,
|
|
4174
3962
|
strategyPackageVersion,
|
|
4175
3963
|
strategyDependencyVersions,
|
|
4176
3964
|
runtimePackageVersion,
|
|
4177
|
-
config: config2
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
})
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
([name, version]) => !name.startsWith("@tradejs/") || typeof version !== "string" || !version.trim()
|
|
4195
|
-
)) {
|
|
4196
|
-
throw new Error("Invalid strategy dependency versions");
|
|
4197
|
-
}
|
|
4198
|
-
return {
|
|
4199
|
-
schemaVersion: 3,
|
|
4200
|
-
strategyRevision,
|
|
4201
|
-
deploymentCompositionId,
|
|
4202
|
-
strategyPackageVersion,
|
|
4203
|
-
strategyDependencyVersions,
|
|
4204
|
-
runtimePackageVersion,
|
|
4205
|
-
maxLossValue: resolveRuntimeMaxLossValue(config2)
|
|
4206
|
-
};
|
|
3965
|
+
config: config2
|
|
3966
|
+
}) => {
|
|
3967
|
+
if (!/^sr1:[a-f0-9]{16}$/.test(strategyRevision)) {
|
|
3968
|
+
throw new Error(`Invalid strategy revision: ${strategyRevision}`);
|
|
3969
|
+
}
|
|
3970
|
+
if (!/^dc1:[a-f0-9]{16}$/.test(deploymentCompositionId)) {
|
|
3971
|
+
throw new Error(
|
|
3972
|
+
`Invalid deployment composition id: ${deploymentCompositionId}`
|
|
3973
|
+
);
|
|
3974
|
+
}
|
|
3975
|
+
if (!strategyPackageVersion.trim() || !runtimePackageVersion.trim()) {
|
|
3976
|
+
throw new Error("Invalid revision package versions");
|
|
3977
|
+
}
|
|
3978
|
+
if (Object.keys(strategyDependencyVersions).length === 0 || Object.entries(strategyDependencyVersions).some(
|
|
3979
|
+
([name, version]) => !name.startsWith("@tradejs/") || typeof version !== "string" || !version.trim()
|
|
3980
|
+
)) {
|
|
3981
|
+
throw new Error("Invalid strategy dependency versions");
|
|
4207
3982
|
}
|
|
4208
|
-
const git = resolveGitLineage(projectRoot);
|
|
4209
|
-
const hyperliquidPerpUniverseFingerprint = typeof import_strategies3.getHyperliquidPerpUniverseSnapshot === "function" ? (0, import_strategies3.getHyperliquidPerpUniverseSnapshot)().fingerprint : await resolveSnapshotFingerprint(
|
|
4210
|
-
projectRoot,
|
|
4211
|
-
"packages/node/src/config/hyperliquidPerpUniverse.json"
|
|
4212
|
-
);
|
|
4213
|
-
const hyperliquidWhaleRegistryFingerprint = typeof import_strategies3.getHyperliquidWhaleRegistrySnapshot === "function" ? (0, import_strategies3.getHyperliquidWhaleRegistrySnapshot)().fingerprint : await resolveSnapshotFingerprint(
|
|
4214
|
-
projectRoot,
|
|
4215
|
-
"packages/node/src/config/hyperliquidWhales.json"
|
|
4216
|
-
);
|
|
4217
|
-
const context = {
|
|
4218
|
-
...Object.fromEntries(
|
|
4219
|
-
RUNTIME_CONTEXT_ENV_KEYS.map((key) => [key, env[key] ?? null])
|
|
4220
|
-
),
|
|
4221
|
-
...RUNTIME_CONTEXT_DATA_MODEL,
|
|
4222
|
-
binanceBreadthUniverseFingerprint: await resolveBinanceBreadthFingerprint(projectRoot),
|
|
4223
|
-
hyperliquidPerpUniverseFingerprint,
|
|
4224
|
-
hyperliquidWhaleRegistryFingerprint,
|
|
4225
|
-
...runContext
|
|
4226
|
-
};
|
|
4227
3983
|
return {
|
|
4228
|
-
schemaVersion:
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
gitSha: git.gitSha
|
|
4235
|
-
})).gateFingerprint,
|
|
4236
|
-
// Position risk is tracked separately so changing trade size does not
|
|
4237
|
-
// masquerade as a change to the core + gate decision logic.
|
|
4238
|
-
configFingerprint: (0, import_strategyReleaseEvidence.strategyLogicConfigFingerprint)(config2),
|
|
4239
|
-
contextFingerprint: fingerprintRuntimeValue(context),
|
|
3984
|
+
schemaVersion: 3,
|
|
3985
|
+
strategyRevision,
|
|
3986
|
+
deploymentCompositionId,
|
|
3987
|
+
strategyPackageVersion,
|
|
3988
|
+
strategyDependencyVersions,
|
|
3989
|
+
runtimePackageVersion,
|
|
4240
3990
|
maxLossValue: resolveRuntimeMaxLossValue(config2)
|
|
4241
3991
|
};
|
|
4242
|
-
}
|
|
4243
|
-
var runtimeLineageKey = (lineage) =>
|
|
3992
|
+
};
|
|
3993
|
+
var runtimeLineageKey = (lineage) => [
|
|
4244
3994
|
"v3",
|
|
4245
3995
|
lineage.deploymentCompositionId,
|
|
4246
3996
|
lineage.strategyRevision,
|
|
4247
3997
|
lineage.strategyPackageVersion,
|
|
4248
|
-
`deps:${fingerprintRuntimeValue(
|
|
4249
|
-
lineage.strategyDependencyVersions
|
|
4250
|
-
).slice(0, 16)}`,
|
|
3998
|
+
`deps:${fingerprintRuntimeValue(lineage.strategyDependencyVersions).slice(0, 16)}`,
|
|
4251
3999
|
lineage.runtimePackageVersion
|
|
4252
|
-
].join(":") : [
|
|
4253
|
-
lineage.schemaVersion,
|
|
4254
|
-
lineage.compositionId ?? "unbound-composition",
|
|
4255
|
-
lineage.gitSha ?? "unknown",
|
|
4256
|
-
lineage.gitDirty == null ? "unknown" : lineage.gitDirty ? "dirty" : "clean",
|
|
4257
|
-
lineage.gateFingerprint,
|
|
4258
|
-
lineage.configFingerprint,
|
|
4259
|
-
lineage.contextFingerprint
|
|
4260
4000
|
].join(":");
|
|
4261
4001
|
|
|
4262
4002
|
// src/lib/signals/evaluations.ts
|
|
@@ -4804,7 +4544,7 @@ var createSignalsKlineFeed = async ({
|
|
|
4804
4544
|
};
|
|
4805
4545
|
|
|
4806
4546
|
// src/lib/signals/tickerEvaluator.ts
|
|
4807
|
-
var
|
|
4547
|
+
var import_strategies3 = require("@tradejs/node/strategies");
|
|
4808
4548
|
var import_logger3 = require("@tradejs/infra/logger");
|
|
4809
4549
|
|
|
4810
4550
|
// src/lib/runtimeModeConfig.ts
|
|
@@ -4828,7 +4568,6 @@ var buildRuntimeModeStrategyConfig = ({
|
|
|
4828
4568
|
var createSignalsTickerEvaluator = ({
|
|
4829
4569
|
userName,
|
|
4830
4570
|
makeOrders,
|
|
4831
|
-
projectRoot,
|
|
4832
4571
|
context
|
|
4833
4572
|
}) => async (symbol, instrument) => {
|
|
4834
4573
|
const {
|
|
@@ -4900,19 +4639,12 @@ var createSignalsTickerEvaluator = ({
|
|
|
4900
4639
|
makeOrders
|
|
4901
4640
|
});
|
|
4902
4641
|
const runtimeLineage = await buildRuntimeLineage({
|
|
4903
|
-
projectRoot,
|
|
4904
|
-
strategyName,
|
|
4905
4642
|
strategyRevision,
|
|
4906
4643
|
deploymentCompositionId,
|
|
4907
4644
|
strategyPackageVersion,
|
|
4908
4645
|
strategyDependencyVersions,
|
|
4909
4646
|
runtimePackageVersion,
|
|
4910
|
-
config: { strategyConfig }
|
|
4911
|
-
runContext: {
|
|
4912
|
-
connectorName: connectorName.toLowerCase(),
|
|
4913
|
-
interval: String(interval),
|
|
4914
|
-
universe
|
|
4915
|
-
}
|
|
4647
|
+
config: { strategyConfig }
|
|
4916
4648
|
});
|
|
4917
4649
|
const lifecycleKey = buildSignalsStrategyLifecycleKey({
|
|
4918
4650
|
connectorName,
|
|
@@ -5038,7 +4770,7 @@ var createSignalsTickerEvaluator = ({
|
|
|
5038
4770
|
if (signalRuntimeIdentity && !signal.signalId.endsWith(`:${signalRuntimeIdentity}`)) {
|
|
5039
4771
|
signal.signalId = `${signal.signalId}:${signalRuntimeIdentity}`;
|
|
5040
4772
|
}
|
|
5041
|
-
await (0,
|
|
4773
|
+
await (0, import_strategies3.enrichSignalWithBinanceMarketContext)({ signal, env: "CRON" });
|
|
5042
4774
|
if (signal.orderStatus === "skipped" && typeof signal.orderSkipReason === "string" && signal.orderSkipReason.trim()) {
|
|
5043
4775
|
recordStrategyReason(
|
|
5044
4776
|
strategyStats,
|
|
@@ -5200,7 +4932,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5200
4932
|
const createDefaultSignalsLifecycle = (runtimeInterval = interval) => createSignalsStrategyLifecycle({
|
|
5201
4933
|
intervalMs: Number(runtimeInterval) * 6e4,
|
|
5202
4934
|
maxLiveBars: resolveSignalsDaemonMaxLiveBars(runtimeInterval),
|
|
5203
|
-
releaseState:
|
|
4935
|
+
releaseState: import_strategies4.releaseStrategyReplayCache
|
|
5204
4936
|
});
|
|
5205
4937
|
const timeOperation2 = (label, operation) => timeOperation(
|
|
5206
4938
|
label,
|
|
@@ -5552,7 +5284,6 @@ var createSignalsRunner = (config2) => {
|
|
|
5552
5284
|
const evaluateTicker = createSignalsTickerEvaluator({
|
|
5553
5285
|
userName: config2.userName,
|
|
5554
5286
|
makeOrders: config2.makeOrders,
|
|
5555
|
-
projectRoot,
|
|
5556
5287
|
context: {
|
|
5557
5288
|
connectorName,
|
|
5558
5289
|
connector: marketConnector,
|
|
@@ -5606,7 +5337,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5606
5337
|
new Map(
|
|
5607
5338
|
runtimeStrategies.map(({ strategyName, strategyConfig }) => [
|
|
5608
5339
|
strategyName,
|
|
5609
|
-
(0,
|
|
5340
|
+
(0, import_strategies4.mapAiRuntimeFromConfig)({
|
|
5610
5341
|
AI_ENABLED: strategyConfig.AI_ENABLED,
|
|
5611
5342
|
AI_MODE: strategyConfig.AI_MODE,
|
|
5612
5343
|
MIN_AI_QUALITY: strategyConfig.MIN_AI_QUALITY
|