create-tradejs 3.1.29-beta.292 → 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 +8 -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/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-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 +24 -11
- package/dist/skill-bundle/.codex/skills/strategy-improvement-research/references/final-composition-board.md +22 -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 +10 -0
- package/dist/skill-bundle/.codex/skills/strategy-research/SKILL.md +12 -1
- package/dist/skill-bundle/.codex/tradejs-skill-bundle.json +17 -13
- 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`.
|
|
@@ -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 и не сглаживание.
|