alphaspec 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- {alphaspec-0.3.0 → alphaspec-0.4.0}/CHANGELOG.md +18 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/PKG-INFO +8 -8
- {alphaspec-0.3.0 → alphaspec-0.4.0}/README.md +6 -6
- {alphaspec-0.3.0 → alphaspec-0.4.0}/README.zh-CN.md +6 -6
- alphaspec-0.4.0/conformance/cases/as019-short-on-stock.json +77 -0
- alphaspec-0.4.0/conformance/cases/as020-short-without-exit.json +68 -0
- alphaspec-0.4.0/conformance/cases/as021-duplicate-factor.json +48 -0
- alphaspec-0.4.0/conformance/cases/as022-topn-covers-all.json +42 -0
- alphaspec-0.4.0/conformance/cases/schema-binding-topn-in-0.4.json +44 -0
- alphaspec-0.4.0/conformance/cases/schema-factor-only-without-ranking.json +39 -0
- alphaspec-0.4.0/conformance/cases/schema-ranking-in-0.3.json +43 -0
- alphaspec-0.4.0/conformance/cases/schema-rule-only-without-dsl.json +43 -0
- alphaspec-0.4.0/conformance/cases/valid-factor-only.json +41 -0
- alphaspec-0.4.0/conformance/cases/valid-long-short-future.json +75 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/docs/MARKETS.md +20 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/docs/ROADMAP.md +13 -18
- {alphaspec-0.3.0 → alphaspec-0.4.0}/docs/RULES.md +24 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/docs/RUNTIME_API.md +36 -2
- {alphaspec-0.3.0 → alphaspec-0.4.0}/docs/SPEC.md +44 -2
- alphaspec-0.4.0/examples/artifacts/07-factor-quality-value.json +16 -0
- alphaspec-0.4.0/examples/artifacts/08-long-short-future.json +23 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/pyproject.toml +1 -1
- alphaspec-0.4.0/schema/0.4/artifact.schema.json +999 -0
- alphaspec-0.4.0/schema/0.4/capabilities.schema.json +230 -0
- alphaspec-0.4.0/schema/0.4/common.schema.json +96 -0
- alphaspec-0.4.0/schema/0.4/evidence.schema.json +152 -0
- alphaspec-0.4.0/schema/0.4/gate-result.schema.json +154 -0
- alphaspec-0.4.0/schema/0.4/score.schema.json +79 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/skills/alphaspec/SKILL.md +10 -1
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/__init__.py +1 -1
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/_resources.py +2 -2
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/cli.py +117 -16
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/client.py +37 -2
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/lints.py +52 -9
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/mcp_server.py +26 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/tests/test_client.py +52 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/tests/test_mcp_server.py +1 -1
- {alphaspec-0.3.0 → alphaspec-0.4.0}/.github/workflows/ci.yml +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/.github/workflows/pages.yml +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/.github/workflows/release.yml +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/.gitignore +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/LICENSE +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/catalog/i18n/en.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/catalog/indicators.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/README.md +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as001-unresolved-indicator.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as002-unresolved-param.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as003-htf-live-lookahead.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as004-indicator-cycle.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as005-unknown-type.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as006-unknown-param.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as007-cn-indicator-on-us-market.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as008-primary-only-timeframe-ignored.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as009-finer-than-primary.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as010-tick-timeframe.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as011-missing-suffix.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as012-ai-without-search-trials.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as013-exits-replace-exit-rule.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as013-no-exit.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as014-intraday-on-daily.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as015-unused-indicator.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as016-arm-without-trailing.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as017-entry-above-symbol-cap.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as017-not-for-atr-risk.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as018-scale-in-no-room.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as101-duplicate-symbol.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as102-all-null.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as103-asof-future.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as104-zero-as-missing.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/as105-weights-over-one.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-bare-number-operand.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-exit-zero.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-fill-timing-unknown.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-no-code-fields.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-noncanonical-timeframe.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-not-uses-rule.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-scale-in-averaging-down.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-score-without-direction.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-scores-and-weights.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-sizing-unsupported-mode.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-sizing-without-target.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-trade-settings-in-0.1.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/schema-universe-mode-conflict.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/score-valid.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/valid-minimal.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/valid-sizing-atr-pyramid.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/conformance/cases/valid-trade-settings.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/artifacts/01-ema-cross-us-equity.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/artifacts/02-rsi-reversion-params.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/artifacts/03-mtf-trend-pullback.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/artifacts/04-breakout-retest-sequence.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/artifacts/05-cn-limit-up-pullback.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/artifacts/06-trend-with-trade-settings.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/scores/01-model-scores-cn-stock.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/examples/scores/02-target-weights-us-equity.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.1/artifact.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.1/common.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.1/evidence.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.1/gate-result.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.1/score.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.2/artifact.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.2/common.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.2/evidence.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.2/gate-result.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.2/score.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.3/artifact.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.3/capabilities.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.3/common.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.3/evidence.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.3/gate-result.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/schema/0.3/score.schema.json +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/src/alphaspec/validate.py +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/tests/test_cli_reference.py +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/tests/test_conformance.py +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/tests/test_examples.py +0 -0
- {alphaspec-0.3.0 → alphaspec-0.4.0}/tools/export_indicator_catalog.py +0 -0
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 — 2026-10-12
|
|
4
|
+
|
|
5
|
+
- Contract 0.4 (`schema/0.4/`): factor-ranked strategies (`signalMode`, `factorBindings` with `factor` /
|
|
6
|
+
`direction` / `weight`, new `ranking` block; `dsl` optional for `FACTOR_ONLY`), short rules
|
|
7
|
+
(`dsl.shortEntry` / `dsl.shortExit`).
|
|
8
|
+
- Lint rules AS019 (short rules on a market that cannot be shorted), AS020 (short entry without a short
|
|
9
|
+
exit), AS021 (factor bound twice), AS022 (topN covers the whole symbol list).
|
|
10
|
+
- MARKETS.md: trading rules by market (lots, settlement, price limits, short selling).
|
|
11
|
+
- SPEC §4b–4d: factor strategies, short rules, score series.
|
|
12
|
+
- Client / CLI / MCP: `factors`, `submit-scores`, `scores`, `evidence`.
|
|
13
|
+
- RUNTIME_API: factor evaluation window (2 + 1 years), score series, evidence, new `RUNTIME_*` codes.
|
|
14
|
+
- Examples 07 (quality + value, monthly) and 08 (long/short futures).
|
|
15
|
+
- `alphaspec validate` reads files holding a JSON array or JSON lines; `submit_scores` waits up to 300 s.
|
|
16
|
+
- Reference runtime: factor backtests now report in-sample / out-of-sample segments, accept an explicit
|
|
17
|
+
symbol list and record which artifact they evaluated (all three were missing); factor + rule strategies
|
|
18
|
+
gate on rank only; score uploads write in bulk (30k rows in seconds instead of minutes); evidence judges
|
|
19
|
+
intraday strategies by their last evaluated bar.
|
|
20
|
+
|
|
3
21
|
## 0.3.0 — 2026-10-12
|
|
4
22
|
|
|
5
23
|
- Contract 0.3 (`schema/0.3/`): new `capabilities` document kind; `gate-result.tradeSettings` reports the exits,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: alphaspec
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: The auditable contract between alpha and execution: JSON schemas, a validator and lint rules for declarative trading strategies.
|
|
5
5
|
Project-URL: Homepage, https://github.com/openalpha-dev/alphaspec
|
|
6
6
|
Project-URL: Documentation, https://github.com/openalpha-dev/alphaspec#readme
|
|
7
7
|
Project-URL: Changelog, https://github.com/openalpha-dev/alphaspec/blob/main/CHANGELOG.md
|
|
8
|
-
Project-URL: Schemas, https://openalpha-dev.github.io/alphaspec/schema/0.
|
|
8
|
+
Project-URL: Schemas, https://openalpha-dev.github.io/alphaspec/schema/0.4/
|
|
9
9
|
Author: OpenAlpha contributors
|
|
10
10
|
License-Expression: Apache-2.0
|
|
11
11
|
License-File: LICENSE
|
|
@@ -80,15 +80,15 @@ Two ways in, written by you or your agent:
|
|
|
80
80
|
|
|
81
81
|
| Level | Document | For | You send |
|
|
82
82
|
|---|---|---|---|
|
|
83
|
-
| **L1 · Score** | [`score`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
84
|
-
| **L2 · Artifact** | [`artifact`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
83
|
+
| **L1 · Score** | [`score`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/score.schema.json) | ML teams, factor researchers | `(asOf, market, symbol, score)` or target weights |
|
|
84
|
+
| **L2 · Artifact** | [`artifact`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/artifact.schema.json) | rule-based strategies, AI agents | a rule tree with parameters, universe and risk overrides |
|
|
85
85
|
|
|
86
86
|
Two ways back, written by the runtime and never by the submitter:
|
|
87
87
|
|
|
88
88
|
| Document | What it answers |
|
|
89
89
|
|---|---|
|
|
90
|
-
| [`gate-result`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
91
|
-
| [`evidence`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
90
|
+
| [`gate-result`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/gate-result.schema.json) | Did it pass, judged on figures the runtime **recomputed itself**, check by check |
|
|
91
|
+
| [`evidence`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/evidence.schema.json) | What happened in a real market: rejections, slippage, fills, deviation from target, every number with its caliber |
|
|
92
92
|
|
|
93
93
|
The way back is the point. Research tools see prices, news and filings; none of that says whether
|
|
94
94
|
an order was rejected, how much slippage it paid, or how far the portfolio drifted from its target.
|
|
@@ -110,7 +110,7 @@ A short artifact:
|
|
|
110
110
|
|
|
111
111
|
```json
|
|
112
112
|
{
|
|
113
|
-
"contractVersion": "0.
|
|
113
|
+
"contractVersion": "0.4",
|
|
114
114
|
"kind": "artifact",
|
|
115
115
|
"title": "RSI rebound above the 60-day average",
|
|
116
116
|
"market": "cn_stock",
|
|
@@ -319,7 +319,7 @@ Every document carries `contractVersion`, so a runtime can refuse what it does n
|
|
|
319
319
|
Versions are additive and each keeps its own schema directory: a document is validated
|
|
320
320
|
against the version it declares. 0.2 adds trade settings (`exits`, `sizing`, `execution`);
|
|
321
321
|
see [docs/ROADMAP.md](https://github.com/openalpha-dev/alphaspec/blob/main/docs/ROADMAP.md). Schemas are published at their `$id` URLs, e.g.
|
|
322
|
-
`https://openalpha-dev.github.io/alphaspec/schema/0.
|
|
322
|
+
`https://openalpha-dev.github.io/alphaspec/schema/0.4/artifact.schema.json`.
|
|
323
323
|
|
|
324
324
|
## License
|
|
325
325
|
|
|
@@ -53,15 +53,15 @@ Two ways in, written by you or your agent:
|
|
|
53
53
|
|
|
54
54
|
| Level | Document | For | You send |
|
|
55
55
|
|---|---|---|---|
|
|
56
|
-
| **L1 · Score** | [`score`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
57
|
-
| **L2 · Artifact** | [`artifact`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
56
|
+
| **L1 · Score** | [`score`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/score.schema.json) | ML teams, factor researchers | `(asOf, market, symbol, score)` or target weights |
|
|
57
|
+
| **L2 · Artifact** | [`artifact`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/artifact.schema.json) | rule-based strategies, AI agents | a rule tree with parameters, universe and risk overrides |
|
|
58
58
|
|
|
59
59
|
Two ways back, written by the runtime and never by the submitter:
|
|
60
60
|
|
|
61
61
|
| Document | What it answers |
|
|
62
62
|
|---|---|
|
|
63
|
-
| [`gate-result`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
64
|
-
| [`evidence`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
63
|
+
| [`gate-result`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/gate-result.schema.json) | Did it pass, judged on figures the runtime **recomputed itself**, check by check |
|
|
64
|
+
| [`evidence`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/evidence.schema.json) | What happened in a real market: rejections, slippage, fills, deviation from target, every number with its caliber |
|
|
65
65
|
|
|
66
66
|
The way back is the point. Research tools see prices, news and filings; none of that says whether
|
|
67
67
|
an order was rejected, how much slippage it paid, or how far the portfolio drifted from its target.
|
|
@@ -83,7 +83,7 @@ A short artifact:
|
|
|
83
83
|
|
|
84
84
|
```json
|
|
85
85
|
{
|
|
86
|
-
"contractVersion": "0.
|
|
86
|
+
"contractVersion": "0.4",
|
|
87
87
|
"kind": "artifact",
|
|
88
88
|
"title": "RSI rebound above the 60-day average",
|
|
89
89
|
"market": "cn_stock",
|
|
@@ -292,7 +292,7 @@ Every document carries `contractVersion`, so a runtime can refuse what it does n
|
|
|
292
292
|
Versions are additive and each keeps its own schema directory: a document is validated
|
|
293
293
|
against the version it declares. 0.2 adds trade settings (`exits`, `sizing`, `execution`);
|
|
294
294
|
see [docs/ROADMAP.md](https://github.com/openalpha-dev/alphaspec/blob/main/docs/ROADMAP.md). Schemas are published at their `$id` URLs, e.g.
|
|
295
|
-
`https://openalpha-dev.github.io/alphaspec/schema/0.
|
|
295
|
+
`https://openalpha-dev.github.io/alphaspec/schema/0.4/artifact.schema.json`.
|
|
296
296
|
|
|
297
297
|
## License
|
|
298
298
|
|
|
@@ -48,15 +48,15 @@ AlphaSpec 守的是那道边界:**跨进执行层的东西,必须是一份
|
|
|
48
48
|
|
|
49
49
|
| 档位 | 文档 | 适合谁 | 提交什么 |
|
|
50
50
|
|---|---|---|---|
|
|
51
|
-
| **L1 · Score** | [`score`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
52
|
-
| **L2 · Artifact** | [`artifact`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
51
|
+
| **L1 · Score** | [`score`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/score.schema.json) | 机构 ML 团队、因子研究员 | `(asOf, market, symbol, score)`,或者直接给目标权重 |
|
|
52
|
+
| **L2 · Artifact** | [`artifact`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/artifact.schema.json) | 规则策略、AI agent | 一棵完整的规则树,加上参数、标的范围和风控设置 |
|
|
53
53
|
|
|
54
54
|
两种回执,只由执行系统生成,提交方不能自己填:
|
|
55
55
|
|
|
56
56
|
| 文档 | 回答什么问题 |
|
|
57
57
|
|---|---|
|
|
58
|
-
| [`gate-result`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
59
|
-
| [`evidence`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.
|
|
58
|
+
| [`gate-result`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/gate-result.schema.json) | 门禁过没过。绩效由执行系统**自己重算**,逐项列出判据 |
|
|
59
|
+
| [`evidence`](https://github.com/openalpha-dev/alphaspec/blob/main/schema/0.4/evidence.schema.json) | 在真实市场里发生了什么:拒单、滑点、成交、与目标持仓的偏差,每个数字都注明口径 |
|
|
60
60
|
|
|
61
61
|
回执才是重点。研究端看得到行情、新闻和研报,却看不到一笔委托有没有被拒、付了多少滑点、
|
|
62
62
|
组合离目标持仓偏了多远——这些只有执行系统知道,而且只有当它用研究端读得懂的格式说出来,才算数。
|
|
@@ -77,7 +77,7 @@ flowchart LR
|
|
|
77
77
|
|
|
78
78
|
```json
|
|
79
79
|
{
|
|
80
|
-
"contractVersion": "0.
|
|
80
|
+
"contractVersion": "0.4",
|
|
81
81
|
"kind": "artifact",
|
|
82
82
|
"title": "RSI 超卖反弹 + 站上 60 日线",
|
|
83
83
|
"market": "cn_stock",
|
|
@@ -266,7 +266,7 @@ docs/ 字段语义、检查规则、市场、运行时接口
|
|
|
266
266
|
文档按自己声明的版本校验。0.2 加入交易设置(`exits` 止盈止损、`sizing` 仓位、`execution` 成交时点),
|
|
267
267
|
路线图见 [docs/ROADMAP.md](https://github.com/openalpha-dev/alphaspec/blob/main/docs/ROADMAP.md)。
|
|
268
268
|
Schema 发布在各自的 `$id` 地址,例如
|
|
269
|
-
`https://openalpha-dev.github.io/alphaspec/schema/0.
|
|
269
|
+
`https://openalpha-dev.github.io/alphaspec/schema/0.4/artifact.schema.json`。
|
|
270
270
|
|
|
271
271
|
## 许可证
|
|
272
272
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A-shares cannot be sold short.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "EMA 20/60 crossover",
|
|
7
|
+
"note": "The smallest useful artifact: two indicators, one entry, one exit, a fixed symbol list.",
|
|
8
|
+
"market": "cn_stock",
|
|
9
|
+
"timeframe": "1d",
|
|
10
|
+
"dsl": {
|
|
11
|
+
"version": 1,
|
|
12
|
+
"indicators": {
|
|
13
|
+
"fast": {
|
|
14
|
+
"type": "EMA",
|
|
15
|
+
"period": 20
|
|
16
|
+
},
|
|
17
|
+
"slow": {
|
|
18
|
+
"type": "EMA",
|
|
19
|
+
"period": 60
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"entry": {
|
|
23
|
+
"type": "CROSS_UP",
|
|
24
|
+
"left": {
|
|
25
|
+
"ind": "fast"
|
|
26
|
+
},
|
|
27
|
+
"right": {
|
|
28
|
+
"ind": "slow"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"exit": {
|
|
32
|
+
"type": "CROSS_DOWN",
|
|
33
|
+
"left": {
|
|
34
|
+
"ind": "fast"
|
|
35
|
+
},
|
|
36
|
+
"right": {
|
|
37
|
+
"ind": "slow"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"shortEntry": {
|
|
41
|
+
"type": "CROSS_DOWN",
|
|
42
|
+
"left": {
|
|
43
|
+
"ind": "fast"
|
|
44
|
+
},
|
|
45
|
+
"right": {
|
|
46
|
+
"ind": "slow"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"shortExit": {
|
|
50
|
+
"type": "CROSS_UP",
|
|
51
|
+
"left": {
|
|
52
|
+
"ind": "fast"
|
|
53
|
+
},
|
|
54
|
+
"right": {
|
|
55
|
+
"ind": "slow"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"universe": {
|
|
60
|
+
"mode": "SYMBOLS",
|
|
61
|
+
"symbols": [
|
|
62
|
+
"600519.SH"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"producer": {
|
|
66
|
+
"kind": "HUMAN",
|
|
67
|
+
"name": "example"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"expect": {
|
|
71
|
+
"valid": false,
|
|
72
|
+
"errors": [
|
|
73
|
+
"AS019"
|
|
74
|
+
],
|
|
75
|
+
"warnings": []
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Short entry and no way to cover.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "EMA 20/60 crossover",
|
|
7
|
+
"note": "The smallest useful artifact: two indicators, one entry, one exit, a fixed symbol list.",
|
|
8
|
+
"market": "cn_future",
|
|
9
|
+
"timeframe": "1d",
|
|
10
|
+
"dsl": {
|
|
11
|
+
"version": 1,
|
|
12
|
+
"indicators": {
|
|
13
|
+
"fast": {
|
|
14
|
+
"type": "EMA",
|
|
15
|
+
"period": 20
|
|
16
|
+
},
|
|
17
|
+
"slow": {
|
|
18
|
+
"type": "EMA",
|
|
19
|
+
"period": 60
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"entry": {
|
|
23
|
+
"type": "CROSS_UP",
|
|
24
|
+
"left": {
|
|
25
|
+
"ind": "fast"
|
|
26
|
+
},
|
|
27
|
+
"right": {
|
|
28
|
+
"ind": "slow"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"exit": {
|
|
32
|
+
"type": "CROSS_DOWN",
|
|
33
|
+
"left": {
|
|
34
|
+
"ind": "fast"
|
|
35
|
+
},
|
|
36
|
+
"right": {
|
|
37
|
+
"ind": "slow"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"shortEntry": {
|
|
41
|
+
"type": "CROSS_DOWN",
|
|
42
|
+
"left": {
|
|
43
|
+
"ind": "fast"
|
|
44
|
+
},
|
|
45
|
+
"right": {
|
|
46
|
+
"ind": "slow"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"universe": {
|
|
51
|
+
"mode": "SYMBOLS",
|
|
52
|
+
"symbols": [
|
|
53
|
+
"RB2701.SHF"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"producer": {
|
|
57
|
+
"kind": "HUMAN",
|
|
58
|
+
"name": "example"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"expect": {
|
|
62
|
+
"valid": true,
|
|
63
|
+
"errors": [],
|
|
64
|
+
"warnings": [
|
|
65
|
+
"AS020"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "The same factor twice doubles its weight.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "FACTOR_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"factor": "MOMENTUM_20",
|
|
17
|
+
"direction": "DESC",
|
|
18
|
+
"weight": 2
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"ranking": {
|
|
22
|
+
"topN": 3,
|
|
23
|
+
"rebalance": "WEEKLY"
|
|
24
|
+
},
|
|
25
|
+
"universe": {
|
|
26
|
+
"mode": "SYMBOLS",
|
|
27
|
+
"symbols": [
|
|
28
|
+
"600519.SH",
|
|
29
|
+
"000858.SZ",
|
|
30
|
+
"300750.SZ",
|
|
31
|
+
"601318.SH",
|
|
32
|
+
"600036.SH",
|
|
33
|
+
"000333.SZ"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"producer": {
|
|
37
|
+
"kind": "HUMAN",
|
|
38
|
+
"name": "example"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"expect": {
|
|
42
|
+
"valid": true,
|
|
43
|
+
"errors": [],
|
|
44
|
+
"warnings": [
|
|
45
|
+
"AS021"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Top 6 of 6 symbols ranks nothing.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "FACTOR_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"ranking": {
|
|
17
|
+
"topN": 6
|
|
18
|
+
},
|
|
19
|
+
"universe": {
|
|
20
|
+
"mode": "SYMBOLS",
|
|
21
|
+
"symbols": [
|
|
22
|
+
"600519.SH",
|
|
23
|
+
"000858.SZ",
|
|
24
|
+
"300750.SZ",
|
|
25
|
+
"601318.SH",
|
|
26
|
+
"600036.SH",
|
|
27
|
+
"000333.SZ"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"producer": {
|
|
31
|
+
"kind": "HUMAN",
|
|
32
|
+
"name": "example"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"expect": {
|
|
36
|
+
"valid": true,
|
|
37
|
+
"errors": [],
|
|
38
|
+
"warnings": [
|
|
39
|
+
"AS022"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Per-binding topN was replaced by ranking.topN in 0.4.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "FACTOR_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC",
|
|
14
|
+
"topN": 3
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"ranking": {
|
|
18
|
+
"topN": 3,
|
|
19
|
+
"rebalance": "WEEKLY"
|
|
20
|
+
},
|
|
21
|
+
"universe": {
|
|
22
|
+
"mode": "SYMBOLS",
|
|
23
|
+
"symbols": [
|
|
24
|
+
"600519.SH",
|
|
25
|
+
"000858.SZ",
|
|
26
|
+
"300750.SZ",
|
|
27
|
+
"601318.SH",
|
|
28
|
+
"600036.SH",
|
|
29
|
+
"000333.SZ"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"producer": {
|
|
33
|
+
"kind": "HUMAN",
|
|
34
|
+
"name": "example"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"expect": {
|
|
38
|
+
"valid": false,
|
|
39
|
+
"errors": [
|
|
40
|
+
"SCHEMA"
|
|
41
|
+
],
|
|
42
|
+
"warnings": []
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "FACTOR_ONLY must say how many to hold and how often to rebalance.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "FACTOR_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"universe": {
|
|
17
|
+
"mode": "SYMBOLS",
|
|
18
|
+
"symbols": [
|
|
19
|
+
"600519.SH",
|
|
20
|
+
"000858.SZ",
|
|
21
|
+
"300750.SZ",
|
|
22
|
+
"601318.SH",
|
|
23
|
+
"600036.SH",
|
|
24
|
+
"000333.SZ"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"producer": {
|
|
28
|
+
"kind": "HUMAN",
|
|
29
|
+
"name": "example"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"expect": {
|
|
33
|
+
"valid": false,
|
|
34
|
+
"errors": [
|
|
35
|
+
"SCHEMA"
|
|
36
|
+
],
|
|
37
|
+
"warnings": []
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "ranking does not exist in contract 0.3.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.3",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "FACTOR_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"ranking": {
|
|
17
|
+
"topN": 3,
|
|
18
|
+
"rebalance": "WEEKLY"
|
|
19
|
+
},
|
|
20
|
+
"universe": {
|
|
21
|
+
"mode": "SYMBOLS",
|
|
22
|
+
"symbols": [
|
|
23
|
+
"600519.SH",
|
|
24
|
+
"000858.SZ",
|
|
25
|
+
"300750.SZ",
|
|
26
|
+
"601318.SH",
|
|
27
|
+
"600036.SH",
|
|
28
|
+
"000333.SZ"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"producer": {
|
|
32
|
+
"kind": "HUMAN",
|
|
33
|
+
"name": "example"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"expect": {
|
|
37
|
+
"valid": false,
|
|
38
|
+
"errors": [
|
|
39
|
+
"SCHEMA"
|
|
40
|
+
],
|
|
41
|
+
"warnings": []
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "RULE_ONLY without a rule tree.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "RULE_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"ranking": {
|
|
17
|
+
"topN": 3,
|
|
18
|
+
"rebalance": "WEEKLY"
|
|
19
|
+
},
|
|
20
|
+
"universe": {
|
|
21
|
+
"mode": "SYMBOLS",
|
|
22
|
+
"symbols": [
|
|
23
|
+
"600519.SH",
|
|
24
|
+
"000858.SZ",
|
|
25
|
+
"300750.SZ",
|
|
26
|
+
"601318.SH",
|
|
27
|
+
"600036.SH",
|
|
28
|
+
"000333.SZ"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"producer": {
|
|
32
|
+
"kind": "HUMAN",
|
|
33
|
+
"name": "example"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"expect": {
|
|
37
|
+
"valid": false,
|
|
38
|
+
"errors": [
|
|
39
|
+
"SCHEMA"
|
|
40
|
+
],
|
|
41
|
+
"warnings": []
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Contract 0.4: a factor-ranked strategy needs no rule tree.",
|
|
3
|
+
"document": {
|
|
4
|
+
"contractVersion": "0.4",
|
|
5
|
+
"kind": "artifact",
|
|
6
|
+
"title": "momentum top 3",
|
|
7
|
+
"market": "cn_stock",
|
|
8
|
+
"timeframe": "1d",
|
|
9
|
+
"signalMode": "FACTOR_ONLY",
|
|
10
|
+
"factorBindings": [
|
|
11
|
+
{
|
|
12
|
+
"factor": "MOMENTUM_20",
|
|
13
|
+
"direction": "DESC"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"ranking": {
|
|
17
|
+
"topN": 3,
|
|
18
|
+
"rebalance": "WEEKLY"
|
|
19
|
+
},
|
|
20
|
+
"universe": {
|
|
21
|
+
"mode": "SYMBOLS",
|
|
22
|
+
"symbols": [
|
|
23
|
+
"600519.SH",
|
|
24
|
+
"000858.SZ",
|
|
25
|
+
"300750.SZ",
|
|
26
|
+
"601318.SH",
|
|
27
|
+
"600036.SH",
|
|
28
|
+
"000333.SZ"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"producer": {
|
|
32
|
+
"kind": "HUMAN",
|
|
33
|
+
"name": "example"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"expect": {
|
|
37
|
+
"valid": true,
|
|
38
|
+
"errors": [],
|
|
39
|
+
"warnings": []
|
|
40
|
+
}
|
|
41
|
+
}
|