create-tradejs 3.1.29-beta.265 → 3.1.29-beta.266
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/skill-bundle/.codex/skills/ai-train-local-research/SKILL.md +5 -0
- package/dist/skill-bundle/.codex/skills/ai-train-local-research/references/gate-ablation.md +109 -0
- package/dist/skill-bundle/.codex/skills/ai-train-local-research/scripts/ai-gate-ablation.mjs +1084 -74
- package/dist/skill-bundle/.codex/skills/ai-train-local-research/scripts/ai-gate-ablation.test.mjs +595 -0
- package/dist/skill-bundle/.codex/skills/ai-train-local-research/scripts/equity-stability.mjs +112 -0
- package/dist/skill-bundle/.codex/skills/ai-train-local-research/scripts/equity-stability.test.mjs +107 -0
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/references/final-composition-board.md +18 -0
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/scripts/build-final-composition-spec.mjs +38 -8
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/scripts/build-final-composition-spec.test.mjs +107 -0
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/scripts/final-composition-board.mjs +32 -0
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/scripts/final-composition-board.test.mjs +48 -0
- package/dist/skill-bundle/.codex/tradejs-skill-bundle.json +12 -10
- package/package.json +1 -1
|
@@ -52,6 +52,11 @@ exclusions, recovery additions, gate replacements, feature inventory, and
|
|
|
52
52
|
baseline-vs-candidate tables. Read `references/gate-ablation.md` for its
|
|
53
53
|
expression grammar and report contract.
|
|
54
54
|
|
|
55
|
+
For calendar-duration stability diagnostics from frozen realized equity, use
|
|
56
|
+
`scripts/equity-stability.mjs` as documented in the same reference. It reports
|
|
57
|
+
time under water and recovery duration without rebuilding approvals. Keep
|
|
58
|
+
full-history diagnostics separate from development-only candidate selection.
|
|
59
|
+
|
|
55
60
|
Mandatory rule:
|
|
56
61
|
|
|
57
62
|
- Do not create `/tmp` parsers, heredoc ESM replays, or strategy-specific
|
|
@@ -220,6 +220,18 @@ With no tuningSince, all earlier rows form development and tuning is empty.
|
|
|
220
220
|
Exact boundaries override ratios; use the parent development timestamp groups
|
|
221
221
|
to choose the shared 60/40 calendar boundary, rather than moving it per candidate.
|
|
222
222
|
|
|
223
|
+
Explicit `--windowStart` / `--windowEnd` bounds also filter original source rows
|
|
224
|
+
**before** payload reconstruction, deterministic gate evaluation, feature inventory
|
|
225
|
+
and variant matching. The loader uses the source decision timestamp and half-open
|
|
226
|
+
`[start, end)` membership, retaining the original cross-shard row sequence for
|
|
227
|
+
approval-identity comparisons. With explicit bounds, missing/invalid timestamps
|
|
228
|
+
are skipped before evaluation; without bounds they fail. Invalid, incomplete or
|
|
229
|
+
nonascending bounds fail before reading rows. JSON `sourceSelection` records read,
|
|
230
|
+
pre-window, at/after-end, invalid-timestamp and selected counts. A development-only
|
|
231
|
+
window therefore cannot evaluate reserved-tail gates or expose their features,
|
|
232
|
+
even though it streams the frozen full export. This does not maturity-seal labels:
|
|
233
|
+
selected development decisions can still have completed outcomes after its end.
|
|
234
|
+
|
|
223
235
|
Use `--windowStart <UTC> --windowEnd <UTC>` to compare candidates over the same
|
|
224
236
|
calendar window. The start is inclusive, and the end is exclusive. Full-period
|
|
225
237
|
cadence and terminal windows use these bounds instead of each export's first
|
|
@@ -387,6 +399,103 @@ never split between train/tuning/test.
|
|
|
387
399
|
|
|
388
400
|
## Maintenance Rule
|
|
389
401
|
|
|
402
|
+
### Calendar equity stability diagnostics
|
|
403
|
+
|
|
404
|
+
Use `scripts/equity-stability.mjs --input <ablation.json> --output <new.json>`
|
|
405
|
+
for calendar-weighted diagnostics from checksum-bound `realized.equity`.
|
|
406
|
+
It does not reconstruct approvals or recompute trade outcomes. It holds the
|
|
407
|
+
recorded closed-trade equity constant between observations, including inactive
|
|
408
|
+
time, and reports calendar ulcer index, underwater share, maximum continuous
|
|
409
|
+
underwater duration and maximum peak-to-recovery duration. Unrecovered terminal
|
|
410
|
+
episodes are included and explicitly right-censored. These are closed-trade
|
|
411
|
+
diagnostics, not intratrade or capital-return measures. Full-period diagnostics
|
|
412
|
+
must not be used to tune rules on a previously reserved historical tail.
|
|
413
|
+
The existing `ulcerIndex` remains trade-observation weighted and unchanged.
|
|
414
|
+
Run `node --test scripts/equity-stability.test.mjs` after changes.
|
|
415
|
+
|
|
416
|
+
### Optional monthly funnel and named-policy comparison
|
|
417
|
+
|
|
418
|
+
Use `--monthlyCohorts --cohortPath <payload.path>` with explicit comparison
|
|
419
|
+
window bounds to retain a generic UTC calendar-month funnel. Each month has
|
|
420
|
+
source-export and selected-gate summaries for ALL, LONG, SHORT and observed
|
|
421
|
+
payload cohorts, including zero-row months. Month cadence uses its actual
|
|
422
|
+
clipped calendar bounds. This diagnostic describes opportunities in the
|
|
423
|
+
completed-trade export, not every detector setup, attempted order or runtime
|
|
424
|
+
fill. Missing cache candles can suppress that source flow. Coverage remains a
|
|
425
|
+
diagnostic and must never unlock approval.
|
|
426
|
+
|
|
427
|
+
Use `--compareTo <variant-name>` (or `baseline` for the compiled gate) for exact
|
|
428
|
+
approval-set differences against a named policy. `comparisons` contains added
|
|
429
|
+
and removed identities and existing full/terminal, development/test, direction,
|
|
430
|
+
cost-stress and optional completed-trade summaries. The existing variant
|
|
431
|
+
`added`/`removed` fields still compare with the compiled baseline; do not rename
|
|
432
|
+
them as differences against a custom control. These options add no policy,
|
|
433
|
+
change no approvals and leave existing metrics unchanged.
|
|
434
|
+
|
|
435
|
+
The exported `formatGateComparisonContract` presentation API renders the fixed
|
|
436
|
+
AI reporting tables directly from two structured ablation reports and named
|
|
437
|
+
policies. It supports a frozen old control versus the same gate on a new core
|
|
438
|
+
export without recomputing metrics or silently using the new compiled baseline.
|
|
439
|
+
It rejects mismatched explicit calendar windows, outer test boundaries or
|
|
440
|
+
quality thresholds. Pass lineage/header, acceptance checks and conclusion
|
|
441
|
+
explicitly; unknown execution and reject-reason evidence stays `n/a`.
|
|
442
|
+
|
|
443
|
+
### Optional data-quality and adverse-cost diagnostics
|
|
444
|
+
|
|
445
|
+
Use `--featurePattern '<regex>' --cohortPath '<payload.path>'` to add
|
|
446
|
+
`featureAvailabilityAudit` to JSON reports. The cohort path is relative to the
|
|
447
|
+
rebuilt payload; for example,
|
|
448
|
+
`additionalIndicators.tradingPatternsContext.selectedPattern`. Audit groups
|
|
449
|
+
use UTC calendar year, direction, and cohort. Each observed matching primitive
|
|
450
|
+
path reports available, null, missing, invalid, present-approved, and
|
|
451
|
+
present-rejected counts. False and zero are present values. Arrays are not
|
|
452
|
+
expanded. Paths absent from every payload cannot be inferred from a regex and
|
|
453
|
+
are not fabricated. These snapshots stay separate from approval features:
|
|
454
|
+
presence and cohort membership never change a gate decision.
|
|
455
|
+
|
|
456
|
+
Use `--costStressBps 2,5,10` to add per-gate `costStress` JSON diagnostics.
|
|
457
|
+
Each number is additional adverse slippage in basis points on **each** entry
|
|
458
|
+
and exit. The tool selects original approvals once, then subtracts
|
|
459
|
+
`closedQty * (entryPrice + exitPrice) * bps / 10000` from their net PnL.
|
|
460
|
+
It uses `qty` only when `closedQty` is absent, and accepts actual execution
|
|
461
|
+
prices only from the original export's `tradeResult`; requested signal prices
|
|
462
|
+
are not substitutes. Historical quantity, risk and approval identities remain
|
|
463
|
+
unchanged. This is arithmetic cost stress, not a new execution simulation.
|
|
464
|
+
|
|
465
|
+
Reports retain full/terminal, development/test, three development blocks and
|
|
466
|
+
ALL/LONG/SHORT summaries through the existing metric functions. If any approved
|
|
467
|
+
row in a cohort lacks valid economics, that cohort's `metrics` and
|
|
468
|
+
`additionalCost` are null (render as `n/a`), with explicit complete/missing row
|
|
469
|
+
counts. Complete directional cohorts remain measurable even when aggregate
|
|
470
|
+
economics are unavailable. The summaries keep the existing decision-time metric
|
|
471
|
+
ordering; they are not a substitute for exit-time realized portfolio drawdown
|
|
472
|
+
or occupancy-sensitive backtests. Both diagnostic options are opt-in, leave
|
|
473
|
+
original report fields unchanged, and do not create additional gate candidates.
|
|
474
|
+
|
|
475
|
+
Use `--realizedMetrics` for additional `baseline.realized` and
|
|
476
|
+
`variant.realized` JSON evidence. Original approvals and decision-time metrics
|
|
477
|
+
stay unchanged. This option requires explicit `--windowStart` and `--windowEnd`;
|
|
478
|
+
the last signal is not a valid completion-window anchor. The tool joins the selected rows to their own original
|
|
479
|
+
`tradeResult.netProfit` and `tradeResult.exitTimestamp`, requires finite values
|
|
480
|
+
and agreement with exported row profit, and reuses the existing metric and
|
|
481
|
+
equity functions after sorting by actual completion time. Full and terminal
|
|
482
|
+
windows are half-open, anchored to the common immutable window end; terminal
|
|
483
|
+
membership uses exit timestamps. Train/test and three development cohorts are
|
|
484
|
+
first assigned by original decision timestamps, then exit-ordered within each
|
|
485
|
+
cohort. Development trades may finish after the decision partition boundary;
|
|
486
|
+
these are retrospective completed-outcome cohorts, not maturity-sealed training
|
|
487
|
+
labels. Cohort cadence uses the full original decision-calendar bounds, including
|
|
488
|
+
inactive days, with the same denominator for ALL and each direction. Invalid
|
|
489
|
+
signal identities, duplicate approvals and exits preceding signals fail loudly;
|
|
490
|
+
out-of-window completed outcomes are counted explicitly. Zero-PnL outcomes are
|
|
491
|
+
flat (neither wins nor losses), matching gate metrics, unlike the raw-core
|
|
492
|
+
Redis-compatible zero-as-loss convention. The additional section also retains directions and year/direction/cohort
|
|
493
|
+
outcomes, with year assigned by decision timestamp. Missing economics produce
|
|
494
|
+
null periods/equity, never substitute signal time or guessed outcome. A selector
|
|
495
|
+
using `metricBasis=completed-trade` must fail rather than consume incomplete
|
|
496
|
+
realized evidence. Approval-event cadence and fan-out remain decision-time
|
|
497
|
+
diagnostics; completed-trade cadence is a separate metric.
|
|
498
|
+
|
|
390
499
|
Do not create another `/tmp` parser, heredoc ESM replay, or strategy-specific
|
|
391
500
|
one-off script for capabilities that belong here. Extend this script and its
|
|
392
501
|
`node:test` coverage, then update this reference and `SKILL.md` when the
|