@bitget-ai/getagent-skill 0.2.1

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.
Files changed (57) hide show
  1. package/.claude-plugin/marketplace.json +28 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/README.md +99 -0
  4. package/VERSION +1 -0
  5. package/bin/getagent-skill.js +140 -0
  6. package/package.json +45 -0
  7. package/skills/getagent/SKILL.md +129 -0
  8. package/skills/getagent/examples/btc-ema-cross-demo/README.md +61 -0
  9. package/skills/getagent/examples/btc-ema-cross-demo/backtest.yaml +33 -0
  10. package/skills/getagent/examples/btc-ema-cross-demo/manifest.yaml +94 -0
  11. package/skills/getagent/examples/btc-ema-cross-demo/src/main.py +88 -0
  12. package/skills/getagent/examples/btc-ema-cross-demo/src/strategy.py +118 -0
  13. package/skills/getagent/references/api/enable.md +95 -0
  14. package/skills/getagent/references/api/error-responses.md +77 -0
  15. package/skills/getagent/references/api/index.md +38 -0
  16. package/skills/getagent/references/api/list.md +80 -0
  17. package/skills/getagent/references/api/my-playbooks.md +41 -0
  18. package/skills/getagent/references/api/publish.md +76 -0
  19. package/skills/getagent/references/api/run.md +149 -0
  20. package/skills/getagent/references/api/upload.md +76 -0
  21. package/skills/getagent/references/backtest-engine.md +438 -0
  22. package/skills/getagent/references/package-schema.md +552 -0
  23. package/skills/getagent/references/sandbox-runtime.md +201 -0
  24. package/skills/getagent/references/sdk/backtest/catalog.md +208 -0
  25. package/skills/getagent/references/sdk/data/arxiv.md +41 -0
  26. package/skills/getagent/references/sdk/data/catalog.md +56 -0
  27. package/skills/getagent/references/sdk/data/commodity.md +226 -0
  28. package/skills/getagent/references/sdk/data/coverage.md +82 -0
  29. package/skills/getagent/references/sdk/data/crypto.md +2906 -0
  30. package/skills/getagent/references/sdk/data/currency.md +123 -0
  31. package/skills/getagent/references/sdk/data/derivatives.md +269 -0
  32. package/skills/getagent/references/sdk/data/economy.md +1348 -0
  33. package/skills/getagent/references/sdk/data/equity.md +2120 -0
  34. package/skills/getagent/references/sdk/data/etf.md +372 -0
  35. package/skills/getagent/references/sdk/data/famafrench.md +201 -0
  36. package/skills/getagent/references/sdk/data/fixedincome.md +804 -0
  37. package/skills/getagent/references/sdk/data/imf_utils.md +225 -0
  38. package/skills/getagent/references/sdk/data/index.md +216 -0
  39. package/skills/getagent/references/sdk/data/news.md +149 -0
  40. package/skills/getagent/references/sdk/data/playbook-supported.md +9871 -0
  41. package/skills/getagent/references/sdk/data/regulators.md +299 -0
  42. package/skills/getagent/references/sdk/data/sentiment.md +323 -0
  43. package/skills/getagent/references/sdk/data/uscongress.md +126 -0
  44. package/skills/getagent/references/sdk/data/web_search.md +68 -0
  45. package/skills/getagent/references/sdk/data/wikipedia.md +97 -0
  46. package/skills/getagent/references/sdk/llm/catalog.md +117 -0
  47. package/skills/getagent/references/sdk/runtime/catalog.md +195 -0
  48. package/skills/getagent/references/sdk/trade/account.md +61 -0
  49. package/skills/getagent/references/sdk/trade/catalog.md +35 -0
  50. package/skills/getagent/references/sdk/trade/contract.md +331 -0
  51. package/skills/getagent/references/sdk/trade/helpers.md +466 -0
  52. package/skills/getagent/references/sdk/trade/market.md +28 -0
  53. package/skills/getagent/references/sdk/trade/patterns.md +102 -0
  54. package/skills/getagent/references/sdk/trade/spot.md +165 -0
  55. package/skills/getagent/references/sdk.md +198 -0
  56. package/skills/getagent/scripts/validate.py +965 -0
  57. package/skills/getagent/scripts/version_check.sh +62 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "getagent-skills",
