create-tradejs 3.1.29-beta.291 → 3.1.29-beta.296
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 +15 -7
- package/dist/skill-bundle/.codex/skills/ai-train-local-research/references/gate-ablation.md +35 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/SKILL.md +8 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/references/production-baseline.md +52 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/references/research-comparison-charts.md +113 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/references/research-retention.md +6 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/scripts/research-comparison-chart.mjs +597 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/scripts/research-comparison-chart.test.mjs +144 -0
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/scripts/retire-worktree.py +6 -1
- package/dist/skill-bundle/.codex/skills/strategy-backtest-research/scripts/retire-worktree.test.py +25 -0
- package/dist/skill-bundle/.codex/skills/strategy-candidate-compare/SKILL.md +14 -0
- package/dist/skill-bundle/.codex/skills/strategy-candidate-report/SKILL.md +12 -2
- package/dist/skill-bundle/.codex/skills/strategy-forward-start/SKILL.md +13 -0
- package/dist/skill-bundle/.codex/skills/strategy-improvement-plan/SKILL.md +6 -0
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/SKILL.md +35 -11
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/references/final-composition-board.md +33 -7
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/scripts/final-composition-board.mjs +74 -203
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/scripts/final-composition-board.test.mjs +23 -9
- package/dist/skill-bundle/.codex/skills/strategy-period-revalidate/SKILL.md +14 -1
- package/dist/skill-bundle/.codex/skills/strategy-research/SKILL.md +12 -1
- package/dist/skill-bundle/.codex/tradejs-skill-bundle.json +21 -17
- package/package.json +1 -1
|
@@ -129,6 +129,14 @@ rounding, and `n/a` rules exactly. Use the full contract unless the user
|
|
|
129
129
|
explicitly asks for one narrow metric. Do not improvise a shorter alternative
|
|
130
130
|
or silently omit unavailable metrics.
|
|
131
131
|
|
|
132
|
+
For every baseline-versus-gate comparison, also read
|
|
133
|
+
[`../strategy-backtest-research/references/research-comparison-charts.md`](../strategy-backtest-research/references/research-comparison-charts.md)
|
|
134
|
+
and render the mandatory three-panel SVG/PNG before retention cleanup. The
|
|
135
|
+
current gate is the explicit `BASELINE`; each frozen alternative is a
|
|
136
|
+
`CANDIDATE`. Ablation slices and volatility/direction groups are
|
|
137
|
+
`DIAGNOSTIC`, never candidates. The chart uses the same completed-trade window,
|
|
138
|
+
costs, risk unit, and partitions as the metrics report.
|
|
139
|
+
|
|
132
140
|
For every approved-stream summary, calculate `PnL/trade` as total approved PnL
|
|
133
141
|
divided by completed approved trades. Never substitute the backtest CLI progress
|
|
134
142
|
`avg`, which is PnL per completed test/symbol. Use `n/a` when `N = 0`.
|
|
@@ -277,9 +285,10 @@ Mandatory validation sections for gate work:
|
|
|
277
285
|
target/benchmark/global, and whether it depends on
|
|
278
286
|
lookback/window/cache/provider settings.
|
|
279
287
|
- **Walk-forward validation**: when the export spans enough history, validate
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
288
|
+
a recurring refit procedure with the A/B/C protocol in
|
|
289
|
+
[gate-ablation.md](references/gate-ablation.md#compare-refitting-and-ticker-groups).
|
|
290
|
+
Month/quarter buckets of one frozen rule measure stability. Walk-forward
|
|
291
|
+
reselects the rule from earlier mature labels for each evaluation window.
|
|
283
292
|
- **Acceptance gates**: define minimum validation support, maximum symbol
|
|
284
293
|
and event concentration, acceptable losing months, max loss streak,
|
|
285
294
|
PF/drawdown improvement, and cadence/capacity bounds before recommending
|
|
@@ -564,7 +573,7 @@ Minimum checks:
|
|
|
564
573
|
- classify old pockets as `keep`, `round`, `replace`, `disable`, or
|
|
565
574
|
`needs-more-data`
|
|
566
575
|
- include live-env parity and feature provenance tables in the analysis
|
|
567
|
-
-
|
|
576
|
+
- apply the validation sections above, including threshold sensitivity
|
|
568
577
|
- define acceptance gates before treating a pocket as production-ready
|
|
569
578
|
- use a negative control for unusually strong or highly specific pockets
|
|
570
579
|
- reject approval rules based on data-count or availability fields such as
|
|
@@ -572,7 +581,6 @@ Minimum checks:
|
|
|
572
581
|
size; use those only as missing/stale-data guards
|
|
573
582
|
- reject high-precision pocket thresholds until they have been rounded to a
|
|
574
583
|
defensible value and replayed again
|
|
575
|
-
- run sensitivity checks around each proposed numeric threshold
|
|
576
584
|
- report train and validation support separately when using `ai-pocket-search`
|
|
577
585
|
or a custom split, but label any partition used for selection as tuning
|
|
578
586
|
- group partitions by timestamp and report independent-event support separately
|
|
@@ -580,8 +588,8 @@ Minimum checks:
|
|
|
580
588
|
- report event clustering and capacity stress for every terminal window
|
|
581
589
|
- require a target-specific discriminator or portfolio throttle for
|
|
582
590
|
benchmark/global pockets that can approve many symbols on one timestamp
|
|
583
|
-
-
|
|
584
|
-
|
|
591
|
+
- compare the current gate with the proposed gate. Use the A/B/C protocol
|
|
592
|
+
when the claim concerns the incremental value of ticker groups
|
|
585
593
|
- require boundary tests and a passive-rollout plan for implemented gate changes
|
|
586
594
|
- clean up old disabled pockets instead of leaving dead constants or prompt
|
|
587
595
|
fields behind
|
|
@@ -884,3 +884,38 @@ For backtest exports with profiles, use `--ai` with the profile source. A plain
|
|
|
884
884
|
`--fast` run without export does not exercise optional profile enrichment. Verify
|
|
885
885
|
`payload.featureSnapshot` in actual rows before claiming feature availability or
|
|
886
886
|
measuring its overhead. Profiles do not manufacture a missing baseContext.
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
## Compare refitting and ticker groups
|
|
890
|
+
|
|
891
|
+
Use the same core export and freeze the search budget, eligibility, treatment of
|
|
892
|
+
unknowns and calendar before opening outcomes. A is the current gate. B searches
|
|
893
|
+
with the prior feature list. C repeats B with the declared registered ticker
|
|
894
|
+
groups. Report B–A, C–B and C–A. For a single frozen split, use the existing
|
|
895
|
+
variants report and `--compareTo` for the direct B/C difference.
|
|
896
|
+
|
|
897
|
+
For a recurring refit, use the existing search command from Project:
|
|
898
|
+
|
|
899
|
+
```sh
|
|
900
|
+
yarn exec tradejs ai-pocket-search --file <export.jsonl> -n 0 \
|
|
901
|
+
--scope all --validationSplit 0 --testSince <outer-test-UTC> --sealTest \
|
|
902
|
+
--objective add-to-gate --walkForwardPlan <plan.json> --output <report.json>
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
The plan has `folds` with numeric UTC milliseconds `trainStart`, `testStart` and
|
|
906
|
+
`testEnd`, `baselineFeatures` with exact eligible feature paths, `tickerGroups`
|
|
907
|
+
with registered paths such as `registered.ticker.moneyGroup`, and
|
|
908
|
+
`minimumEvents` for timestamp support. Optional `sensitivityFraction` reports
|
|
909
|
+
one-at-a-time changes to nonzero numerical thresholds. This is a diagnostic
|
|
910
|
+
around the selected rule. It does not select a replacement threshold.
|
|
911
|
+
|
|
912
|
+
Test windows are disjoint and entirely inside outer development. Each fold
|
|
913
|
+
uses labels closed strictly before its training cutoff and reports evaluation
|
|
914
|
+
labels closed before the evaluation end. Both searches use the same rows.
|
|
915
|
+
If a search finds no stable pocket, the fold records a fallback to A. If
|
|
916
|
+
support is insufficient, the fold is marked and the aggregate covers only
|
|
917
|
+
evaluated folds. Counts by timestamp measure support, while market-episode
|
|
918
|
+
dependence still needs diagnosis. The report uses decision-time approval-set
|
|
919
|
+
economics. Verify shortlisted frozen rules in native execution where admissions
|
|
920
|
+
change position occupancy. A historical fold previously used to choose rules or
|
|
921
|
+
settings is retrospective evidence.
|
|
@@ -155,6 +155,14 @@ deterministic gate on each exact core export, including the baseline export, and
|
|
|
155
155
|
compares only the resulting `core + own gate` compositions. Raw-core metrics
|
|
156
156
|
remain diagnostic and must never be mixed into the final-composition chart.
|
|
157
157
|
|
|
158
|
+
Before returning any baseline/control-versus-candidate result, read
|
|
159
|
+
[`references/research-comparison-charts.md`](references/research-comparison-charts.md)
|
|
160
|
+
and create its mandatory three-panel chart from the reconciled completed-trade
|
|
161
|
+
stream. The chart must name exactly one `BASELINE`, label every other line as
|
|
162
|
+
`CANDIDATE`, `REFERENCE`, or `DIAGNOSTIC`, and show cumulative net PnL,
|
|
163
|
+
realized drawdown, and loss streak on one UTC scale. A PnL-only curve or a
|
|
164
|
+
legend that leaves roles implicit is not a complete comparison handoff.
|
|
165
|
+
|
|
158
166
|
## Required Core Metric Cohorts
|
|
159
167
|
|
|
160
168
|
For every reported config and full or terminal window, present one table with
|
package/dist/skill-bundle/.codex/skills/strategy-backtest-research/references/production-baseline.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Production baseline
|
|
2
|
+
|
|
3
|
+
Use this rule for every strategy research, candidate report, comparison,
|
|
4
|
+
revalidation, and research chart.
|
|
5
|
+
|
|
6
|
+
## Resolve the baseline before research
|
|
7
|
+
|
|
8
|
+
1. Check the authenticated TradeJS runtime first: call `tradejs_info`, then
|
|
9
|
+
`runtime_get_status`, `runtime_list_strategies`, and
|
|
10
|
+
`runtime_get_verification` for the Git-owned `production` deployment. Bind
|
|
11
|
+
the result to the exact user, deployment, account, package version,
|
|
12
|
+
`strategyRevision`, `deploymentCompositionId`, full effective core config,
|
|
13
|
+
deterministic gate/context, direction policy, interval, universe, and
|
|
14
|
+
runtime risk value. Local Redis, a backtest config, the newest research
|
|
15
|
+
artifact, or an installed stable package is not production truth.
|
|
16
|
+
2. If the strategy is declared in that production deployment, its exact
|
|
17
|
+
deployed composition is the one and only research `BASELINE`. Operational
|
|
18
|
+
pause state does not change the composition identity. A previously selected
|
|
19
|
+
candidate, historical control, rebuilt gate, or old stable package remains
|
|
20
|
+
`CANDIDATE`, `REFERENCE`, or `DIAGNOSTIC`; it must not replace production.
|
|
21
|
+
3. A deployment does not have a fixed research `N`. Re-evaluate the exact
|
|
22
|
+
production composition on the frozen common research window, universe,
|
|
23
|
+
costs, execution assumptions, and normalized risk before showing its trade
|
|
24
|
+
count or economics. Never reuse `N` from an older control and label it as
|
|
25
|
+
production.
|
|
26
|
+
4. If live verification is unavailable, use the newest checksum-verified
|
|
27
|
+
immutable deployment manifest and label the baseline identity
|
|
28
|
+
`production-unconfirmed`. Do not guess from current source or local config.
|
|
29
|
+
If the strategy is absent from production, say so and freeze one explicit
|
|
30
|
+
research control; label it `research baseline`, never `production`.
|
|
31
|
+
|
|
32
|
+
## Promote a deployed candidate to the next baseline
|
|
33
|
+
|
|
34
|
+
A selected candidate becomes the baseline for future research only after the
|
|
35
|
+
production handoff is complete and the deployed package/config manifest,
|
|
36
|
+
`strategyRevision`, `deploymentCompositionId`, account binding, enabled
|
|
37
|
+
declaration, and runtime ownership have been verified. Starting publication,
|
|
38
|
+
editing Project config, or creating a forward-ready handoff is not enough.
|
|
39
|
+
|
|
40
|
+
After successful verification, append an immutable production-baseline record
|
|
41
|
+
to the existing strategy release/candidate ledger. Link the selected candidate
|
|
42
|
+
and its evidence hashes to the verified deployment identity, record the
|
|
43
|
+
effective config/gate/context and risk provenance, mark it
|
|
44
|
+
`current-production-baseline`, and mark the previous production baseline as
|
|
45
|
+
superseded for subsequent research. Do not rewrite the original research
|
|
46
|
+
selection or its historical roles. If cutover or verification fails, the
|
|
47
|
+
candidate remains a candidate and the previous verified production composition
|
|
48
|
+
remains the baseline.
|
|
49
|
+
|
|
50
|
+
Every later study must resolve production again before trusting the ledger.
|
|
51
|
+
The ledger is the durable handoff and audit trail; the verified deployment is
|
|
52
|
+
the authority for what is current.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Стандарт сравнительных графиков исследования
|
|
2
|
+
|
|
3
|
+
Главный сравнительный график любого core-, AI-gate-, candidate- или
|
|
4
|
+
revalidation-исследования строится в одном формате. Вспомогательные scatter,
|
|
5
|
+
распределения и карточки сделок допустимы дополнительно, но не заменяют его.
|
|
6
|
+
|
|
7
|
+
## Обязательная форма
|
|
8
|
+
|
|
9
|
+
Один SVG/PNG содержит общий UTC-масштаб времени и три панели:
|
|
10
|
+
|
|
11
|
+
1. накопленный net PnL после комиссий и проскальзывания;
|
|
12
|
+
2. просадку от максимума того же net PnL;
|
|
13
|
+
3. последовательные убыточные завершённые сделки. Если сохранены только
|
|
14
|
+
точки equity, подпиши панель как последовательные отрицательные шаги equity.
|
|
15
|
+
|
|
16
|
+
Легенда обязана явно писать роль каждой линии: `BASELINE`, `CANDIDATE`,
|
|
17
|
+
`REFERENCE` или `DIAGNOSTIC`, затем понятное название, `N` и итоговый PnL с
|
|
18
|
+
единицей. Ровно одна линия имеет роль `BASELINE`. Подгруппы baseline или
|
|
19
|
+
кандидата не называются кандидатами. Если новых кандидатов нет, напиши это в
|
|
20
|
+
заголовке или подзаголовке и используй роли `REFERENCE`/`DIAGNOSTIC` для
|
|
21
|
+
остальных линий.
|
|
22
|
+
|
|
23
|
+
Указывай режим AI-gate в подписи каждой линии легенды. Для ядра без
|
|
24
|
+
дополнительных правил допуска пиши «чистый core · без AI-gate». Если у
|
|
25
|
+
варианта есть отдельное детерминированное правило допуска, укажи его название
|
|
26
|
+
и «без AI-gate». Для линии с AI-gate пиши «с AI-gate» и указывай версию или
|
|
27
|
+
название gate, если сравниваются несколько. Режим проверяй по сохранённой
|
|
28
|
+
конфигурации каждого прогона.
|
|
29
|
+
|
|
30
|
+
Все линии используют одинаковые окно, universe, интервал, расходы, исполнение
|
|
31
|
+
и нормализованный риск. Не смешивай raw core и gated composition на одном
|
|
32
|
+
финальном сравнении. Выделение заливкой обозначает заранее определённый новый
|
|
33
|
+
или holdout-период, а не выбранный после просмотра результата участок.
|
|
34
|
+
|
|
35
|
+
Перед построением прочитай
|
|
36
|
+
[`production-baseline.md`](production-baseline.md). Если стратегия есть в
|
|
37
|
+
`production`, ровно одна линия `BASELINE` обязана представлять её точную
|
|
38
|
+
текущую развёрнутую композицию. Старый research-control, stable-пакет или
|
|
39
|
+
кандидат из предыдущего исследования не может называться production baseline.
|
|
40
|
+
После подтверждённого развёртывания кандидата новый график показывает его как
|
|
41
|
+
`BASELINE`, а прежний baseline как `REFERENCE` или историческую линию. `N`
|
|
42
|
+
всегда относится к общему окну самого графика и не переносится из deployment
|
|
43
|
+
или старого исследования.
|
|
44
|
+
|
|
45
|
+
## Общий рендерер
|
|
46
|
+
|
|
47
|
+
Подготовь Project-owned JSON по схеме
|
|
48
|
+
`tradejs-research-comparison-chart/v1`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"schema": "tradejs-research-comparison-chart/v1",
|
|
53
|
+
"title": "Strategy 15m · сравнение AI-gates",
|
|
54
|
+
"subtitle": "Одинаковое окно, риск и расходы",
|
|
55
|
+
"universeLabel": "530 USDT-контрактов Bybit",
|
|
56
|
+
"pnlUnit": "USDT",
|
|
57
|
+
"window": {
|
|
58
|
+
"start": 1698019200000,
|
|
59
|
+
"end": 1794240000000,
|
|
60
|
+
"highlightStart": 1792713600000
|
|
61
|
+
},
|
|
62
|
+
"series": [
|
|
63
|
+
{
|
|
64
|
+
"id": "current-gate",
|
|
65
|
+
"label": "с AI-gate · действующий",
|
|
66
|
+
"role": "baseline",
|
|
67
|
+
"trades": [[1698253200000, 11.24]],
|
|
68
|
+
"metrics": { "trades": 1, "pnl": 11.24 }
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "candidate-gate",
|
|
72
|
+
"label": "с AI-gate · переобученный",
|
|
73
|
+
"role": "candidate",
|
|
74
|
+
"trades": [[1698253200000, 9.8]],
|
|
75
|
+
"metrics": { "trades": 1, "pnl": 9.8 }
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`trades` содержит завершённые сделки как `[exitTimestamp, netPnl]`. Рендерер
|
|
82
|
+
сам вычисляет equity, realized drawdown и loss streak. Для компактно сохранённой
|
|
83
|
+
истории можно передать `equity: [[timestamp, cumulativePnl]]` и обязательные
|
|
84
|
+
`metrics`; тогда панель streak отражает отрицательные шаги сохранённой equity,
|
|
85
|
+
что фиксируется в summary. Для подтверждённо пустого ряда передай пустую
|
|
86
|
+
`equity` с `equityStatus: "verified-empty"`, `N=0` и `PnL=0`; для ряда без
|
|
87
|
+
доступной кривой используй `equityStatus: "unavailable"`. Рендерер явно
|
|
88
|
+
пометит такие линии и не выдаст отсутствие наблюдений за нулевую equity.
|
|
89
|
+
|
|
90
|
+
Из `tradejs-project` запусти:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
yarn node "$TRADEJS_FRAMEWORK_REPOSITORY_ROOT/.codex/skills/strategy-backtest-research/scripts/research-comparison-chart.mjs" \
|
|
94
|
+
--spec data/research/<lineage>/comparison-chart.json \
|
|
95
|
+
--out data/research/<lineage>/comparison-chart
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Команда создаёт `.svg`, `.png` и `.summary.json`, не перезаписывает существующие
|
|
99
|
+
файлы и сохраняет контрольные суммы. SVG каноничен, PNG предназначен для чата.
|
|
100
|
+
Визуальное сокращение сохраняет локальные минимумы/максимумы каждой панели и не
|
|
101
|
+
меняет полные метрики.
|
|
102
|
+
|
|
103
|
+
## Доказательность и хранение
|
|
104
|
+
|
|
105
|
+
- Строй график только из reconciled completed-trade данных или из ранее
|
|
106
|
+
сохранённой checksum-bound equity.
|
|
107
|
+
- Если trade-level данные уже удалены по retention и equity не сохранена, не
|
|
108
|
+
восстанавливай кривую из агрегатов и не повторяй завершённое исследование
|
|
109
|
+
только ради картинки. Покажи сохранённый график или укажи ограничение.
|
|
110
|
+
- Сохрани spec, summary, SVG и PNG до очистки временных строк сделок. В заметке
|
|
111
|
+
зафиксируй их SHA-256 и роли линий.
|
|
112
|
+
- Прямые сегменты соединяют завершённые наблюдения только для представления;
|
|
113
|
+
это не внутрисделочная mark-to-market equity и не сглаживание.
|
package/dist/skill-bundle/.codex/skills/strategy-backtest-research/references/research-retention.md
CHANGED
|
@@ -194,3 +194,9 @@ receipt permanently. Prune stale registrations only after checking that their
|
|
|
194
194
|
directories are actually absent, and preserve their branch/commit identities
|
|
195
195
|
in the cleanup inventory. For Codex-managed worktrees attached to this chat,
|
|
196
196
|
prefer the app's archive tool, which preserves recoverable state.
|
|
197
|
+
|
|
198
|
+
Shared history bundles must be self-contained: verify and fetch them into an
|
|
199
|
+
empty isolated repository and run object integrity checks before retiring the
|
|
200
|
+
worktree. Verification against the source repository alone accepts incremental
|
|
201
|
+
bundles whose prerequisites happen to exist locally. Reject such a bundle,
|
|
202
|
+
retain the worktree, and do not issue a completed retirement receipt.
|