@tradejs/cli 3.1.17 → 3.1.18-beta.232

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 CHANGED
@@ -24550,7 +24550,6 @@ var init_runtimeDebugEvidence = __esm({
24550
24550
  signals: signals2,
24551
24551
  evaluations,
24552
24552
  trades,
24553
- evaluationStatsBuckets,
24554
24553
  lineageScopes
24555
24554
  }) => ({
24556
24555
  reportType: "runtime-daily-evidence",
@@ -24567,13 +24566,11 @@ var init_runtimeDebugEvidence = __esm({
24567
24566
  trades: trades.length,
24568
24567
  signals: signals2.length,
24569
24568
  evaluations: evaluations.length,
24570
- evaluationStatsBuckets: evaluationStatsBuckets?.length ?? 0,
24571
24569
  lineageScopes: lineageScopes?.length ?? 0
24572
24570
  },
24573
24571
  trades: trades.map((trade) => ({ trade })),
24574
24572
  signals: signals2.map((signal) => ({ signal })),
24575
24573
  evaluations: evaluations.map((evaluation) => ({ evaluation })),
24576
- evaluationStatsBuckets: evaluationStatsBuckets ?? [],
24577
24574
  lineageScopes: lineageScopes ?? []
24578
24575
  });
24579
24576
  buildRuntimeDebugReportAttachment = async (params) => {
@@ -25004,7 +25001,6 @@ var init_replayRuntimeEvidence = __esm({
25004
25001
  signals: runtimeEvidence2.signals,
25005
25002
  evaluations: runtimeEvidence2.evaluations,
25006
25003
  trades: runtimeEvidence2.trades,
25007
- evaluationStatsBuckets: runtimeEvidence2.evaluationStatsBuckets,
25008
25004
  lineageScopes: runtimeEvidence2.lineageScopes
25009
25005
  })
25010
25006
  };
@@ -25195,6 +25191,11 @@ var init_runtimeEvidenceDeployment = __esm({
25195
25191
  "Runtime evidence payload contains removed strategyConfigs data"
25196
25192
  );
25197
25193
  }
25194
+ if ("evaluationStatsBuckets" in runtime) {
25195
+ throw new Error(
25196
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
25197
+ );
25198
+ }
25198
25199
  const rowFields = [
25199
25200
  "trades",
25200
25201
  "signals",
@@ -25842,7 +25843,6 @@ var init_runtimeEvidence = __esm({
25842
25843
  signals: currentSignals,
25843
25844
  evaluations: currentEvaluations,
25844
25845
  trades: currentTrades,
25845
- evaluationStatsBuckets: evidence.evaluationStatsBuckets,
25846
25846
  lineageScopes: currentLineageScopes
25847
25847
  });
25848
25848
  const deployment = resolveRuntimeEvidenceTickerUniverse({
@@ -26145,7 +26145,7 @@ var init_runtimeEvidenceSync2 = __esm({
26145
26145
  });
26146
26146
 
26147
26147
  // src/lib/runtimeScorecard.ts
26148
- var asRecord6, asArray3, finiteNumber5, finiteString2, packageVersionMap, round, unwrapRows, runtimePayload, runtimeWindow, extractRuntimeRows, buildEmbeddedLineageScope, runtimeDeploymentBinding, belongsToRuntimeDeployment, belongsToStrategy, filterArtifactByStrategy, countBy2, buildDistributions, buildDistributionDelta, sum2, statsCount, tradeTimestamp, dedupeTrades, maxDrawdown, buildRollingPerformance, getReplayComparison, replayCountsForStrategy, getProspectiveSummary, buildRuntimeScorecard, formatRuntimeScorecardMarkdown;
26148
+ var asRecord6, asArray3, finiteNumber5, finiteString2, packageVersionMap, round, unwrapRows, runtimePayload, runtimeWindow, extractRuntimeRows, buildEmbeddedLineageScope, runtimeDeploymentBinding, belongsToRuntimeDeployment, belongsToStrategy, filterArtifactByStrategy, countBy2, buildDistributions, buildDistributionDelta, sum2, tradeTimestamp, dedupeTrades, maxDrawdown, buildRollingPerformance, getReplayComparison, replayCountsForStrategy, getProspectiveSummary, buildRuntimeScorecard, formatRuntimeScorecardMarkdown;
26149
26149
  var init_runtimeScorecard = __esm({
26150
26150
  "src/lib/runtimeScorecard.ts"() {
26151
26151
  "use strict";
@@ -26184,8 +26184,7 @@ var init_runtimeScorecard = __esm({
26184
26184
  evaluations: unwrapRows(runtime.evaluations, "evaluation"),
26185
26185
  signals: unwrapRows(runtime.signals, "signal"),
26186
26186
  trades: unwrapRows(runtime.trades, "trade"),
26187
- lineageScopes: unwrapRows(runtime.lineageScopes, "lineageScope"),
26188
- statsBuckets: asArray3(runtime.evaluationStatsBuckets).map(asRecord6).filter((item) => item != null)
26187
+ lineageScopes: unwrapRows(runtime.lineageScopes, "lineageScope")
26189
26188
  };
26190
26189
  };
26191
26190
  buildEmbeddedLineageScope = ({
@@ -26351,9 +26350,6 @@ var init_runtimeScorecard = __esm({
26351
26350
  ),
26352
26351
  lineageScopes: asArray3(runtime.lineageScopes).filter(
26353
26352
  (item) => belongsToStrategy(asRecord6(item) ?? {}, strategy)
26354
- ),
26355
- evaluationStatsBuckets: asArray3(runtime.evaluationStatsBuckets).filter(
26356
- (item) => belongsToStrategy(asRecord6(item) ?? {}, strategy)
26357
26353
  )
26358
26354
  }
26359
26355
  };
@@ -26424,7 +26420,6 @@ var init_runtimeScorecard = __esm({
26424
26420
  );
26425
26421
  };
26426
26422
  sum2 = (values) => round(values.reduce((total, value) => total + (value ?? 0), 0));
26427
- statsCount = (buckets, field) => sum2(buckets.map((bucket) => finiteNumber5(asRecord6(bucket.stats)?.[field])));
26428
26423
  tradeTimestamp = (trade) => finiteNumber5(trade.exitTimestamp) ?? finiteNumber5(trade.lastSyncedAt) ?? finiteNumber5(trade.entryTimestamp) ?? 0;
26429
26424
  dedupeTrades = (artifacts) => {
26430
26425
  const tradesByOrderId = /* @__PURE__ */ new Map();
@@ -26547,8 +26542,6 @@ var init_runtimeScorecard = __esm({
26547
26542
  const window = runtimeWindow(runtimeArtifact);
26548
26543
  const startTime = finiteNumber5(window.startTime) ?? generatedAt - 864e5;
26549
26544
  const endTime = finiteNumber5(window.endTime) ?? generatedAt;
26550
- const evaluationsFromStats = statsCount(rows.statsBuckets, "evaluated");
26551
- const candidatesFromStats = statsCount(rows.statsBuckets, "signals");
26552
26545
  const signalEvaluations = rows.evaluations.filter(
26553
26546
  (evaluation) => evaluation.status === "signal"
26554
26547
  );
@@ -26685,8 +26678,8 @@ var init_runtimeScorecard = __esm({
26685
26678
  promotionStatus,
26686
26679
  thresholds,
26687
26680
  funnel: {
26688
- evaluations: evaluationsFromStats > 0 ? evaluationsFromStats : rows.evaluations.length,
26689
- coreCandidates: candidatesFromStats > 0 ? candidatesFromStats : signalEvaluations.length,
26681
+ evaluations: rows.evaluations.length,
26682
+ coreCandidates: signalEvaluations.length,
26690
26683
  gate: {
26691
26684
  available: gateDecisions.length > 0,
26692
26685
  approved: gateDecisions.filter(
@@ -527,7 +527,6 @@ var buildRuntimeEvidenceReportPayload = ({
527
527
  signals,
528
528
  evaluations,
529
529
  trades,
530
- evaluationStatsBuckets,
531
530
  lineageScopes
532
531
  }) => ({
533
532
  reportType: "runtime-daily-evidence",
@@ -544,13 +543,11 @@ var buildRuntimeEvidenceReportPayload = ({
544
543
  trades: trades.length,
545
544
  signals: signals.length,
546
545
  evaluations: evaluations.length,
547
- evaluationStatsBuckets: evaluationStatsBuckets?.length ?? 0,
548
546
  lineageScopes: lineageScopes?.length ?? 0
549
547
  },
550
548
  trades: trades.map((trade) => ({ trade })),
551
549
  signals: signals.map((signal) => ({ signal })),
552
550
  evaluations: evaluations.map((evaluation) => ({ evaluation })),
553
- evaluationStatsBuckets: evaluationStatsBuckets ?? [],
554
551
  lineageScopes: lineageScopes ?? []
555
552
  });
556
553
  var buildRuntimeDebugReportAttachment = async (params) => {
@@ -148,6 +148,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
148
148
  "Runtime evidence payload contains removed strategyConfigs data"
149
149
  );
150
150
  }
151
+ if ("evaluationStatsBuckets" in runtime) {
152
+ throw new Error(
153
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
154
+ );
155
+ }
151
156
  const rowFields = [
152
157
  "trades",
153
158
  "signals",
@@ -134,6 +134,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
134
134
  "Runtime evidence payload contains removed strategyConfigs data"
135
135
  );
136
136
  }
137
+ if ("evaluationStatsBuckets" in runtime) {
138
+ throw new Error(
139
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
140
+ );
141
+ }
137
142
  const rowFields = [
138
143
  "trades",
139
144
  "signals",
@@ -152,6 +152,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
152
152
  "Runtime evidence payload contains removed strategyConfigs data"
153
153
  );
154
154
  }
155
+ if ("evaluationStatsBuckets" in runtime) {
156
+ throw new Error(
157
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
158
+ );
159
+ }
155
160
  const rowFields = [
156
161
  "trades",
157
162
  "signals",
@@ -154,6 +154,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
154
154
  "Runtime evidence payload contains removed strategyConfigs data"
155
155
  );
156
156
  }
157
+ if ("evaluationStatsBuckets" in runtime) {
158
+ throw new Error(
159
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
160
+ );
161
+ }
157
162
  const rowFields = [
158
163
  "trades",
159
164
  "signals",
@@ -240,8 +245,7 @@ var extractRuntimeRows = (artifact) => {
240
245
  evaluations: unwrapRows(runtime.evaluations, "evaluation"),
241
246
  signals: unwrapRows(runtime.signals, "signal"),
242
247
  trades: unwrapRows(runtime.trades, "trade"),
243
- lineageScopes: unwrapRows(runtime.lineageScopes, "lineageScope"),
244
- statsBuckets: asArray(runtime.evaluationStatsBuckets).map(asRecord).filter((item) => item != null)
248
+ lineageScopes: unwrapRows(runtime.lineageScopes, "lineageScope")
245
249
  };
246
250
  };
247
251
  var buildEmbeddedLineageScope = ({
@@ -407,9 +411,6 @@ var filterArtifactByStrategy = (artifact, strategy) => {
407
411
  ),
408
412
  lineageScopes: asArray(runtime.lineageScopes).filter(
409
413
  (item) => belongsToStrategy(asRecord(item) ?? {}, strategy)
410
- ),
411
- evaluationStatsBuckets: asArray(runtime.evaluationStatsBuckets).filter(
412
- (item) => belongsToStrategy(asRecord(item) ?? {}, strategy)
413
414
  )
414
415
  }
415
416
  };
@@ -480,7 +481,6 @@ var buildDistributionDelta = (current, previous) => {
480
481
  );
481
482
  };
482
483
  var sum = (values) => round(values.reduce((total, value) => total + (value ?? 0), 0));
483
- var statsCount = (buckets, field) => sum(buckets.map((bucket) => finiteNumber(asRecord(bucket.stats)?.[field])));
484
484
  var tradeTimestamp = (trade) => finiteNumber(trade.exitTimestamp) ?? finiteNumber(trade.lastSyncedAt) ?? finiteNumber(trade.entryTimestamp) ?? 0;
485
485
  var dedupeTrades = (artifacts) => {
486
486
  const tradesByOrderId = /* @__PURE__ */ new Map();
@@ -603,8 +603,6 @@ var buildRuntimeScorecard = ({
603
603
  const window = runtimeWindow(runtimeArtifact);
604
604
  const startTime = finiteNumber(window.startTime) ?? generatedAt - 864e5;
605
605
  const endTime = finiteNumber(window.endTime) ?? generatedAt;
606
- const evaluationsFromStats = statsCount(rows.statsBuckets, "evaluated");
607
- const candidatesFromStats = statsCount(rows.statsBuckets, "signals");
608
606
  const signalEvaluations = rows.evaluations.filter(
609
607
  (evaluation) => evaluation.status === "signal"
610
608
  );
@@ -741,8 +739,8 @@ var buildRuntimeScorecard = ({
741
739
  promotionStatus,
742
740
  thresholds,
743
741
  funnel: {
744
- evaluations: evaluationsFromStats > 0 ? evaluationsFromStats : rows.evaluations.length,
745
- coreCandidates: candidatesFromStats > 0 ? candidatesFromStats : signalEvaluations.length,
742
+ evaluations: rows.evaluations.length,
743
+ coreCandidates: signalEvaluations.length,
746
744
  gate: {
747
745
  available: gateDecisions.length > 0,
748
746
  approved: gateDecisions.filter(
@@ -4526,6 +4526,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
4526
4526
  "Runtime evidence payload contains removed strategyConfigs data"
4527
4527
  );
4528
4528
  }
4529
+ if ("evaluationStatsBuckets" in runtime) {
4530
+ throw new Error(
4531
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
4532
+ );
4533
+ }
4529
4534
  const rowFields = [
4530
4535
  "trades",
4531
4536
  "signals",
@@ -4529,6 +4529,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
4529
4529
  "Runtime evidence payload contains removed strategyConfigs data"
4530
4530
  );
4531
4531
  }
4532
+ if ("evaluationStatsBuckets" in runtime) {
4533
+ throw new Error(
4534
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
4535
+ );
4536
+ }
4532
4537
  const rowFields = [
4533
4538
  "trades",
4534
4539
  "signals",
@@ -360,7 +360,6 @@ var buildRuntimeEvidenceReportPayload = ({
360
360
  signals,
361
361
  evaluations,
362
362
  trades,
363
- evaluationStatsBuckets,
364
363
  lineageScopes
365
364
  }) => ({
366
365
  reportType: "runtime-daily-evidence",
@@ -377,13 +376,11 @@ var buildRuntimeEvidenceReportPayload = ({
377
376
  trades: trades.length,
378
377
  signals: signals.length,
379
378
  evaluations: evaluations.length,
380
- evaluationStatsBuckets: evaluationStatsBuckets?.length ?? 0,
381
379
  lineageScopes: lineageScopes?.length ?? 0
382
380
  },
383
381
  trades: trades.map((trade) => ({ trade })),
384
382
  signals: signals.map((signal) => ({ signal })),
385
383
  evaluations: evaluations.map((evaluation) => ({ evaluation })),
386
- evaluationStatsBuckets: evaluationStatsBuckets ?? [],
387
384
  lineageScopes: lineageScopes ?? []
388
385
  });
389
386
 
@@ -685,7 +682,6 @@ var loadRuntimePayload = async ({
685
682
  signals: runtimeEvidence.signals,
686
683
  evaluations: runtimeEvidence.evaluations,
687
684
  trades: runtimeEvidence.trades,
688
- evaluationStatsBuckets: runtimeEvidence.evaluationStatsBuckets,
689
685
  lineageScopes: runtimeEvidence.lineageScopes
690
686
  })
691
687
  };
@@ -358,7 +358,6 @@ var buildRuntimeEvidenceReportPayload = ({
358
358
  signals,
359
359
  evaluations,
360
360
  trades,
361
- evaluationStatsBuckets,
362
361
  lineageScopes
363
362
  }) => ({
364
363
  reportType: "runtime-daily-evidence",
@@ -375,13 +374,11 @@ var buildRuntimeEvidenceReportPayload = ({
375
374
  trades: trades.length,
376
375
  signals: signals.length,
377
376
  evaluations: evaluations.length,
378
- evaluationStatsBuckets: evaluationStatsBuckets?.length ?? 0,
379
377
  lineageScopes: lineageScopes?.length ?? 0
380
378
  },
381
379
  trades: trades.map((trade) => ({ trade })),
382
380
  signals: signals.map((signal) => ({ signal })),
383
381
  evaluations: evaluations.map((evaluation) => ({ evaluation })),
384
- evaluationStatsBuckets: evaluationStatsBuckets ?? [],
385
382
  lineageScopes: lineageScopes ?? []
386
383
  });
387
384
 
@@ -496,6 +493,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
496
493
  "Runtime evidence payload contains removed strategyConfigs data"
497
494
  );
498
495
  }
496
+ if ("evaluationStatsBuckets" in runtime) {
497
+ throw new Error(
498
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
499
+ );
500
+ }
499
501
  const rowFields = [
500
502
  "trades",
501
503
  "signals",
@@ -1014,7 +1016,6 @@ var runtimeEvidence = async () => {
1014
1016
  signals: currentSignals,
1015
1017
  evaluations: currentEvaluations,
1016
1018
  trades: currentTrades,
1017
- evaluationStatsBuckets: evidence.evaluationStatsBuckets,
1018
1019
  lineageScopes: currentLineageScopes
1019
1020
  });
1020
1021
  const deployment = resolveRuntimeEvidenceTickerUniverse({
@@ -155,6 +155,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
155
155
  "Runtime evidence payload contains removed strategyConfigs data"
156
156
  );
157
157
  }
158
+ if ("evaluationStatsBuckets" in runtime) {
159
+ throw new Error(
160
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
161
+ );
162
+ }
158
163
  const rowFields = [
159
164
  "trades",
160
165
  "signals",
@@ -151,6 +151,11 @@ var assertCurrentRuntimeEvidenceArtifact = (artifact) => {
151
151
  "Runtime evidence payload contains removed strategyConfigs data"
152
152
  );
153
153
  }
154
+ if ("evaluationStatsBuckets" in runtime) {
155
+ throw new Error(
156
+ "Runtime evidence payload contains removed lineage-less evaluationStatsBuckets data"
157
+ );
158
+ }
154
159
  const rowFields = [
155
160
  "trades",
156
161
  "signals",
@@ -413,8 +418,7 @@ var extractRuntimeRows = (artifact) => {
413
418
  evaluations: unwrapRows(runtime.evaluations, "evaluation"),
414
419
  signals: unwrapRows(runtime.signals, "signal"),
415
420
  trades: unwrapRows(runtime.trades, "trade"),
416
- lineageScopes: unwrapRows(runtime.lineageScopes, "lineageScope"),
417
- statsBuckets: asArray(runtime.evaluationStatsBuckets).map(asRecord2).filter((item) => item != null)
421
+ lineageScopes: unwrapRows(runtime.lineageScopes, "lineageScope")
418
422
  };
419
423
  };
420
424
  var buildEmbeddedLineageScope = ({
@@ -580,9 +584,6 @@ var filterArtifactByStrategy = (artifact, strategy) => {
580
584
  ),
581
585
  lineageScopes: asArray(runtime.lineageScopes).filter(
582
586
  (item) => belongsToStrategy(asRecord2(item) ?? {}, strategy)
583
- ),
584
- evaluationStatsBuckets: asArray(runtime.evaluationStatsBuckets).filter(
585
- (item) => belongsToStrategy(asRecord2(item) ?? {}, strategy)
586
587
  )
587
588
  }
588
589
  };
@@ -653,7 +654,6 @@ var buildDistributionDelta = (current, previous) => {
653
654
  );
654
655
  };
655
656
  var sum = (values) => round(values.reduce((total, value) => total + (value ?? 0), 0));
656
- var statsCount = (buckets, field) => sum(buckets.map((bucket) => finiteNumber(asRecord2(bucket.stats)?.[field])));
657
657
  var tradeTimestamp = (trade) => finiteNumber(trade.exitTimestamp) ?? finiteNumber(trade.lastSyncedAt) ?? finiteNumber(trade.entryTimestamp) ?? 0;
658
658
  var dedupeTrades = (artifacts) => {
659
659
  const tradesByOrderId = /* @__PURE__ */ new Map();
@@ -776,8 +776,6 @@ var buildRuntimeScorecard = ({
776
776
  const window = runtimeWindow(runtimeArtifact);
777
777
  const startTime = finiteNumber(window.startTime) ?? generatedAt - 864e5;
778
778
  const endTime = finiteNumber(window.endTime) ?? generatedAt;
779
- const evaluationsFromStats = statsCount(rows.statsBuckets, "evaluated");
780
- const candidatesFromStats = statsCount(rows.statsBuckets, "signals");
781
779
  const signalEvaluations = rows.evaluations.filter(
782
780
  (evaluation) => evaluation.status === "signal"
783
781
  );
@@ -914,8 +912,8 @@ var buildRuntimeScorecard = ({
914
912
  promotionStatus,
915
913
  thresholds,
916
914
  funnel: {
917
- evaluations: evaluationsFromStats > 0 ? evaluationsFromStats : rows.evaluations.length,
918
- coreCandidates: candidatesFromStats > 0 ? candidatesFromStats : signalEvaluations.length,
915
+ evaluations: rows.evaluations.length,
916
+ coreCandidates: signalEvaluations.length,
919
917
  gate: {
920
918
  available: gateDecisions.length > 0,
921
919
  approved: gateDecisions.filter(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/cli",
3
- "version": "3.1.17",
3
+ "version": "3.1.18-beta.232",
4
4
  "description": "Official CLI for the TradeJS TypeScript framework: infra setup, backtests, signals, bots, and ML workflows.",
5
5
  "keywords": [
6
6
  "tradejs",
@@ -36,13 +36,13 @@
36
36
  "tradejs": "dist/cli.js"
37
37
  },
38
38
  "dependencies": {
39
- "@tradejs/connectors": "^3.1.17",
40
- "@tradejs/core": "^3.1.17",
41
- "@tradejs/indicators": "^3.1.17",
42
- "@tradejs/infra": "^3.1.17",
43
- "@tradejs/node": "^3.1.17",
39
+ "@tradejs/connectors": "^3.1.18-beta.232",
40
+ "@tradejs/core": "^3.1.18-beta.232",
41
+ "@tradejs/indicators": "^3.1.18-beta.232",
42
+ "@tradejs/infra": "^3.1.18-beta.232",
43
+ "@tradejs/node": "^3.1.18-beta.232",
44
44
  "@tradejs/strategy-kit": "3.0.3",
45
- "@tradejs/types": "^3.1.17",
45
+ "@tradejs/types": "^3.1.18-beta.232",
46
46
  "args": "^5.0.3",
47
47
  "bcryptjs": "^2.4.3",
48
48
  "chalk": "4.1.2",