@tradejs/cli 3.1.29-beta.290 → 3.1.29-beta.292
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 +12283 -10394
- package/dist/lib/aiPocketSearch.js +37 -3
- package/dist/lib/aiTrainDataset.js +1 -0
- package/dist/lib/aiTrainEvaluationDump.js +7 -2
- package/dist/lib/aiTrainResearch.js +11 -7
- package/dist/lib/coreResearch.js +273 -119
- package/dist/lib/researchMetricSnapshot.js +74 -0
- package/dist/lib/researchVisuals.js +931 -0
- package/dist/lib/strategyRelease.js +8 -2
- package/dist/lib/strategyResearch.js +334 -199
- package/dist/lib/tickerProfiles.js +76 -0
- package/dist/scripts/aiPocketSearch.js +2959 -2610
- package/dist/scripts/aiTrain.js +29 -17
- package/dist/scripts/coreResearch.js +275 -119
- package/dist/scripts/replay.js +533 -115
- package/dist/scripts/replayRunner.js +533 -115
- package/dist/scripts/researchVisuals.js +976 -0
- package/dist/scripts/strategyRelease.js +59 -7
- package/dist/scripts/strategyResearch.js +339 -203
- package/dist/scripts/tickerProfiles.js +114 -0
- package/package.json +8 -7
|
@@ -34,6 +34,7 @@ __export(aiPocketSearch_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(aiPocketSearch_exports);
|
|
35
35
|
|
|
36
36
|
// src/lib/aiPocketSearch/features.ts
|
|
37
|
+
var import_aiFeatures = require("@tradejs/core/aiFeatures");
|
|
37
38
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
38
39
|
var DAYS_PER_WEEK = 7;
|
|
39
40
|
var DAYS_PER_MONTH = 30.4375;
|
|
@@ -402,15 +403,25 @@ var addFlattenedFeatures = ({
|
|
|
402
403
|
value,
|
|
403
404
|
segments,
|
|
404
405
|
maxDepth,
|
|
405
|
-
shouldSkipPath = () => false
|
|
406
|
+
shouldSkipPath = () => false,
|
|
407
|
+
onFeatureExcluded
|
|
406
408
|
}) => {
|
|
407
409
|
if (!segments.length && !isPlainRecord(value)) {
|
|
408
410
|
return;
|
|
409
411
|
}
|
|
410
|
-
if (segments.length > maxDepth || isOutcomePath(segments)
|
|
412
|
+
if (segments.length > maxDepth || isOutcomePath(segments)) {
|
|
413
|
+
onFeatureExcluded?.({
|
|
414
|
+
path: segments.join("."),
|
|
415
|
+
classification: segments.length > maxDepth ? "depth-limit" : "derived-policy"
|
|
416
|
+
});
|
|
411
417
|
return;
|
|
412
418
|
}
|
|
419
|
+
if (shouldSkipPath(segments)) return;
|
|
413
420
|
if (Array.isArray(value)) {
|
|
421
|
+
onFeatureExcluded?.({
|
|
422
|
+
path: segments.join("."),
|
|
423
|
+
classification: "unprojected-array"
|
|
424
|
+
});
|
|
414
425
|
return;
|
|
415
426
|
}
|
|
416
427
|
if (isFeaturePrimitive(value)) {
|
|
@@ -432,7 +443,8 @@ var addFlattenedFeatures = ({
|
|
|
432
443
|
value: child,
|
|
433
444
|
segments: [...segments, key],
|
|
434
445
|
maxDepth,
|
|
435
|
-
shouldSkipPath
|
|
446
|
+
shouldSkipPath,
|
|
447
|
+
onFeatureExcluded
|
|
436
448
|
});
|
|
437
449
|
}
|
|
438
450
|
};
|
|
@@ -644,7 +656,10 @@ var collectAiPocketFeatureSnapshot = ({
|
|
|
644
656
|
value: source,
|
|
645
657
|
segments: [],
|
|
646
658
|
maxDepth: 8,
|
|
659
|
+
onFeatureExcluded,
|
|
647
660
|
shouldSkipPath: (segments) => {
|
|
661
|
+
if (segments.join(".") === "additionalIndicators.baseContext.tickerProfile" || segments.join(".") === "additionalIndicators.tickerProfile" || segments.join(".") === "additionalIndicators.portfolioContext")
|
|
662
|
+
return true;
|
|
648
663
|
if (isOperatorExcluded(segments.join("."))) {
|
|
649
664
|
return true;
|
|
650
665
|
}
|
|
@@ -662,6 +677,10 @@ var collectAiPocketFeatureSnapshot = ({
|
|
|
662
677
|
return true;
|
|
663
678
|
}
|
|
664
679
|
if (featureProfile === "compact" && isCompactFeaturePathSkipped(segments)) {
|
|
680
|
+
onFeatureExcluded?.({
|
|
681
|
+
path: segments.join("."),
|
|
682
|
+
classification: "compact-profile"
|
|
683
|
+
});
|
|
665
684
|
return true;
|
|
666
685
|
}
|
|
667
686
|
if (featurePolicy !== "causal-stationary") {
|
|
@@ -696,6 +715,21 @@ var collectAiPocketFeatureSnapshot = ({
|
|
|
696
715
|
delete features[key];
|
|
697
716
|
}
|
|
698
717
|
}
|
|
718
|
+
const registered = payload.featureSnapshot;
|
|
719
|
+
if (registered) {
|
|
720
|
+
(0, import_aiFeatures.validateAiFeatureSnapshot)(registered);
|
|
721
|
+
for (const definition of registered.definitions) {
|
|
722
|
+
const path = `registered.${definition.id}`;
|
|
723
|
+
if (isOperatorExcluded(path)) continue;
|
|
724
|
+
const value = registered.values[definition.id];
|
|
725
|
+
const classification = definition.role === "outcome" || definition.role === "policy" ? "derived-policy" : definition.role !== "input" ? definition.role : featurePolicy === "causal-stationary" && !definition.stationary ? "raw-nonstationary" : value === null || value === "unknown" ? "data-quality" : "eligible";
|
|
726
|
+
if (classification !== "eligible") {
|
|
727
|
+
onFeatureExcluded?.({ path, classification });
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
features[path] = value;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
699
733
|
return { features, featureCoverage };
|
|
700
734
|
};
|
|
701
735
|
var collectAiPocketFeatures = (options) => collectAiPocketFeatureSnapshot(options).features;
|
|
@@ -27,6 +27,7 @@ var extractSignalFromAiDatasetRow = (row) => {
|
|
|
27
27
|
const { payload } = row;
|
|
28
28
|
return {
|
|
29
29
|
...payload.signal,
|
|
30
|
+
aiFeatureReplay: { snapshot: payload.featureSnapshot ?? null },
|
|
30
31
|
strategy: payload.signal.strategy,
|
|
31
32
|
figures: payload.figures ?? {},
|
|
32
33
|
indicators: payload.indicators ?? {},
|
|
@@ -30,7 +30,9 @@ var BASE_CONTEXT_FEATURE_SECTIONS = [
|
|
|
30
30
|
"relative",
|
|
31
31
|
"derivatives",
|
|
32
32
|
"mtf",
|
|
33
|
-
"gateFeatures"
|
|
33
|
+
"gateFeatures",
|
|
34
|
+
"tickerProfile",
|
|
35
|
+
"portfolioContext"
|
|
34
36
|
];
|
|
35
37
|
var asRecord = (value) => typeof value === "object" && value != null && !Array.isArray(value) ? value : null;
|
|
36
38
|
var collectStrategyGateFeatures = (baseContext) => {
|
|
@@ -47,6 +49,7 @@ var pickBaseContextFeatureSections = (baseContext) => Object.fromEntries(
|
|
|
47
49
|
);
|
|
48
50
|
var buildAiTrainEvaluationFeatureSnapshot = ({
|
|
49
51
|
additionalIndicators,
|
|
52
|
+
featureSnapshot,
|
|
50
53
|
mode
|
|
51
54
|
}) => {
|
|
52
55
|
if (mode === "none") {
|
|
@@ -56,12 +59,14 @@ var buildAiTrainEvaluationFeatureSnapshot = ({
|
|
|
56
59
|
const baseContext = asRecord(additional?.baseContext);
|
|
57
60
|
if (!baseContext) {
|
|
58
61
|
return {
|
|
59
|
-
baseContextAvailable: false
|
|
62
|
+
baseContextAvailable: false,
|
|
63
|
+
...featureSnapshot ? { featureSnapshot } : {}
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
66
|
const strategyGateFeatures = collectStrategyGateFeatures(baseContext);
|
|
63
67
|
const snapshot = {
|
|
64
68
|
baseContextAvailable: true,
|
|
69
|
+
...featureSnapshot ? { featureSnapshot } : {},
|
|
65
70
|
gateFeatures: baseContext.gateFeatures ?? null,
|
|
66
71
|
...strategyGateFeatures ? { strategyGateFeatures } : {}
|
|
67
72
|
};
|
|
@@ -405,6 +405,8 @@ var RESEARCH_CONTEXT_ENV_KEYS = [
|
|
|
405
405
|
"INTERVAL",
|
|
406
406
|
"DERIVATIVES_CONTEXT_ENABLED",
|
|
407
407
|
"DERIVATIVES_CONTEXT_TARGET_ENABLED",
|
|
408
|
+
"TICKER_PROFILES_PROVIDER",
|
|
409
|
+
"TICKER_PROFILES_UNIVERSE",
|
|
408
410
|
"DERIVATIVES_CONTEXT_LOOKBACK_HOURS",
|
|
409
411
|
"DERIVATIVES_CONTEXT_EXTRA_REFERENCE_SYMBOLS",
|
|
410
412
|
"DERIVATIVES_CONTEXT_EXCHANGE_PRIORITY",
|
|
@@ -439,13 +441,15 @@ var writeAiTrainResearchSnapshot = async ({
|
|
|
439
441
|
}) => {
|
|
440
442
|
const resolvedPath = import_node_path2.default.resolve(outputPath);
|
|
441
443
|
await import_promises2.default.mkdir(import_node_path2.default.dirname(resolvedPath), { recursive: true });
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
"
|
|
447
|
-
|
|
448
|
-
|
|
444
|
+
const bytes = `${JSON.stringify(result)}
|
|
445
|
+
`;
|
|
446
|
+
await import_promises2.default.writeFile(resolvedPath, bytes, "utf8");
|
|
447
|
+
return {
|
|
448
|
+
schema: "tradejs-research-report-receipt/v1",
|
|
449
|
+
path: resolvedPath,
|
|
450
|
+
bytes: Buffer.byteLength(bytes),
|
|
451
|
+
sha256: (0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex")
|
|
452
|
+
};
|
|
449
453
|
};
|
|
450
454
|
var normalizeForStableJson = (value) => {
|
|
451
455
|
if (Array.isArray(value)) {
|