3
+ "owner": {
4
+ "name": "GetAgent",
5
+ "email": "support@bitget.com"
6
+ },
7
+ "metadata": {
8
+ "description": "Official GetAgent Agent Skill for trading Playbook authoring",
9
+ "version": "0.2.1"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "getagent",
14
+ "source": "./",
15
+ "description": "Create, validate, upload, backtest, publish, and enable GetAgent quantitative trading Playbooks.",
16
+ "version": "0.2.1",
17
+ "author": {
18
+ "name": "GetAgent",
19
+ "email": "support@bitget.com"
20
+ },
21
+ "repository": "git@gitlab.bitget.tools:algorithm/upex-algorithm-getall-skill-sdk.git",
22
+ "license": "Proprietary",
23
+ "keywords": ["getagent", "trading", "playbooks", "backtesting", "agent-skills"],
24
+ "category": "external-integrations",
25
+ "tags": ["trading", "backtesting", "agent-skills", "playbooks"]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "getagent",
3
+ "version": "0.2.1",
4
+ "description": "Create, validate, upload, backtest, publish, and enable GetAgent quantitative trading Playbooks.",
5
+ "author": {
6
+ "name": "GetAgent",
7
+ "email": "support@bitget.com"
8
+ },
9
+ "repository": "git@gitlab.bitget.tools:algorithm/upex-algorithm-getall-skill-sdk.git",
10
+ "license": "Proprietary",
11
+ "skills": "./skills/getagent/"
12
+ }
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # GetAgent Skill
2
+
3
+ > Author, backtest, and ship algorithmic crypto trading strategies on Bitget — through your AI coding agent.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@bitget-ai/getagent-skill.svg)](https://www.npmjs.com/package/@bitget-ai/getagent-skill)
6
+
7
+ GetAgent is Bitget's managed platform for AI-authored quantitative trading
8
+ strategies (Playbooks). This Agent Skill teaches your AI coding agent —
9
+ Claude Code, Cursor, or Codex — the full end-to-end GetAgent workflow:
10
+ writing strategy code in Python, validating it locally, uploading to the
11
+ managed sandbox, running historical backtests, publishing accepted
12
+ versions, and opening subscriptions.
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ npx @bitget-ai/getagent-skill install --client claude
18
+ ```
19
+
20
+ Then open Claude Code and ask:
21
+
22
+ > Build me a momentum strategy on BTC perp using EMA crossover and run a 30-day backtest.
23
+
24
+ The agent scaffolds a Playbook package, writes the strategy code, validates
25
+ it locally, uploads it to GetAgent Cloud, runs the backtest in the managed
26
+ sandbox, and shows you results — all without leaving the chat.
27
+
28
+ For other agents:
29
+
30
+ ```bash
31
+ npx @bitget-ai/getagent-skill install --client cursor # installs to ~/.cursor/skills/getagent
32
+ npx @bitget-ai/getagent-skill install --client codex # installs to ~/.codex/skills/getagent
33
+ npx @bitget-ai/getagent-skill install --client all # all three
34
+ ```
35
+
36
+ ## How It Works
37
+
38
+ GetAgent splits authoring from execution:
39
+
40
+ - **Local (your machine, via this skill)** — write strategy Python, validate
41
+ package structure, call the Playbook control-plane API through your agent.
42
+ - **Managed sandbox (GetAgent Cloud)** — the real `getagent.data`,
43
+ `getagent.trade`, `getagent.llm`, and `getagent.backtest` modules execute
44
+ with live market data and brokered exchange access.
45
+
46
+ You write code against the documented `getagent.*` API. When your agent
47
+ uploads the Playbook, GetAgent provisions a matching sandbox image and runs
48
+ the code there, not on your laptop. API keys, market data licensing, and
49
+ execution risk all stay inside the managed boundary.
50
+
51
+ A typical Playbook entry point looks like:
52
+
53
+ ```python
54
+ from getagent import backtest, data, runtime
55
+
56
+ def run() -> None:
57
+ bars = data.crypto.futures.kline(symbol="BTCUSDT", interval="1h", limit=1000)
58
+ frame = backtest.prepare_frame(bars)
59
+ # ... your strategy emits signals via runtime ...
60
+ runtime.emit_signal(action="buy", symbol="BTCUSDT", confidence=0.8)
61
+ ```
62
+
63
+ A complete reference strategy lives in
64
+ [`skills/getagent/examples/btc-ema-cross-demo/`](skills/getagent/examples/btc-ema-cross-demo/).
65
+
66
+ ## What's In The Skill
67
+
68
+ - **`SKILL.md`** — agent instructions, conversation templates, control flow
69
+ - **`references/`** — package schema, API reference, sandbox runtime, and authoring docs
70
+ - **`scripts/validate.py`** — static package validator (runs locally before upload)
71
+ - **`examples/`** — runnable example Playbooks
72
+
73
+ ## Requirements
74
+
75
+ - **Node.js 18+** to install the skill via npm
76
+ - **Python 3.11+** for local static validation
77
+ - A **GetAgent Cloud** account and API credentials — your agent will guide
78
+ authentication on first use
79
+
80
+ ## Versioning
81
+
82
+ This package follows [Semantic Versioning](https://semver.org/):
83
+
84
+ - **Patch** (`v0.1.x`) — bug fixes, doc updates, reference regen with no API change
85
+ - **Minor** (`v0.x.0`) — additive: new endpoints, new examples, new authoring surfaces
86
+ - **Major** (`vX.0.0`) — breaking changes to the documented authoring API
87
+
88
+ If the skill documents an API, the sandbox image GetAgent Cloud provisions
89
+ for your Playbook contains that API.
90
+
91
+ ## License
92
+
93
+ Proprietary. See [`package.json`](package.json).
94
+
95
+ ## Support
96
+
97
+ - Issues: https://github.com/Bitget-AI/getagent-skill/issues
98
+ - Skill content: open `~/.claude/skills/getagent/SKILL.md` (or the matching
99
+ path for cursor/codex) after install
package/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+ const path = require("path");
7
+
8
+ const CLIENT_TARGETS = {
9
+ claude: path.join(os.homedir(), ".claude", "skills", "getagent"),
10
+ cursor: path.join(os.homedir(), ".cursor", "skills", "getagent"),
11
+ codex: path.join(os.homedir(), ".codex", "skills", "getagent"),
12
+ };
13
+
14
+ function usage() {
15
+ return `GetAgent Skill installer
16
+
17
+ Usage:
18
+ npx @bitget-ai/getagent-skill install [--client claude|cursor|codex|all] [--target PATH] [--dry-run]
19
+ npx @bitget-ai/getagent-skill --help
20
+
21
+ Examples:
22
+ npx @bitget-ai/getagent-skill install --client claude
23
+ npx @bitget-ai/getagent-skill install --client cursor
24
+ npx @bitget-ai/getagent-skill install --client all
25
+ `;
26
+ }
27
+
28
+ function parseArgs(argv) {
29
+ const options = {
30
+ command: "",
31
+ client: "all",
32
+ target: "",
33
+ dryRun: false,
34
+ };
35
+
36
+ for (let index = 0; index < argv.length; index += 1) {
37
+ const arg = argv[index];
38
+ if (arg === "--help" || arg === "-h") {
39
+ options.command = "help";
40
+ continue;
41
+ }
42
+ if (!options.command && !arg.startsWith("-")) {
43
+ options.command = arg;
44
+ continue;
45
+ }
46
+ if (arg === "--client" || arg === "-c") {
47
+ options.client = argv[index + 1] || "";
48
+ index += 1;
49
+ continue;
50
+ }
51
+ if (arg.startsWith("--client=")) {
52
+ options.client = arg.slice("--client=".length);
53
+ continue;
54
+ }
55
+ if (arg === "--target" || arg === "-t") {
56
+ options.target = argv[index + 1] || "";
57
+ index += 1;
58
+ continue;
59
+ }
60
+ if (arg.startsWith("--target=")) {
61
+ options.target = arg.slice("--target=".length);
62
+ continue;
63
+ }
64
+ if (arg === "--dry-run") {
65
+ options.dryRun = true;
66
+ continue;
67
+ }
68
+ throw new Error(`Unknown argument: ${arg}`);
69
+ }
70
+
71
+ return options;
72
+ }
73
+
74
+ function expandHome(value) {
75
+ if (!value) {
76
+ return value;
77
+ }
78
+ if (value === "~") {
79
+ return os.homedir();
80
+ }
81
+ if (value.startsWith("~/")) {
82
+ return path.join(os.homedir(), value.slice(2));
83
+ }
84
+ return value;
85
+ }
86
+
87
+ function copySkill(sourceDir, targetDir, dryRun) {
88
+ const resolvedTarget = path.resolve(expandHome(targetDir));
89
+ if (dryRun) {
90
+ console.log(`[dry-run] install ${sourceDir} -> ${resolvedTarget}`);
91
+ return;
92
+ }
93
+
94
+ fs.mkdirSync(path.dirname(resolvedTarget), { recursive: true });
95
+ fs.rmSync(resolvedTarget, { recursive: true, force: true });
96
+ fs.cpSync(sourceDir, resolvedTarget, { recursive: true });
97
+ console.log(`Installed GetAgent skill at ${resolvedTarget}`);
98
+ }
99
+
100
+ function run() {
101
+ const options = parseArgs(process.argv.slice(2));
102
+ if (!options.command || options.command === "help") {
103
+ console.log(usage());
104
+ return;
105
+ }
106
+ if (options.command !== "install") {
107
+ throw new Error(`Unknown command: ${options.command}`);
108
+ }
109
+
110
+ const sourceDir = path.resolve(__dirname, "..", "skills", "getagent");
111
+ if (!fs.existsSync(path.join(sourceDir, "SKILL.md"))) {
112
+ throw new Error(`Bundled GetAgent skill is missing: ${sourceDir}`);
113
+ }
114
+
115
+ const client = String(options.client || "").toLowerCase();
116
+ if (options.target) {
117
+ copySkill(sourceDir, options.target, options.dryRun);
118
+ return;
119
+ }
120
+
121
+ if (client === "all") {
122
+ for (const target of Object.values(CLIENT_TARGETS)) {
123
+ copySkill(sourceDir, target, options.dryRun);
124
+ }
125
+ return;
126
+ }
127
+
128
+ const target = CLIENT_TARGETS[client];
129
+ if (!target) {
130
+ throw new Error(`Unsupported client: ${options.client}. Use claude, cursor, codex, or all.`);
131
+ }
132
+ copySkill(sourceDir, target, options.dryRun);
133
+ }
134
+
135
+ try {
136
+ run();
137
+ } catch (error) {
138
+ console.error(`getagent-skill: ${error.message}`);
139
+ process.exit(1);
140
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@bitget-ai/getagent-skill",
3
+ "version": "0.2.1",
4
+ "description": "Install the official GetAgent Agent Skill for Playbook authoring.",
5
+ "license": "Proprietary",
6
+ "homepage": "https://github.com/Bitget-AI/getagent-skill#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Bitget-AI/getagent-skill.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/Bitget-AI/getagent-skill/issues"
13
+ },
14
+ "type": "commonjs",
15
+ "bin": {
16
+ "getagent-skill": "bin/getagent-skill.js"
17
+ },
18
+ "files": [
19
+ "bin/",
20
+ "skills/getagent/",
21
+ "README.md",
22
+ "VERSION",
23
+ ".claude-plugin/"
24
+ ],
25
+ "scripts": {
26
+ "check": "node bin/getagent-skill.js --help && python3 -m py_compile skills/getagent/scripts/validate.py && python3 skills/getagent/scripts/validate.py skills/getagent/examples/btc-ema-cross-demo",
27
+ "test": "npm run check"
28
+ },
29
+ "engines": {
30
+ "node": ">=18"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "keywords": [
36
+ "getagent",
37
+ "agent-skills",
38
+ "claude-code",
39
+ "cursor",
40
+ "codex",
41
+ "trading",
42
+ "playbook",
43
+ "backtesting"
44
+ ]
45
+ }
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: getagent
3
+ description: >-
4
+ Authors, validates, uploads, backtests, publishes, and enables GetAgent
5
+ quantitative trading Playbooks. Use when the user asks to create, review,
6
+ fix, validate, upload, run, publish, or subscribe to a trading strategy or
7
+ Playbook; mentions strategy backtesting, 策略, 回测, 发布, 上传, BTC EMA, or
8
+ GetAgent; or provides existing Playbook package code for review.
9
+ compatibility: >-
10
+ Designed for Claude Code, Codex, Cursor, and other agents that support
11
+ Agent Skills. Requires Python 3.11+ for local static validation and network
12
+ access to the GetAgent Playbook control-plane API for upload/run/publish.
13
+ metadata:
14
+ author: getagent
15
+ version: v0.2.1
16
+ ---
17
+
18
+ # GetAgent Playbook Creator
19
+
20
+ This skill helps an agent turn a strategy idea into a GetAgent Playbook package,
21
+ validate it locally, upload it to GetAgent Cloud, run sandbox backtests or
22
+ evaluations, publish accepted versions, and enable subscriptions.
23
+
24
+ Local authoring is **not** local SDK execution. User machines can only run
25
+ static package checks and call the Playbook control-plane APIs. `getagent.data`,
26
+ `getagent.trade`, `getagent.llm`, `getagent.backtest`, and `getagent.runtime`
27
+ are sandbox-preinstalled SDK modules. Use the bundled references to write code
28
+ against their public shape, but do not try to execute data, trade, or LLM SDK
29
+ calls on the user's machine.
30
+
31
+ ## First Use
32
+
33
+ On first use each session:
34
+
35
+ 1. If available, run `scripts/version_check.sh`. Show update instructions only
36
+ when it prints a message.
37
+ 2. Read `references/package-schema.md` before creating or modifying a package.
38
+ 3. Read `references/sdk.md` before writing `src/**` strategy code.
39
+ 4. Read the exact API reference under `references/api/` before upload, run,
40
+ publish, enable, or list operations.
41
+
42
+ ## User Opening
43
+
44
+ When the user asks generally how to start, use this stable opening in the
45
+ user's language. Do not ask for credentials in the opening.
46
+
47
+ ```text
48
+ ✅ 策略回测助手已经准备好了。
49
+
50
+ 我可以帮你完成从「策略想法」到「沙箱回测结果」的完整流程:
51
+
52
+ - 你可以用自然语言描述策略,我会生成可运行代码
53
+ - 你也可以提供已有策略,我会帮你 review、修复和优化
54
+ - 我会先做本地校验,检查策略是否符合回测框架要求
55
+ - 校验通过后,我可以上传到沙箱并启动回测
56
+ - 回测完成后,我会帮你解读收益、回撤、胜率、交易次数等结果
57
+ - 然后我们可以继续迭代下一版策略
58
+
59
+ 你现在想怎么开始?
60
+
61
+ A. 跑一个 Demo,先看看完整流程(BTC EMA 趋势策略,仅信号模式)
62
+ B. 我有大致方向,让你帮我搭个最小骨架(你会反问我几个关键问题:标的 / 周期 / 进场 / 出场)
63
+ C. 我直接描述我的策略想法
64
+ D. 我已有策略代码(贴在这里或给路径),先 review 修复再跑回测
65
+ ```
66
+
67
+ Use the English equivalent when the user's first message is English.
68
+
69
+ ## Default Workflow
70
+
71
+ 1. Clarify only missing strategy requirements that block authoring. Ask one
72
+ concrete question at a time.
73
+ 2. Scaffold the package shape from `references/package-schema.md`.
74
+ 3. Write strategy code against `getagent.*` imports only, plus allowed
75
+ scientific/runtime packages documented in the schema.
76
+ 4. Validate locally:
77
+
78
+ ```bash
79
+ conda activate get_agent_test
80
+ python "scripts/validate.py" ./my-strategy/
81
+ ```
82
+
83
+ 5. Ask for the user's Bitget OpenAPI `ACCESS-KEY` only before the first
84
+ authenticated upload/run/publish/enable call. Never write credentials to disk.
85
+ 6. Upload the package through the documented control-plane API.
86
+ 7. Run a sandbox evaluation before publish when the package supports backtests.
87
+ 8. Read results back in plain language before proposing publish or iteration.
88
+
89
+ ## Reference Map
90
+
91
+ - Package contract: `references/package-schema.md`
92
+ - SDK overview: `references/sdk.md`
93
+ - Sandbox runtime and blocked imports: `references/sandbox-runtime.md`
94
+ - Backtest engine behavior: `references/backtest-engine.md`
95
+ - Control-plane APIs: `references/api/index.md`
96
+ - Data SDK: `references/sdk/data/playbook-supported.md`
97
+ - Trade SDK: `references/sdk/trade/patterns.md`
98
+ - Backtest SDK: `references/sdk/backtest/catalog.md`
99
+ - Runtime SDK: `references/sdk/runtime/catalog.md`
100
+ - LLM SDK: `references/sdk/llm/catalog.md`
101
+
102
+ ## Hard Boundaries
103
+
104
+ - Do not tell users to install or execute the private GetAgent SDK locally.
105
+ - Do not import or recommend direct clients such as `requests`, `httpx`,
106
+ `ccxt`, `trade_sdk`, `yfinance`, `akshare`, or exchange clients in Playbook
107
+ source code.
108
+ - Do not use `getagent.llm` for replayable historical logic. LLM-backed
109
+ strategies are live/evaluation-only and require `runtime_profile:
110
+ llm_bounded` with `backtest_support: none`.
111
+ - Do not call trade mutation APIs directly in a signal-only branch. Emit the
112
+ signal successfully and let the runtime decide whether follow-trade is
113
+ allowed.
114
+ - Do not publish or enable without showing the endpoint and masked
115
+ `ACCESS-KEY` prefix and getting the user's intent for that operation.
116
+
117
+ ## Post-Backtest Response
118
+
119
+ After every successful sandbox run, summarize the result before any next action:
120
+
121
+ - strategy-basis `total_return_pct`
122
+ - `max_drawdown_pct`
123
+ - `win_rate` paired with `total_trades`
124
+ - finite `sharpe_ratio` only when trades exist
125
+ - the main risk revealed by the run
126
+
127
+ Then offer 2-3 concrete next moves: tune a declared parameter, change symbol or
128
+ timeframe within schema, revise entry/exit logic in a new version, or publish
129
+ only if evidence is acceptable.
@@ -0,0 +1,61 @@
1
+ # BTC EMA Crossover Demo
2
+
3
+ A minimal trend-following Playbook on BTC perpetual futures, used as an
4
+ end-to-end walkthrough of the GetAgent Playbook Creator skill.
5
+
6
+ ## 策略
7
+
8
+ This Playbook captures sustained directional moves on BTC perpetual futures.
9
+ It runs on 1-hour bars and bets on the assumption that, once a trend forms,
10
+ price tends to travel along that trend in a relatively clean direction
11
+ rather than chopping back and forth.
12
+
13
+ The decision is driven by alignment between two moving averages of different
14
+ horizons. When the shorter horizon clearly leads the longer horizon upward,
15
+ the strategy reads it as bullish alignment. When it falls below the longer
16
+ horizon, the strategy reads it as bearish alignment.
17
+
18
+ ## 开仓
19
+
20
+ The Playbook opens a long position when the short-horizon trend crosses
21
+ above the long-horizon trend, indicating that recent momentum has flipped
22
+ in favor of the upside. It opens a short position on the inverse cross.
23
+
24
+ There is no fading of extremes, no top-picking, and no pyramiding. Only the
25
+ crossover event is treated as actionable.
26
+
27
+ ## 平仓
28
+
29
+ A position is closed on the inverse crossover. When the short-horizon
30
+ trend retracts below the long-horizon trend (for longs) or back above it
31
+ (for shorts), the strategy interprets that as a fade of conviction and
32
+ exits the position. Stop loss and take profit are not used in this demo —
33
+ the cross alone exits the trade.
34
+
35
+ ## 参数说明
36
+
37
+ Subscribers may tune two parameters at subscription time:
38
+
39
+ - **leverage** — amplifies both upside and drawdown equally. Higher leverage
40
+ does not make the strategy more selective; it only sizes risk larger.
41
+ - **margin_budget** — per-strategy capital cap, used by the platform to size
42
+ orders and to compute the user-facing return percentage.
43
+
44
+ ## 回测指标如何读
45
+
46
+ The backtest reports `total_return_pct`, `sharpe_ratio`, `max_drawdown_pct`,
47
+ `win_rate`, and `total_trades`. `total_return_pct` is the strategy-budget
48
+ return (`net_pnl / margin_budget`); `account_total_return_pct` is the raw
49
+ account-level number from the engine. Pay attention to drawdown depth and
50
+ total trade count alongside return — a high return on too few trades is not
51
+ robust evidence.
52
+
53
+ ## 风险
54
+
55
+ This demo strategy underperforms in choppy, range-bound markets where the
56
+ short-horizon trend flips repeatedly without committing to a real trend.
57
+ Around major news gaps and persistent funding-rate dislocation it can
58
+ produce a string of stops or trapped positions. Past historical performance
59
+ is not a guarantee of live profitability — match it against your own risk
60
+ tolerance before subscribing, and do not run it with leverage you cannot
61
+ afford to draw down.
@@ -0,0 +1,33 @@
1
+ venue:
2
+ name: BINANCE
3
+ account_type: MARGIN
4
+ oms_type: NETTING
5
+ starting_balances:
6
+ - amount: 100000
7
+ currency: USDT
8
+
9
+ strategy:
10
+ module: strategy
11
+ class: EmaCrossStrategy
12
+ config_class: EmaCrossStrategyConfig
13
+ config:
14
+ order_id_tag: "001"
15
+ trade_size: "0.01"
16
+ fast_period: 12
17
+ slow_period: 26
18
+
19
+ instrument:
20
+ id: BTCUSDT.BINANCE
21
+ kind: perpetual
22
+ raw_symbol: BTCUSDT
23
+ base_currency: BTC
24
+ quote_currency: USDT
25
+ settlement_currency: USDT
26
+ price_precision: 2
27
+ size_precision: 3
28
+ price_increment: "0.01"
29
+ size_increment: "0.001"
30
+ lot_size: "0.001"
31
+ maker_fee: "0.0002"
32
+ taker_fee: "0.0005"
33
+ bar_type: BTCUSDT.BINANCE-1-HOUR-LAST-EXTERNAL
@@ -0,0 +1,94 @@
1
+ name: btc-ema-cross-demo
2
+ display_name: "BTC EMA Crossover Demo"
3
+ version: "1.0.1"
4
+ description: "Trend-following BTC perpetual demo using EMA crossover on hourly bars"
5
+ long_description: |
6
+ This Playbook is a trend-following strategy on BTC perpetual futures that
7
+ aims to capture the middle portion of sustained directional moves. The
8
+ thesis is simple: once the broader market commits to a real trend, price
9
+ tends to travel along that direction in a relatively clean way rather
10
+ than chopping back and forth. The Playbook deliberately ignores fade
11
+ setups and range-bound conditions and only acts when a crossover event
12
+ signals that a fresh directional regime has formed. It is designed for
13
+ subscribers who want a transparent, easy-to-explain signal source rather
14
+ than a black-box model.
15
+
16
+ Entry decisions are driven by alignment between a shorter-horizon and a
17
+ longer-horizon directional read of price action. When the shorter
18
+ horizon clearly leads the longer horizon upward, the strategy treats
19
+ that as bullish alignment and enters long. When the shorter horizon
20
+ drops below the longer horizon, it treats that as bearish alignment and
21
+ enters short. The strategy waits for the crossover to happen rather
22
+ than anticipating it, accepting some delay in exchange for clearer
23
+ confirmation.
24
+
25
+ Exits work by inversion. When the shorter horizon retracts back through
26
+ the longer horizon, the strategy reads that as fading conviction and
27
+ closes the position to lock in whatever was captured. The Playbook does
28
+ not use a separate stop loss or take profit in this demo; the crossover
29
+ itself is both the exit gate and the regret-control mechanism. Many
30
+ small losing trades are treated as the cost of catching the occasional
31
+ larger trend run.
32
+
33
+ Subscribers may tune two parameters. Leverage amplifies both upside and
34
+ drawdown equally; raising leverage does not make the strategy more
35
+ selective, it only sizes risk larger. Margin budget is the per-strategy
36
+ capital cap that the platform sizes orders against and uses as the
37
+ denominator for return percentage; treat it as the maximum amount you
38
+ are willing to put at risk on this Playbook.
39
+
40
+ The strategy underperforms in choppy, range-bound markets where the
41
+ shorter horizon flips repeatedly without committing to a real trend,
42
+ producing whipsaw losses. Gap-driven moves around major news events and
43
+ persistent funding-rate dislocation can also create a string of trapped
44
+ positions. Past historical backtest performance is not a guarantee of
45
+ live profitability, and live execution will pay slippage and exchange
46
+ fees that erode edge — only subscribe if you can tolerate the drawdown
47
+ and unsuitable regime risk this kind of trend strategy carries.
48
+
49
+ market_type: contract
50
+ trading_symbols: ["BTCUSDT"]
51
+ tags: ["trend", "ema", "btc", "contract", "demo"]
52
+
53
+ decision_mode: deterministic
54
+ backtest_support: full
55
+ runtime_profile: deterministic
56
+ execution_mode: signal_only
57
+ follow_trade_supported: false
58
+
59
+ strategy_config:
60
+ trading_symbols: ["BTCUSDT"]
61
+ fast_period: 12
62
+ slow_period: 26
63
+ leverage: 3
64
+ margin_budget: "100"
65
+
66
+ user_config_schema:
67
+ trading_symbols:
68
+ type: array
69
+ item_type: string
70
+ default: ["BTCUSDT"]
71
+ options: ["BTCUSDT", "ETHUSDT", "SOLUSDT"]
72
+ aliases:
73
+ btc: BTCUSDT
74
+ bitcoin: BTCUSDT
75
+ eth: ETHUSDT
76
+ min_items: 1
77
+ max_items: 1
78
+ label: "Trading symbol"
79
+ leverage:
80
+ type: integer
81
+ default: 3
82
+ min: 1
83
+ max: 10
84
+ aliases:
85
+ 3x: 3
86
+ 3倍: 3
87
+ 5x: 5
88
+ 5倍: 5
89
+ label: "Leverage"
90
+ margin_budget:
91
+ type: string
92
+ default: "100"
93
+ pattern: "^[0-9]+(\\.[0-9]+)?$"
94
+ label: "Margin budget USDT"