@tradejs/node 3.1.0 → 3.1.1
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/README.md +2 -0
- package/dist/ai.js +1 -0
- package/dist/ai.mjs +2 -1
- package/dist/backtest.js +19 -0
- package/dist/backtest.mjs +5 -3
- package/dist/{chunk-KOQSLFT2.mjs → chunk-SEQJ6V6B.mjs} +2 -283
- package/dist/{chunk-MKLTJQLY.mjs → chunk-W26Y6IRP.mjs} +22 -3
- package/dist/chunk-XN7BC7XK.mjs +295 -0
- package/dist/cli.js +2 -0
- package/dist/cli.mjs +4 -2
- package/dist/registry-DHTLjQcr.d.mts +17 -0
- package/dist/registry-DHTLjQcr.d.ts +17 -0
- package/dist/registry.d.mts +2 -16
- package/dist/registry.d.ts +2 -16
- package/dist/registry.js +19 -0
- package/dist/registry.mjs +3 -2
- package/dist/runtimeDashboard.js +93 -24
- package/dist/runtimeDashboard.mjs +71 -26
- package/dist/runtimeStrategies.d.mts +38 -0
- package/dist/runtimeStrategies.d.ts +38 -0
- package/dist/runtimeStrategies.js +798 -0
- package/dist/runtimeStrategies.mjs +264 -0
- package/dist/strategies.d.mts +1 -1
- package/dist/strategies.d.ts +1 -1
- package/dist/strategies.js +26 -0
- package/dist/strategies.mjs +14 -10
- package/package.json +13 -5
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTradejsProjectCwd,
|
|
3
|
+
importTradejsModule,
|
|
4
|
+
loadTradejsConfig,
|
|
5
|
+
resolvePluginModuleSpecifier
|
|
6
|
+
} from "./chunk-WS5DYEVZ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/strategy/manifests.ts
|
|
9
|
+
import {
|
|
10
|
+
registerIndicatorEntries,
|
|
11
|
+
resetIndicatorRegistryCache
|
|
12
|
+
} from "@tradejs/core/indicators";
|
|
13
|
+
import { logger } from "@tradejs/infra/logger";
|
|
14
|
+
var SHARED_STRATEGY_REGISTRY_KEY = "__tradejsNodeSharedStrategyRegistryV1__";
|
|
15
|
+
var sharedRegistryScope = globalThis;
|
|
16
|
+
var sharedStrategyRegistry = sharedRegistryScope[SHARED_STRATEGY_REGISTRY_KEY] ?? (sharedRegistryScope[SHARED_STRATEGY_REGISTRY_KEY] = {
|
|
17
|
+
registryStateByProjectRoot: /* @__PURE__ */ new Map()
|
|
18
|
+
});
|
|
19
|
+
var createStrategyRegistryState = () => ({
|
|
20
|
+
strategyCreators: /* @__PURE__ */ new Map(),
|
|
21
|
+
strategyManifestsMap: /* @__PURE__ */ new Map(),
|
|
22
|
+
strategyEntriesMap: /* @__PURE__ */ new Map(),
|
|
23
|
+
strategySourcesMap: /* @__PURE__ */ new Map(),
|
|
24
|
+
pluginsLoadPromise: null
|
|
25
|
+
});
|
|
26
|
+
var registryStateByProjectRoot = sharedStrategyRegistry.registryStateByProjectRoot;
|
|
27
|
+
var getStrategyRegistryState = (cwd = getTradejsProjectCwd()) => {
|
|
28
|
+
const projectRoot = getTradejsProjectCwd(cwd);
|
|
29
|
+
let state = registryStateByProjectRoot.get(projectRoot);
|
|
30
|
+
if (!state) {
|
|
31
|
+
state = createStrategyRegistryState();
|
|
32
|
+
registryStateByProjectRoot.set(projectRoot, state);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
projectRoot,
|
|
36
|
+
state
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var toUniqueModules = (modules = []) => [
|
|
40
|
+
...new Set(modules.map((moduleName) => moduleName.trim()).filter(Boolean))
|
|
41
|
+
];
|
|
42
|
+
var getConfiguredPluginModuleNames = async (cwd = getTradejsProjectCwd()) => {
|
|
43
|
+
const config = await loadTradejsConfig(cwd);
|
|
44
|
+
return {
|
|
45
|
+
strategyModules: toUniqueModules(config.strategies),
|
|
46
|
+
indicatorModules: toUniqueModules(config.indicators)
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var extractModuleEntries = (moduleExport, key) => {
|
|
50
|
+
if (!moduleExport || typeof moduleExport !== "object") {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const candidate = moduleExport;
|
|
54
|
+
if (Array.isArray(candidate[key])) {
|
|
55
|
+
return candidate[key];
|
|
56
|
+
}
|
|
57
|
+
const defaultExport = candidate.default;
|
|
58
|
+
if (defaultExport && Array.isArray(defaultExport[key])) {
|
|
59
|
+
return defaultExport[key];
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
var extractStrategyPluginDefinition = (moduleExport) => {
|
|
64
|
+
const strategyEntries = extractModuleEntries(
|
|
65
|
+
moduleExport,
|
|
66
|
+
"strategyEntries"
|
|
67
|
+
);
|
|
68
|
+
return strategyEntries ? { strategyEntries } : null;
|
|
69
|
+
};
|
|
70
|
+
var extractIndicatorPluginDefinition = (moduleExport) => {
|
|
71
|
+
const indicatorEntries = extractModuleEntries(
|
|
72
|
+
moduleExport,
|
|
73
|
+
"indicatorEntries"
|
|
74
|
+
);
|
|
75
|
+
return indicatorEntries ? { indicatorEntries } : null;
|
|
76
|
+
};
|
|
77
|
+
var registerEntries = (entries, source, state) => {
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
const strategyName = entry.manifest?.name;
|
|
80
|
+
if (!strategyName) {
|
|
81
|
+
logger.warn("Skip strategy entry without name from %s", source);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (state.strategyCreators.has(strategyName)) {
|
|
85
|
+
logger.warn(
|
|
86
|
+
'Skip duplicate strategy "%s" from %s: already registered',
|
|
87
|
+
strategyName,
|
|
88
|
+
source
|
|
89
|
+
);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
state.strategyManifestsMap.set(strategyName, entry.manifest);
|
|
93
|
+
state.strategyEntriesMap.set(strategyName, entry);
|
|
94
|
+
state.strategySourcesMap.set(strategyName, source);
|
|
95
|
+
materializeStrategyCreator(strategyName, state);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var materializeStrategyCreator = (strategyName, state) => {
|
|
99
|
+
if (state.strategyCreators.has(strategyName) || !sharedStrategyRegistry.strategyRuntimeFactory) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const entry = state.strategyEntriesMap.get(strategyName);
|
|
103
|
+
if (!entry) return;
|
|
104
|
+
state.strategyCreators.set(
|
|
105
|
+
strategyName,
|
|
106
|
+
sharedStrategyRegistry.strategyRuntimeFactory({
|
|
107
|
+
strategyName,
|
|
108
|
+
defaults: entry.defaults,
|
|
109
|
+
createCore: entry.createCore,
|
|
110
|
+
manifest: entry.manifest,
|
|
111
|
+
detectorKey: entry.detectorKey,
|
|
112
|
+
detectorNoSignalSkipReason: entry.detectorNoSignalSkipReason,
|
|
113
|
+
resolveRegisteredManifest: (name) => state.strategyManifestsMap.get(name)
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
var setStrategyRuntimeFactory = (factory) => {
|
|
118
|
+
sharedStrategyRegistry.strategyRuntimeFactory = factory;
|
|
119
|
+
for (const state of registryStateByProjectRoot.values()) {
|
|
120
|
+
for (const strategyName of state.strategyEntriesMap.keys()) {
|
|
121
|
+
materializeStrategyCreator(strategyName, state);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var importStrategyPluginModule = async (moduleName, cwd = getTradejsProjectCwd()) => {
|
|
126
|
+
if (typeof importTradejsModule === "function") {
|
|
127
|
+
return importTradejsModule(moduleName, cwd);
|
|
128
|
+
}
|
|
129
|
+
return import(
|
|
130
|
+
/* webpackIgnore: true */
|
|
131
|
+
moduleName
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
var ensureStrategyPluginsLoaded = async (cwd = getTradejsProjectCwd()) => {
|
|
135
|
+
const { projectRoot, state } = getStrategyRegistryState(cwd);
|
|
136
|
+
if (!state.pluginsLoadPromise) {
|
|
137
|
+
resetIndicatorRegistryCache(projectRoot);
|
|
138
|
+
state.pluginsLoadPromise = (async () => {
|
|
139
|
+
const { strategyModules, indicatorModules } = await getConfiguredPluginModuleNames(projectRoot);
|
|
140
|
+
const strategySet = new Set(strategyModules);
|
|
141
|
+
const indicatorSet = new Set(indicatorModules);
|
|
142
|
+
const pluginModuleNames = [
|
|
143
|
+
.../* @__PURE__ */ new Set([...strategyModules, ...indicatorModules])
|
|
144
|
+
];
|
|
145
|
+
if (!pluginModuleNames.length) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
for (const moduleName of pluginModuleNames) {
|
|
149
|
+
try {
|
|
150
|
+
const resolvedModuleName = resolvePluginModuleSpecifier(
|
|
151
|
+
moduleName,
|
|
152
|
+
projectRoot
|
|
153
|
+
);
|
|
154
|
+
const moduleExport = await importStrategyPluginModule(
|
|
155
|
+
resolvedModuleName,
|
|
156
|
+
projectRoot
|
|
157
|
+
);
|
|
158
|
+
if (strategySet.has(moduleName)) {
|
|
159
|
+
const pluginDefinition = extractStrategyPluginDefinition(moduleExport);
|
|
160
|
+
if (!pluginDefinition) {
|
|
161
|
+
logger.warn(
|
|
162
|
+
'Skip strategy plugin "%s": export { strategyEntries } is missing',
|
|
163
|
+
moduleName
|
|
164
|
+
);
|
|
165
|
+
} else {
|
|
166
|
+
registerEntries(
|
|
167
|
+
pluginDefinition.strategyEntries,
|
|
168
|
+
moduleName,
|
|
169
|
+
state
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (indicatorSet.has(moduleName)) {
|
|
174
|
+
const indicatorPluginDefinition = extractIndicatorPluginDefinition(moduleExport);
|
|
175
|
+
if (!indicatorPluginDefinition) {
|
|
176
|
+
logger.warn(
|
|
177
|
+
'Skip indicator plugin "%s": export { indicatorEntries } is missing',
|
|
178
|
+
moduleName
|
|
179
|
+
);
|
|
180
|
+
} else {
|
|
181
|
+
registerIndicatorEntries(
|
|
182
|
+
indicatorPluginDefinition.indicatorEntries,
|
|
183
|
+
moduleName,
|
|
184
|
+
projectRoot
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!strategySet.has(moduleName) && !indicatorSet.has(moduleName)) {
|
|
189
|
+
logger.warn(
|
|
190
|
+
'Skip plugin "%s": no strategy/indicator sections requested in config',
|
|
191
|
+
moduleName
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
} catch (error) {
|
|
195
|
+
logger.warn(
|
|
196
|
+
'Failed to load plugin "%s": %s',
|
|
197
|
+
moduleName,
|
|
198
|
+
String(error)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
})();
|
|
203
|
+
}
|
|
204
|
+
await state.pluginsLoadPromise;
|
|
205
|
+
};
|
|
206
|
+
var ensureIndicatorPluginsLoaded = async (cwd = getTradejsProjectCwd()) => ensureStrategyPluginsLoaded(cwd);
|
|
207
|
+
var getStrategyCreator = async (name, cwd = getTradejsProjectCwd()) => {
|
|
208
|
+
await ensureStrategyPluginsLoaded(cwd);
|
|
209
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
210
|
+
return state.strategyCreators.get(name);
|
|
211
|
+
};
|
|
212
|
+
var getStrategyDefaults = async (name, cwd = getTradejsProjectCwd()) => {
|
|
213
|
+
await ensureStrategyPluginsLoaded(cwd);
|
|
214
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
215
|
+
return state.strategyEntriesMap.get(name)?.defaults;
|
|
216
|
+
};
|
|
217
|
+
var getStrategyPluginSource = async (name, cwd = getTradejsProjectCwd()) => {
|
|
218
|
+
await ensureStrategyPluginsLoaded(cwd);
|
|
219
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
220
|
+
return state.strategySourcesMap.get(name);
|
|
221
|
+
};
|
|
222
|
+
var getAvailableStrategyNames = async (cwd = getTradejsProjectCwd()) => {
|
|
223
|
+
await ensureStrategyPluginsLoaded(cwd);
|
|
224
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
225
|
+
return [...state.strategyCreators.keys()].sort((a, b) => a.localeCompare(b));
|
|
226
|
+
};
|
|
227
|
+
var getRegisteredStrategies = (cwd = getTradejsProjectCwd()) => {
|
|
228
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
229
|
+
return Object.fromEntries(state.strategyCreators.entries());
|
|
230
|
+
};
|
|
231
|
+
var getRegisteredManifests = (cwd = getTradejsProjectCwd()) => {
|
|
232
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
233
|
+
return [...state.strategyManifestsMap.values()];
|
|
234
|
+
};
|
|
235
|
+
var getStrategyManifest = (name, cwd = getTradejsProjectCwd()) => {
|
|
236
|
+
if (!name) {
|
|
237
|
+
return void 0;
|
|
238
|
+
}
|
|
239
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
240
|
+
return state.strategyManifestsMap.get(name);
|
|
241
|
+
};
|
|
242
|
+
var isKnownStrategy = (name, cwd = getTradejsProjectCwd()) => {
|
|
243
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
244
|
+
return state.strategyCreators.has(name);
|
|
245
|
+
};
|
|
246
|
+
var registerStrategyEntries = (entries, cwd = getTradejsProjectCwd()) => {
|
|
247
|
+
const { state } = getStrategyRegistryState(cwd);
|
|
248
|
+
registerEntries(entries, "runtime", state);
|
|
249
|
+
};
|
|
250
|
+
var resetStrategyRegistryCache = (cwd) => {
|
|
251
|
+
const normalizedCwd = String(cwd ?? "").trim();
|
|
252
|
+
if (!normalizedCwd) {
|
|
253
|
+
registryStateByProjectRoot.clear();
|
|
254
|
+
resetIndicatorRegistryCache();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const projectRoot = getTradejsProjectCwd(normalizedCwd);
|
|
258
|
+
registryStateByProjectRoot.delete(projectRoot);
|
|
259
|
+
resetIndicatorRegistryCache(projectRoot);
|
|
260
|
+
};
|
|
261
|
+
var strategies = new Proxy(
|
|
262
|
+
{},
|
|
263
|
+
{
|
|
264
|
+
get: (_target, property) => {
|
|
265
|
+
if (typeof property !== "string") {
|
|
266
|
+
return void 0;
|
|
267
|
+
}
|
|
268
|
+
return getStrategyRegistryState().state.strategyCreators.get(property);
|
|
269
|
+
},
|
|
270
|
+
ownKeys: () => {
|
|
271
|
+
return [...getStrategyRegistryState().state.strategyCreators.keys()];
|
|
272
|
+
},
|
|
273
|
+
getOwnPropertyDescriptor: () => ({
|
|
274
|
+
enumerable: true,
|
|
275
|
+
configurable: true
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
export {
|
|
281
|
+
setStrategyRuntimeFactory,
|
|
282
|
+
ensureStrategyPluginsLoaded,
|
|
283
|
+
ensureIndicatorPluginsLoaded,
|
|
284
|
+
getStrategyCreator,
|
|
285
|
+
getStrategyDefaults,
|
|
286
|
+
getStrategyPluginSource,
|
|
287
|
+
getAvailableStrategyNames,
|
|
288
|
+
getRegisteredStrategies,
|
|
289
|
+
getRegisteredManifests,
|
|
290
|
+
getStrategyManifest,
|
|
291
|
+
isKnownStrategy,
|
|
292
|
+
registerStrategyEntries,
|
|
293
|
+
resetStrategyRegistryCache,
|
|
294
|
+
strategies
|
|
295
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -952,6 +952,7 @@ var createStrategyRegistryState = () => ({
|
|
|
952
952
|
strategyCreators: /* @__PURE__ */ new Map(),
|
|
953
953
|
strategyManifestsMap: /* @__PURE__ */ new Map(),
|
|
954
954
|
strategyEntriesMap: /* @__PURE__ */ new Map(),
|
|
955
|
+
strategySourcesMap: /* @__PURE__ */ new Map(),
|
|
955
956
|
pluginsLoadPromise: null
|
|
956
957
|
});
|
|
957
958
|
var registryStateByProjectRoot = sharedStrategyRegistry.registryStateByProjectRoot;
|
|
@@ -1022,6 +1023,7 @@ var registerEntries = (entries, source, state) => {
|
|
|
1022
1023
|
}
|
|
1023
1024
|
state.strategyManifestsMap.set(strategyName, entry.manifest);
|
|
1024
1025
|
state.strategyEntriesMap.set(strategyName, entry);
|
|
1026
|
+
state.strategySourcesMap.set(strategyName, source);
|
|
1025
1027
|
materializeStrategyCreator(strategyName, state);
|
|
1026
1028
|
}
|
|
1027
1029
|
};
|
package/dist/cli.mjs
CHANGED
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
SCREENSHOT_CONCURRENCY_LIMIT
|
|
5
5
|
} from "./chunk-KMJQQ53K.mjs";
|
|
6
6
|
import {
|
|
7
|
-
askAI
|
|
7
|
+
askAI
|
|
8
|
+
} from "./chunk-SEQJ6V6B.mjs";
|
|
9
|
+
import {
|
|
8
10
|
ensureStrategyPluginsLoaded
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XN7BC7XK.mjs";
|
|
10
12
|
import {
|
|
11
13
|
getTradejsProjectCwd,
|
|
12
14
|
loadTradejsConfig
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StrategyManifest, StrategyCreator, StrategyRegistryEntry } from '@tradejs/types';
|
|
2
|
+
|
|
3
|
+
declare const ensureStrategyPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
4
|
+
declare const ensureIndicatorPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
5
|
+
declare const getStrategyCreator: (name: string, cwd?: string) => Promise<StrategyCreator | undefined>;
|
|
6
|
+
declare const getStrategyDefaults: (name: string, cwd?: string) => Promise<StrategyRegistryEntry["defaults"] | undefined>;
|
|
7
|
+
declare const getStrategyPluginSource: (name: string, cwd?: string) => Promise<string | undefined>;
|
|
8
|
+
declare const getAvailableStrategyNames: (cwd?: string) => Promise<string[]>;
|
|
9
|
+
declare const getRegisteredStrategies: (cwd?: string) => Record<string, StrategyCreator>;
|
|
10
|
+
declare const getRegisteredManifests: (cwd?: string) => StrategyManifest[];
|
|
11
|
+
declare const getStrategyManifest: (name?: string, cwd?: string) => StrategyManifest | undefined;
|
|
12
|
+
declare const isKnownStrategy: (name: string, cwd?: string) => boolean;
|
|
13
|
+
declare const registerStrategyEntries: (entries: readonly StrategyRegistryEntry[], cwd?: string) => void;
|
|
14
|
+
declare const resetStrategyRegistryCache: (cwd?: string) => void;
|
|
15
|
+
declare const strategies: Record<string, StrategyCreator>;
|
|
16
|
+
|
|
17
|
+
export { ensureStrategyPluginsLoaded as a, getRegisteredManifests as b, getRegisteredStrategies as c, getStrategyCreator as d, ensureIndicatorPluginsLoaded as e, getStrategyDefaults as f, getAvailableStrategyNames as g, getStrategyManifest as h, getStrategyPluginSource as i, isKnownStrategy as j, resetStrategyRegistryCache as k, registerStrategyEntries as r, strategies as s };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StrategyManifest, StrategyCreator, StrategyRegistryEntry } from '@tradejs/types';
|
|
2
|
+
|
|
3
|
+
declare const ensureStrategyPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
4
|
+
declare const ensureIndicatorPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
5
|
+
declare const getStrategyCreator: (name: string, cwd?: string) => Promise<StrategyCreator | undefined>;
|
|
6
|
+
declare const getStrategyDefaults: (name: string, cwd?: string) => Promise<StrategyRegistryEntry["defaults"] | undefined>;
|
|
7
|
+
declare const getStrategyPluginSource: (name: string, cwd?: string) => Promise<string | undefined>;
|
|
8
|
+
declare const getAvailableStrategyNames: (cwd?: string) => Promise<string[]>;
|
|
9
|
+
declare const getRegisteredStrategies: (cwd?: string) => Record<string, StrategyCreator>;
|
|
10
|
+
declare const getRegisteredManifests: (cwd?: string) => StrategyManifest[];
|
|
11
|
+
declare const getStrategyManifest: (name?: string, cwd?: string) => StrategyManifest | undefined;
|
|
12
|
+
declare const isKnownStrategy: (name: string, cwd?: string) => boolean;
|
|
13
|
+
declare const registerStrategyEntries: (entries: readonly StrategyRegistryEntry[], cwd?: string) => void;
|
|
14
|
+
declare const resetStrategyRegistryCache: (cwd?: string) => void;
|
|
15
|
+
declare const strategies: Record<string, StrategyCreator>;
|
|
16
|
+
|
|
17
|
+
export { ensureStrategyPluginsLoaded as a, getRegisteredManifests as b, getRegisteredStrategies as c, getStrategyCreator as d, ensureIndicatorPluginsLoaded as e, getStrategyDefaults as f, getAvailableStrategyNames as g, getStrategyManifest as h, getStrategyPluginSource as i, isKnownStrategy as j, resetStrategyRegistryCache as k, registerStrategyEntries as r, strategies as s };
|
package/dist/registry.d.mts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const ensureStrategyPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
4
|
-
declare const ensureIndicatorPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
5
|
-
declare const getStrategyCreator: (name: string, cwd?: string) => Promise<StrategyCreator | undefined>;
|
|
6
|
-
declare const getStrategyDefaults: (name: string, cwd?: string) => Promise<StrategyRegistryEntry["defaults"] | undefined>;
|
|
7
|
-
declare const getAvailableStrategyNames: (cwd?: string) => Promise<string[]>;
|
|
8
|
-
declare const getRegisteredStrategies: (cwd?: string) => Record<string, StrategyCreator>;
|
|
9
|
-
declare const getRegisteredManifests: (cwd?: string) => StrategyManifest[];
|
|
10
|
-
declare const getStrategyManifest: (name?: string, cwd?: string) => StrategyManifest | undefined;
|
|
11
|
-
declare const isKnownStrategy: (name: string, cwd?: string) => boolean;
|
|
12
|
-
declare const registerStrategyEntries: (entries: readonly StrategyRegistryEntry[], cwd?: string) => void;
|
|
13
|
-
declare const resetStrategyRegistryCache: (cwd?: string) => void;
|
|
14
|
-
declare const strategies: Record<string, StrategyCreator>;
|
|
15
|
-
|
|
16
|
-
export { ensureIndicatorPluginsLoaded, ensureStrategyPluginsLoaded, getAvailableStrategyNames, getRegisteredManifests, getRegisteredStrategies, getStrategyCreator, getStrategyDefaults, getStrategyManifest, isKnownStrategy, registerStrategyEntries, resetStrategyRegistryCache, strategies };
|
|
1
|
+
export { e as ensureIndicatorPluginsLoaded, a as ensureStrategyPluginsLoaded, g as getAvailableStrategyNames, b as getRegisteredManifests, c as getRegisteredStrategies, d as getStrategyCreator, f as getStrategyDefaults, h as getStrategyManifest, j as isKnownStrategy, r as registerStrategyEntries, k as resetStrategyRegistryCache, s as strategies } from './registry-DHTLjQcr.mjs';
|
|
2
|
+
import '@tradejs/types';
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const ensureStrategyPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
4
|
-
declare const ensureIndicatorPluginsLoaded: (cwd?: string) => Promise<void>;
|
|
5
|
-
declare const getStrategyCreator: (name: string, cwd?: string) => Promise<StrategyCreator | undefined>;
|
|
6
|
-
declare const getStrategyDefaults: (name: string, cwd?: string) => Promise<StrategyRegistryEntry["defaults"] | undefined>;
|
|
7
|
-
declare const getAvailableStrategyNames: (cwd?: string) => Promise<string[]>;
|
|
8
|
-
declare const getRegisteredStrategies: (cwd?: string) => Record<string, StrategyCreator>;
|
|
9
|
-
declare const getRegisteredManifests: (cwd?: string) => StrategyManifest[];
|
|
10
|
-
declare const getStrategyManifest: (name?: string, cwd?: string) => StrategyManifest | undefined;
|
|
11
|
-
declare const isKnownStrategy: (name: string, cwd?: string) => boolean;
|
|
12
|
-
declare const registerStrategyEntries: (entries: readonly StrategyRegistryEntry[], cwd?: string) => void;
|
|
13
|
-
declare const resetStrategyRegistryCache: (cwd?: string) => void;
|
|
14
|
-
declare const strategies: Record<string, StrategyCreator>;
|
|
15
|
-
|
|
16
|
-
export { ensureIndicatorPluginsLoaded, ensureStrategyPluginsLoaded, getAvailableStrategyNames, getRegisteredManifests, getRegisteredStrategies, getStrategyCreator, getStrategyDefaults, getStrategyManifest, isKnownStrategy, registerStrategyEntries, resetStrategyRegistryCache, strategies };
|
|
1
|
+
export { e as ensureIndicatorPluginsLoaded, a as ensureStrategyPluginsLoaded, g as getAvailableStrategyNames, b as getRegisteredManifests, c as getRegisteredStrategies, d as getStrategyCreator, f as getStrategyDefaults, h as getStrategyManifest, j as isKnownStrategy, r as registerStrategyEntries, k as resetStrategyRegistryCache, s as strategies } from './registry-DHTLjQcr.js';
|
|
2
|
+
import '@tradejs/types';
|
package/dist/registry.js
CHANGED
|
@@ -930,6 +930,7 @@ var createStrategyRegistryState = () => ({
|
|
|
930
930
|
strategyCreators: /* @__PURE__ */ new Map(),
|
|
931
931
|
strategyManifestsMap: /* @__PURE__ */ new Map(),
|
|
932
932
|
strategyEntriesMap: /* @__PURE__ */ new Map(),
|
|
933
|
+
strategySourcesMap: /* @__PURE__ */ new Map(),
|
|
933
934
|
pluginsLoadPromise: null
|
|
934
935
|
});
|
|
935
936
|
var registryStateByProjectRoot = sharedStrategyRegistry.registryStateByProjectRoot;
|
|
@@ -1000,6 +1001,7 @@ var registerEntries = (entries, source, state) => {
|
|
|
1000
1001
|
}
|
|
1001
1002
|
state.strategyManifestsMap.set(strategyName, entry.manifest);
|
|
1002
1003
|
state.strategyEntriesMap.set(strategyName, entry);
|
|
1004
|
+
state.strategySourcesMap.set(strategyName, source);
|
|
1003
1005
|
materializeStrategyCreator(strategyName, state);
|
|
1004
1006
|
}
|
|
1005
1007
|
};
|
|
@@ -4458,6 +4460,7 @@ var executeEntryOrder = async ({
|
|
|
4458
4460
|
deploymentId: signal.deploymentId,
|
|
4459
4461
|
policyProfileId: signal.policyProfileId,
|
|
4460
4462
|
runtimeConfigId: signal.runtimeConfigId,
|
|
4463
|
+
runtimeReleaseVersion: signal.runtimeReleaseVersion,
|
|
4461
4464
|
runtimeLineage: signal.runtimeLineage,
|
|
4462
4465
|
...signal.aiAnalysis ? { aiAnalysis: signal.aiAnalysis } : {}
|
|
4463
4466
|
});
|
|
@@ -5382,6 +5385,9 @@ var createStrategyRuntime = ({
|
|
|
5382
5385
|
deploymentId: requestedDeploymentId,
|
|
5383
5386
|
policyProfileId,
|
|
5384
5387
|
runtimeConfigId,
|
|
5388
|
+
runtimeReleaseVersion,
|
|
5389
|
+
entriesPaused = false,
|
|
5390
|
+
runtimeLineage,
|
|
5385
5391
|
runtimeConfigSnapshot,
|
|
5386
5392
|
data,
|
|
5387
5393
|
btcData,
|
|
@@ -6040,6 +6046,7 @@ var createStrategyRuntime = ({
|
|
|
6040
6046
|
});
|
|
6041
6047
|
const signal = decision.signal;
|
|
6042
6048
|
if (signal) {
|
|
6049
|
+
if (runtimeLineage) signal.runtimeLineage = runtimeLineage;
|
|
6043
6050
|
if (universe) signal.universe = universe;
|
|
6044
6051
|
if (assetClass) signal.assetClass = assetClass;
|
|
6045
6052
|
if (accountId) signal.accountId = accountId;
|
|
@@ -6050,6 +6057,9 @@ var createStrategyRuntime = ({
|
|
|
6050
6057
|
signal.signalId = `${signal.signalId}:${runtimeConfigId}`;
|
|
6051
6058
|
}
|
|
6052
6059
|
}
|
|
6060
|
+
if (runtimeReleaseVersion) {
|
|
6061
|
+
signal.runtimeReleaseVersion = runtimeReleaseVersion;
|
|
6062
|
+
}
|
|
6053
6063
|
if (decisionHookCtx.policyProfileId) {
|
|
6054
6064
|
signal.policyProfileId = decisionHookCtx.policyProfileId;
|
|
6055
6065
|
}
|
|
@@ -6156,6 +6166,15 @@ var createStrategyRuntime = ({
|
|
|
6156
6166
|
quality,
|
|
6157
6167
|
minAiQuality
|
|
6158
6168
|
});
|
|
6169
|
+
if (entriesPaused) {
|
|
6170
|
+
const skipReason = "RUNTIME_ENTRIES_PAUSED";
|
|
6171
|
+
if (signal) {
|
|
6172
|
+
signal.orderStatus = "skipped";
|
|
6173
|
+
signal.orderSkipReason = skipReason;
|
|
6174
|
+
signal.runtimeReleaseVersion = runtimeReleaseVersion;
|
|
6175
|
+
}
|
|
6176
|
+
return signal ?? skipReason;
|
|
6177
|
+
}
|
|
6159
6178
|
if (!shouldMakeOrder) {
|
|
6160
6179
|
if (signal) {
|
|
6161
6180
|
signal.orderStatus = "skipped";
|
package/dist/registry.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-W26Y6IRP.mjs";
|
|
2
|
+
import "./chunk-SEQJ6V6B.mjs";
|
|
2
3
|
import {
|
|
3
4
|
ensureIndicatorPluginsLoaded,
|
|
4
5
|
ensureStrategyPluginsLoaded,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
registerStrategyEntries,
|
|
13
14
|
resetStrategyRegistryCache,
|
|
14
15
|
strategies
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XN7BC7XK.mjs";
|
|
16
17
|
import "./chunk-WS5DYEVZ.mjs";
|
|
17
18
|
import "./chunk-Y6FXYEAI.mjs";
|
|
18
19
|
export {
|