@tradejs/node 3.1.2 → 3.1.4
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/backtest.js +6 -20
- package/dist/backtest.mjs +5 -5
- package/dist/{chunk-W26Y6IRP.mjs → chunk-MCDICN3I.mjs} +6 -23
- package/dist/registry.js +6 -20
- package/dist/registry.mjs +1 -1
- package/dist/runtimeDashboard.js +255 -6794
- package/dist/runtimeDashboard.mjs +34 -158
- package/dist/runtimeStrategies.d.mts +6 -10
- package/dist/runtimeStrategies.d.ts +6 -10
- package/dist/runtimeStrategies.js +24 -88
- package/dist/runtimeStrategies.mjs +24 -88
- package/dist/strategies.d.mts +1 -1
- package/dist/strategies.d.ts +1 -1
- package/dist/strategies.js +6 -20
- package/dist/strategies.mjs +371 -8
- package/package.json +4 -4
- package/dist/chunk-LAJ7NA3Q.mjs +0 -377
package/dist/backtest.js
CHANGED
|
@@ -4472,14 +4472,10 @@ var updatePositionProtection = async ({
|
|
|
4472
4472
|
|
|
4473
4473
|
// src/strategyHelpers/config.ts
|
|
4474
4474
|
var import_lodash = __toESM(require("lodash"));
|
|
4475
|
-
var import_runtimeStrategyConfigs = require("@tradejs/infra/runtimeStrategyConfigs");
|
|
4476
4475
|
var resolveStrategyConfig = async ({
|
|
4477
4476
|
strategyName,
|
|
4478
|
-
userName,
|
|
4479
|
-
symbol,
|
|
4480
4477
|
baseConfig,
|
|
4481
4478
|
defaults,
|
|
4482
|
-
runtimeConfigId,
|
|
4483
4479
|
runtimeConfigSnapshot
|
|
4484
4480
|
}) => {
|
|
4485
4481
|
const mergeIfNotEmpty = (target, patch) => patch && !import_lodash.default.isEmpty(patch) ? {
|
|
@@ -4492,22 +4488,13 @@ var resolveStrategyConfig = async ({
|
|
|
4492
4488
|
};
|
|
4493
4489
|
let isConfigFromBacktest = false;
|
|
4494
4490
|
if (config.ENV !== "BACKTEST") {
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
) ?? {};
|
|
4500
|
-
config = mergeIfNotEmpty(config, userConfig);
|
|
4501
|
-
if (!runtimeConfigId || runtimeConfigId === "config") {
|
|
4502
|
-
const symbolResultConfig = runtimeConfigSnapshot ? runtimeConfigSnapshot.symbolResultConfig : await (0, import_runtimeStrategyConfigs.getRuntimeStrategyResultConfig)(userName, strategyName, symbol);
|
|
4503
|
-
if (symbolResultConfig && !import_lodash.default.isEmpty(symbolResultConfig)) {
|
|
4504
|
-
config = mergeIfNotEmpty(
|
|
4505
|
-
config,
|
|
4506
|
-
symbolResultConfig
|
|
4507
|
-
);
|
|
4508
|
-
isConfigFromBacktest = true;
|
|
4509
|
-
}
|
|
4491
|
+
if (!runtimeConfigSnapshot) {
|
|
4492
|
+
throw new Error(
|
|
4493
|
+
`Runtime strategy release snapshot is required for ${strategyName}`
|
|
4494
|
+
);
|
|
4510
4495
|
}
|
|
4496
|
+
const userConfig = runtimeConfigSnapshot.userConfig;
|
|
4497
|
+
config = mergeIfNotEmpty(config, userConfig);
|
|
4511
4498
|
}
|
|
4512
4499
|
return { config, isConfigFromBacktest };
|
|
4513
4500
|
};
|
|
@@ -5342,7 +5329,6 @@ var createStrategyRuntime = ({
|
|
|
5342
5329
|
};
|
|
5343
5330
|
const creator = async ({
|
|
5344
5331
|
userName,
|
|
5345
|
-
connectorName,
|
|
5346
5332
|
config: baseConfig,
|
|
5347
5333
|
symbol,
|
|
5348
5334
|
universe: requestedUniverse,
|
package/dist/backtest.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BUILTIN_CONNECTOR_NAMES,
|
|
3
|
-
getConnectorCreatorByName
|
|
4
|
-
} from "./chunk-3TWULKHV.mjs";
|
|
5
1
|
import {
|
|
6
2
|
buildMlPayload,
|
|
7
3
|
enrichSignalWithMarketContextStages
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MCDICN3I.mjs";
|
|
9
5
|
import {
|
|
10
6
|
buildAiPayload
|
|
11
7
|
} from "./chunk-SEQJ6V6B.mjs";
|
|
12
8
|
import {
|
|
13
9
|
getStrategyCreator
|
|
14
10
|
} from "./chunk-XN7BC7XK.mjs";
|
|
11
|
+
import {
|
|
12
|
+
BUILTIN_CONNECTOR_NAMES,
|
|
13
|
+
getConnectorCreatorByName
|
|
14
|
+
} from "./chunk-3TWULKHV.mjs";
|
|
15
15
|
import {
|
|
16
16
|
getTradejsProjectCwd
|
|
17
17
|
} from "./chunk-WS5DYEVZ.mjs";
|
|
@@ -2822,17 +2822,10 @@ var updatePositionProtection = async ({
|
|
|
2822
2822
|
|
|
2823
2823
|
// src/strategyHelpers/config.ts
|
|
2824
2824
|
import _ from "lodash";
|
|
2825
|
-
import {
|
|
2826
|
-
getRuntimeStrategyConfig,
|
|
2827
|
-
getRuntimeStrategyResultConfig
|
|
2828
|
-
} from "@tradejs/infra/runtimeStrategyConfigs";
|
|
2829
2825
|
var resolveStrategyConfig = async ({
|
|
2830
2826
|
strategyName,
|
|
2831
|
-
userName,
|
|
2832
|
-
symbol,
|
|
2833
2827
|
baseConfig,
|
|
2834
2828
|
defaults,
|
|
2835
|
-
runtimeConfigId,
|
|
2836
2829
|
runtimeConfigSnapshot
|
|
2837
2830
|
}) => {
|
|
2838
2831
|
const mergeIfNotEmpty = (target, patch) => patch && !_.isEmpty(patch) ? {
|
|
@@ -2845,22 +2838,13 @@ var resolveStrategyConfig = async ({
|
|
|
2845
2838
|
};
|
|
2846
2839
|
let isConfigFromBacktest = false;
|
|
2847
2840
|
if (config.ENV !== "BACKTEST") {
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
) ?? {};
|
|
2853
|
-
config = mergeIfNotEmpty(config, userConfig);
|
|
2854
|
-
if (!runtimeConfigId || runtimeConfigId === "config") {
|
|
2855
|
-
const symbolResultConfig = runtimeConfigSnapshot ? runtimeConfigSnapshot.symbolResultConfig : await getRuntimeStrategyResultConfig(userName, strategyName, symbol);
|
|
2856
|
-
if (symbolResultConfig && !_.isEmpty(symbolResultConfig)) {
|
|
2857
|
-
config = mergeIfNotEmpty(
|
|
2858
|
-
config,
|
|
2859
|
-
symbolResultConfig
|
|
2860
|
-
);
|
|
2861
|
-
isConfigFromBacktest = true;
|
|
2862
|
-
}
|
|
2841
|
+
if (!runtimeConfigSnapshot) {
|
|
2842
|
+
throw new Error(
|
|
2843
|
+
`Runtime strategy release snapshot is required for ${strategyName}`
|
|
2844
|
+
);
|
|
2863
2845
|
}
|
|
2846
|
+
const userConfig = runtimeConfigSnapshot.userConfig;
|
|
2847
|
+
config = mergeIfNotEmpty(config, userConfig);
|
|
2864
2848
|
}
|
|
2865
2849
|
return { config, isConfigFromBacktest };
|
|
2866
2850
|
};
|
|
@@ -3713,7 +3697,6 @@ var createStrategyRuntime = ({
|
|
|
3713
3697
|
};
|
|
3714
3698
|
const creator = async ({
|
|
3715
3699
|
userName,
|
|
3716
|
-
connectorName,
|
|
3717
3700
|
config: baseConfig,
|
|
3718
3701
|
symbol,
|
|
3719
3702
|
universe: requestedUniverse,
|
package/dist/registry.js
CHANGED
|
@@ -4506,14 +4506,10 @@ var updatePositionProtection = async ({
|
|
|
4506
4506
|
|
|
4507
4507
|
// src/strategyHelpers/config.ts
|
|
4508
4508
|
var import_lodash = __toESM(require("lodash"));
|
|
4509
|
-
var import_runtimeStrategyConfigs = require("@tradejs/infra/runtimeStrategyConfigs");
|
|
4510
4509
|
var resolveStrategyConfig = async ({
|
|
4511
4510
|
strategyName,
|
|
4512
|
-
userName,
|
|
4513
|
-
symbol,
|
|
4514
4511
|
baseConfig,
|
|
4515
4512
|
defaults,
|
|
4516
|
-
runtimeConfigId,
|
|
4517
4513
|
runtimeConfigSnapshot
|
|
4518
4514
|
}) => {
|
|
4519
4515
|
const mergeIfNotEmpty = (target, patch) => patch && !import_lodash.default.isEmpty(patch) ? {
|
|
@@ -4526,22 +4522,13 @@ var resolveStrategyConfig = async ({
|
|
|
4526
4522
|
};
|
|
4527
4523
|
let isConfigFromBacktest = false;
|
|
4528
4524
|
if (config.ENV !== "BACKTEST") {
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
) ?? {};
|
|
4534
|
-
config = mergeIfNotEmpty(config, userConfig);
|
|
4535
|
-
if (!runtimeConfigId || runtimeConfigId === "config") {
|
|
4536
|
-
const symbolResultConfig = runtimeConfigSnapshot ? runtimeConfigSnapshot.symbolResultConfig : await (0, import_runtimeStrategyConfigs.getRuntimeStrategyResultConfig)(userName, strategyName, symbol);
|
|
4537
|
-
if (symbolResultConfig && !import_lodash.default.isEmpty(symbolResultConfig)) {
|
|
4538
|
-
config = mergeIfNotEmpty(
|
|
4539
|
-
config,
|
|
4540
|
-
symbolResultConfig
|
|
4541
|
-
);
|
|
4542
|
-
isConfigFromBacktest = true;
|
|
4543
|
-
}
|
|
4525
|
+
if (!runtimeConfigSnapshot) {
|
|
4526
|
+
throw new Error(
|
|
4527
|
+
`Runtime strategy release snapshot is required for ${strategyName}`
|
|
4528
|
+
);
|
|
4544
4529
|
}
|
|
4530
|
+
const userConfig = runtimeConfigSnapshot.userConfig;
|
|
4531
|
+
config = mergeIfNotEmpty(config, userConfig);
|
|
4545
4532
|
}
|
|
4546
4533
|
return { config, isConfigFromBacktest };
|
|
4547
4534
|
};
|
|
@@ -5376,7 +5363,6 @@ var createStrategyRuntime = ({
|
|
|
5376
5363
|
};
|
|
5377
5364
|
const creator = async ({
|
|
5378
5365
|
userName,
|
|
5379
|
-
connectorName,
|
|
5380
5366
|
config: baseConfig,
|
|
5381
5367
|
symbol,
|
|
5382
5368
|
universe: requestedUniverse,
|
package/dist/registry.mjs
CHANGED