@pionex/pionex-ai-kit 0.2.51 → 0.2.53
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/README.md +2 -1
- package/dist/{chunk-O45XCZNU.js → chunk-I6Z3QX5T.js} +11 -7
- package/dist/chunk-I6Z3QX5T.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{kit-TC3MJAIO.js → kit-DBQGQY64.js} +2 -2
- package/dist/{trade-ARTTYJHM.js → trade-4DUOU56K.js} +36 -23
- package/dist/trade-4DUOU56K.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-O45XCZNU.js.map +0 -1
- package/dist/trade-ARTTYJHM.js.map +0 -1
- /package/dist/{kit-TC3MJAIO.js.map → kit-DBQGQY64.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
runSetup,
|
|
6
6
|
version,
|
|
7
7
|
writeFullConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-I6Z3QX5T.js";
|
|
9
9
|
|
|
10
10
|
// src/kit.ts
|
|
11
11
|
import { createInterface } from "readline";
|
|
@@ -98,4 +98,4 @@ function buildKitProgram() {
|
|
|
98
98
|
export {
|
|
99
99
|
buildKitProgram
|
|
100
100
|
};
|
|
101
|
-
//# sourceMappingURL=kit-
|
|
101
|
+
//# sourceMappingURL=kit-DBQGQY64.js.map
|
|
@@ -7,18 +7,19 @@ import {
|
|
|
7
7
|
print,
|
|
8
8
|
toToolErrorPayload,
|
|
9
9
|
version
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-I6Z3QX5T.js";
|
|
11
11
|
|
|
12
12
|
// src/trade.ts
|
|
13
|
-
import { Command as
|
|
13
|
+
import { Command as Command8 } from "commander";
|
|
14
14
|
|
|
15
15
|
// src/completion.ts
|
|
16
16
|
import { createRequire } from "module";
|
|
17
17
|
var _require = createRequire(import.meta.url);
|
|
18
18
|
var COMPLETION_TREE = {
|
|
19
|
-
groups: ["market", "account", "orders", "bot", "earn", "capabilities"],
|
|
19
|
+
groups: ["market", "account", "wallet", "orders", "bot", "earn", "capabilities"],
|
|
20
20
|
market: ["depth", "trades", "symbols", "tickers", "book_tickers", "klines"],
|
|
21
|
-
account: ["balance"
|
|
21
|
+
account: ["balance"],
|
|
22
|
+
wallet: ["balance_full"],
|
|
22
23
|
orders: ["new", "get", "open", "all", "fills", "fills_by_order_id", "cancel", "cancel_all"],
|
|
23
24
|
bot: ["order_list", "futures_grid", "spot_grid", "smart_copy", "signal"],
|
|
24
25
|
futures_grid: ["get", "create", "adjust_params", "reduce", "cancel", "check_params"],
|
|
@@ -47,6 +48,7 @@ function initCompletion() {
|
|
|
47
48
|
completion2.on("group", ({ reply }) => reply(T.groups));
|
|
48
49
|
completion2.on("market", ({ reply }) => reply(T.market));
|
|
49
50
|
completion2.on("account", ({ reply }) => reply(T.account));
|
|
51
|
+
completion2.on("wallet", ({ reply }) => reply(T.wallet));
|
|
50
52
|
completion2.on("orders", ({ reply }) => reply(T.orders));
|
|
51
53
|
completion2.on("bot", ({ reply }) => reply(T.bot));
|
|
52
54
|
completion2.on("futures_grid", ({ reply }) => reply(T.futures_grid));
|
|
@@ -80,6 +82,9 @@ function generateFishCompletion() {
|
|
|
80
82
|
"# account subcommands",
|
|
81
83
|
...T.account.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from account' -a '${s}'`),
|
|
82
84
|
"",
|
|
85
|
+
"# wallet subcommands",
|
|
86
|
+
...T.wallet.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from wallet' -a '${s}'`),
|
|
87
|
+
"",
|
|
83
88
|
"# orders subcommands",
|
|
84
89
|
...T.orders.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from orders' -a '${s}'`),
|
|
85
90
|
"",
|
|
@@ -194,26 +199,33 @@ function buildAccountCommand() {
|
|
|
194
199
|
process.exit(1);
|
|
195
200
|
}
|
|
196
201
|
});
|
|
197
|
-
|
|
202
|
+
return account;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/commands/wallet.ts
|
|
206
|
+
import { Command as Command3 } from "commander";
|
|
207
|
+
function buildWalletCommand() {
|
|
208
|
+
const wallet = new Command3("wallet").description("Wallet data (requires auth)");
|
|
209
|
+
wallet.command("balance_full").description("Get full account balance overview (spot + futures, with coin prices and USDT/BTC totals)").option("--app-lang <lang>", "App language, e.g. en or zh (overrides sys-lang)").option("--sys-lang <lang>", "System language fallback").action(async (opts, cmd) => {
|
|
198
210
|
try {
|
|
199
211
|
const run = makeRunner(cmd);
|
|
200
212
|
const args = {};
|
|
201
213
|
if (opts.appLang) args["appLang"] = opts.appLang;
|
|
202
214
|
if (opts.sysLang) args["sysLang"] = opts.sysLang;
|
|
203
|
-
const out = await run("
|
|
215
|
+
const out = await run("pionex_wallet_get_balance_full", args);
|
|
204
216
|
print(out.data);
|
|
205
217
|
} catch (e) {
|
|
206
218
|
process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + "\n");
|
|
207
219
|
process.exit(1);
|
|
208
220
|
}
|
|
209
221
|
});
|
|
210
|
-
return
|
|
222
|
+
return wallet;
|
|
211
223
|
}
|
|
212
224
|
|
|
213
225
|
// src/commands/orders.ts
|
|
214
|
-
import { Command as
|
|
226
|
+
import { Command as Command4 } from "commander";
|
|
215
227
|
function buildOrdersCommand() {
|
|
216
|
-
const orders = new
|
|
228
|
+
const orders = new Command4("orders").description("Spot orders (requires auth)");
|
|
217
229
|
orders.command("new").description("Place a new spot order").requiredOption("--symbol <symbol>", "Trading pair (e.g. BTC_USDT)").requiredOption("--side <side>", "BUY or SELL").requiredOption("--type <type>", "Order type (MARKET, LIMIT, etc.)").option("--client-order-id <id>", "Client-assigned order ID").option("--size <size>", "Base asset quantity").option("--price <price>", "Limit price").option("--amount <amount>", "Quote asset amount (for market buy)").option("--IOC", "Immediate-or-cancel flag").action(async (opts, cmd) => {
|
|
218
230
|
try {
|
|
219
231
|
const payload = {
|
|
@@ -322,9 +334,9 @@ function buildOrdersCommand() {
|
|
|
322
334
|
}
|
|
323
335
|
|
|
324
336
|
// src/commands/bot.ts
|
|
325
|
-
import { Command as
|
|
337
|
+
import { Command as Command5 } from "commander";
|
|
326
338
|
function buildFuturesGridCommand() {
|
|
327
|
-
const fg = new
|
|
339
|
+
const fg = new Command5("futures_grid").description("Futures Grid bot sub-commands (requires auth)");
|
|
328
340
|
fg.command("get").description("Get a Futures Grid bot order by ID").requiredOption("--bu-order-id <id>", "Bot order ID").option("--lang <lang>", "Response language (e.g. en, zh)").action(async (opts, cmd) => {
|
|
329
341
|
try {
|
|
330
342
|
const run = makeRunner(cmd);
|
|
@@ -435,7 +447,7 @@ function buildFuturesGridCommand() {
|
|
|
435
447
|
return fg;
|
|
436
448
|
}
|
|
437
449
|
function buildSpotGridCommand() {
|
|
438
|
-
const sg = new
|
|
450
|
+
const sg = new Command5("spot_grid").description("Spot Grid bot sub-commands (requires auth)");
|
|
439
451
|
sg.command("get").description("Get a Spot Grid bot order by ID").requiredOption("--bu-order-id <id>", "Bot order ID").action(async (opts, cmd) => {
|
|
440
452
|
try {
|
|
441
453
|
const run = makeRunner(cmd);
|
|
@@ -566,7 +578,7 @@ function buildSpotGridCommand() {
|
|
|
566
578
|
return sg;
|
|
567
579
|
}
|
|
568
580
|
function buildSmartCopyCommand() {
|
|
569
|
-
const sc = new
|
|
581
|
+
const sc = new Command5("smart_copy").description("Smart Copy bot sub-commands (requires auth)");
|
|
570
582
|
sc.command("get").description("Get a Smart Copy bot order by ID").requiredOption("--bu-order-id <id>", "Bot order ID").action(async (opts, cmd) => {
|
|
571
583
|
try {
|
|
572
584
|
const run = makeRunner(cmd);
|
|
@@ -648,7 +660,7 @@ function buildSmartCopyCommand() {
|
|
|
648
660
|
return sc;
|
|
649
661
|
}
|
|
650
662
|
function buildSignalCommand() {
|
|
651
|
-
const sig = new
|
|
663
|
+
const sig = new Command5("signal").description("Signal provider sub-commands (requires auth)");
|
|
652
664
|
sig.command("listener").description(
|
|
653
665
|
"Push a trading signal to the Pionex signal platform (signal provider use)\n Example: pionex-trade-cli bot signal listener --signal-type <uuid> --signal-param '{}' \\\n --base BTC --quote USDT --time 2024-01-01T12:00:00Z --price 85000 \\\n --action buy --position-size 1 --contracts 1"
|
|
654
666
|
).requiredOption("--signal-type <uuid>", "Signal provider UUID").requiredOption("--signal-param <json>", "Signal parameters as a JSON string (e.g. '{}')").requiredOption("--base <base>", "Base currency (e.g. BTC)").requiredOption("--quote <quote>", "Quote currency (e.g. USDT)").requiredOption("--time <iso>", "Signal timestamp in RFC 3339 format (e.g. 2024-01-01T12:00:00Z)").requiredOption("--price <price>", "Current price at time of signal (e.g. 85000)").requiredOption("--action <action>", "'buy' to open a position, 'sell' to close").requiredOption("--position-size <size>", "Target position size as a fraction (e.g. '1' for 100%)").requiredOption("--contracts <n>", "Number of contracts").option("--direction <dir>", "Optional trade direction").action(async (opts, cmd) => {
|
|
@@ -682,7 +694,7 @@ function buildSignalCommand() {
|
|
|
682
694
|
return sig;
|
|
683
695
|
}
|
|
684
696
|
function buildBotCommand() {
|
|
685
|
-
const bot = new
|
|
697
|
+
const bot = new Command5("bot").description("Bot management (requires auth)");
|
|
686
698
|
bot.command("order_list").description("List bot orders across all bot types").option("--status <status>", "Filter by status: running | finished").option("--base <base>", "Filter by base asset (e.g. BTC)").option("--quote <quote>", "Filter by quote asset (e.g. USDT)").option("--page-token <token>", "Pagination token from previous response").option("--bu-order-types <list>", "Comma-separated types: futures_grid,spot_grid,smart_copy").action(async (opts, cmd) => {
|
|
687
699
|
try {
|
|
688
700
|
const buOrderTypes = opts.buOrderTypes ? opts.buOrderTypes.split(",").map((s) => s.trim()) : void 0;
|
|
@@ -708,9 +720,9 @@ function buildBotCommand() {
|
|
|
708
720
|
}
|
|
709
721
|
|
|
710
722
|
// src/commands/earn.ts
|
|
711
|
-
import { Command as
|
|
723
|
+
import { Command as Command6 } from "commander";
|
|
712
724
|
function buildDualCommand() {
|
|
713
|
-
const dual = new
|
|
725
|
+
const dual = new Command6("dual").description("Dual Investment commands");
|
|
714
726
|
dual.command("symbols").description("List supported Dual Investment trading pairs").option("--base <base>", "Filter by base asset (e.g. BTC)").action(async (opts, cmd) => {
|
|
715
727
|
try {
|
|
716
728
|
const run = makeRunner(cmd);
|
|
@@ -859,15 +871,15 @@ function buildDualCommand() {
|
|
|
859
871
|
return dual;
|
|
860
872
|
}
|
|
861
873
|
function buildEarnCommand() {
|
|
862
|
-
const earn = new
|
|
874
|
+
const earn = new Command6("earn").description("Earn products (requires auth)");
|
|
863
875
|
earn.addCommand(buildDualCommand());
|
|
864
876
|
return earn;
|
|
865
877
|
}
|
|
866
878
|
|
|
867
879
|
// src/commands/capabilities.ts
|
|
868
|
-
import { Command as
|
|
880
|
+
import { Command as Command7 } from "commander";
|
|
869
881
|
function buildCapabilitiesCommand() {
|
|
870
|
-
return new
|
|
882
|
+
return new Command7("capabilities").description("Print all available commands as JSON (for AI agent self-discovery)").action(() => {
|
|
871
883
|
const caps = {
|
|
872
884
|
market: ["depth", "trades", "symbols", "tickers", "book_tickers", "klines"],
|
|
873
885
|
account: ["balance"],
|
|
@@ -900,10 +912,11 @@ function buildCapabilitiesCommand() {
|
|
|
900
912
|
// src/trade.ts
|
|
901
913
|
var completion = initCompletion();
|
|
902
914
|
function buildTradeProgram() {
|
|
903
|
-
const program = new
|
|
904
|
-
program.option("--profile <name>", "Profile name in ~/.pionex/config.toml").option("--modules <list>", "Comma-separated modules to enable (market,account,orders,bot,earn or all)").option("--base-url <url>", "Override API base URL").option("--read-only", "Disable write operations (orders new/cancel, etc.)").option("--dry-run", "Print resolved request body without executing (write commands only)");
|
|
915
|
+
const program = new Command8("pionex-trade-cli").version(version, "-v, --version", "Print version number").description("Pionex trading CLI \u2014 direct access to market data, orders, bots, and earn products").addHelpCommand(true);
|
|
916
|
+
program.option("--profile <name>", "Profile name in ~/.pionex/config.toml").option("--modules <list>", "Comma-separated modules to enable (market,account,wallet,orders,bot,earn or all)").option("--base-url <url>", "Override API base URL").option("--read-only", "Disable write operations (orders new/cancel, etc.)").option("--dry-run", "Print resolved request body without executing (write commands only)");
|
|
905
917
|
program.addCommand(buildMarketCommand());
|
|
906
918
|
program.addCommand(buildAccountCommand());
|
|
919
|
+
program.addCommand(buildWalletCommand());
|
|
907
920
|
program.addCommand(buildOrdersCommand());
|
|
908
921
|
program.addCommand(buildBotCommand());
|
|
909
922
|
program.addCommand(buildEarnCommand());
|
|
@@ -924,4 +937,4 @@ function buildTradeProgram() {
|
|
|
924
937
|
export {
|
|
925
938
|
buildTradeProgram
|
|
926
939
|
};
|
|
927
|
-
//# sourceMappingURL=trade-
|
|
940
|
+
//# sourceMappingURL=trade-4DUOU56K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/trade.ts","../src/completion.ts","../src/commands/market.ts","../src/commands/account.ts","../src/commands/wallet.ts","../src/commands/orders.ts","../src/commands/bot.ts","../src/commands/earn.ts","../src/commands/capabilities.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { version } from \"./helpers.js\";\nimport { initCompletion, generateFishCompletion } from \"./completion.js\";\nimport { buildMarketCommand } from \"./commands/market.js\";\nimport { buildAccountCommand } from \"./commands/account.js\";\nimport { buildWalletCommand } from \"./commands/wallet.js\";\nimport { buildOrdersCommand } from \"./commands/orders.js\";\nimport { buildBotCommand } from \"./commands/bot.js\";\nimport { buildEarnCommand } from \"./commands/earn.js\";\nimport { buildCapabilitiesCommand } from \"./commands/capabilities.js\";\n\n// omelette must be initialized before commander parses argv\n// (it intercepts COMP_LINE / COMP_POINT env vars set by the shell)\nconst completion = initCompletion();\n\nexport function buildTradeProgram(): Command {\n const program = new Command(\"pionex-trade-cli\")\n .version(version, \"-v, --version\", \"Print version number\")\n .description(\"Pionex trading CLI — direct access to market data, orders, bots, and earn products\")\n .addHelpCommand(true);\n\n // Global options inherited by all sub-commands via cmd.optsWithGlobals()\n program\n .option(\"--profile <name>\", \"Profile name in ~/.pionex/config.toml\")\n .option(\"--modules <list>\", \"Comma-separated modules to enable (market,account,wallet,orders,bot,earn or all)\")\n .option(\"--base-url <url>\", \"Override API base URL\")\n .option(\"--read-only\", \"Disable write operations (orders new/cancel, etc.)\")\n .option(\"--dry-run\", \"Print resolved request body without executing (write commands only)\");\n\n program.addCommand(buildMarketCommand());\n program.addCommand(buildAccountCommand());\n program.addCommand(buildWalletCommand());\n program.addCommand(buildOrdersCommand());\n program.addCommand(buildBotCommand());\n program.addCommand(buildEarnCommand());\n program.addCommand(buildCapabilitiesCommand());\n\n // Shell completion setup commands\n program\n .command(\"setup-completion\")\n .description(\"Install tab completion for bash/zsh (run once, then source your shell config)\")\n .action(() => {\n completion.setupShellInitFile();\n process.stdout.write(\n \"✓ Completion installed.\\n\" +\n \" bash: source ~/.bashrc\\n\" +\n \" zsh: source ~/.zshrc\\n\"\n );\n });\n\n program\n .command(\"setup-completion-fish\")\n .description(\n \"Print fish shell completion script\\n\" +\n \" Usage: pionex-trade-cli setup-completion-fish > ~/.config/fish/completions/pionex-trade-cli.fish\"\n )\n .action(() => {\n process.stdout.write(generateFishCompletion());\n });\n\n return program;\n}\n","import { createRequire } from \"node:module\";\n\nconst _require = createRequire(import.meta.url);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// COMPLETION TREE\n//\n// ⚠️ 每次新增、删除、重命名命令时,必须同步更新此处。\n// 同时检查 src/commands/ 下对应文件中的 .command() 声明保持一致。\n// ─────────────────────────────────────────────────────────────────────────────\nexport const COMPLETION_TREE = {\n groups: [\"market\", \"account\", \"wallet\", \"orders\", \"bot\", \"earn\", \"capabilities\"],\n market: [\"depth\", \"trades\", \"symbols\", \"tickers\", \"book_tickers\", \"klines\"],\n account: [\"balance\"],\n wallet: [\"balance_full\"],\n orders: [\"new\", \"get\", \"open\", \"all\", \"fills\", \"fills_by_order_id\", \"cancel\", \"cancel_all\"],\n bot: [\"order_list\", \"futures_grid\", \"spot_grid\", \"smart_copy\", \"signal\"],\n futures_grid: [\"get\", \"create\", \"adjust_params\", \"reduce\", \"cancel\", \"check_params\"],\n spot_grid: [\"get\", \"get_ai_strategy\", \"create\", \"adjust_params\", \"invest_in\", \"cancel\", \"profit\", \"check_params\"],\n smart_copy: [\"get\", \"create\", \"cancel\", \"check_params\"],\n signal: [\"listener\"],\n earn: [\"dual\"],\n dual: [\"symbols\", \"open_products\", \"prices\", \"index\", \"delivery_prices\",\n \"balances\", \"get_invests\", \"records\", \"invest\", \"revoke_invest\", \"collect\"],\n} as const;\n\ntype OmeletteReply = { reply: (words: readonly string[]) => void };\ntype OmeletteInstance = {\n on(event: string, handler: (opts: OmeletteReply) => void): void;\n init(): void;\n setupShellInitFile(filepath?: string): void;\n cleanupShellInitFile(filepath?: string): void;\n};\n\n/**\n * 初始化 omelette 补全(bash/zsh)。\n * 必须在 commander 解析参数之前调用(模块加载时执行)。\n */\nexport function initCompletion(): OmeletteInstance {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const omelette = _require(\"omelette\") as (template: string) => OmeletteInstance;\n const completion = omelette(\"pionex-trade-cli <group> <sub> <cmd>\");\n\n const T = COMPLETION_TREE;\n completion.on(\"group\", ({ reply }) => reply(T.groups));\n completion.on(\"market\", ({ reply }) => reply(T.market));\n completion.on(\"account\", ({ reply }) => reply(T.account));\n completion.on(\"wallet\", ({ reply }) => reply(T.wallet));\n completion.on(\"orders\", ({ reply }) => reply(T.orders));\n completion.on(\"bot\", ({ reply }) => reply(T.bot));\n completion.on(\"futures_grid\", ({ reply }) => reply(T.futures_grid));\n completion.on(\"spot_grid\", ({ reply }) => reply(T.spot_grid));\n completion.on(\"smart_copy\", ({ reply }) => reply(T.smart_copy));\n completion.on(\"signal\", ({ reply }) => reply(T.signal));\n completion.on(\"earn\", ({ reply }) => reply(T.earn));\n completion.on(\"dual\", ({ reply }) => reply(T.dual));\n\n completion.init();\n return completion;\n}\n\n/**\n * 生成 fish shell 补全脚本。\n * 输出到 stdout,用户重定向到:\n * ~/.config/fish/completions/pionex-trade-cli.fish\n */\nexport function generateFishCompletion(): string {\n const cmd = \"pionex-trade-cli\";\n const T = COMPLETION_TREE;\n const lines: string[] = [\n `# ${cmd} fish shell completion`,\n `# Generated by: ${cmd} setup-completion-fish`,\n `# To install: ${cmd} setup-completion-fish > ~/.config/fish/completions/${cmd}.fish`,\n \"\",\n \"# Disable file completion globally for this command\",\n `complete -c ${cmd} -f`,\n \"\",\n \"# Top-level groups\",\n ...T.groups.map((g) =>\n `complete -c ${cmd} -n 'not __fish_seen_subcommand_from ${T.groups.join(\" \")}' -a '${g}'`\n ),\n \"\",\n \"# market subcommands\",\n ...T.market.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from market' -a '${s}'`),\n \"\",\n \"# account subcommands\",\n ...T.account.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from account' -a '${s}'`),\n \"\",\n \"# wallet subcommands\",\n ...T.wallet.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from wallet' -a '${s}'`),\n \"\",\n \"# orders subcommands\",\n ...T.orders.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from orders' -a '${s}'`),\n \"\",\n \"# bot subcommands (only before entering futures_grid, spot_grid, smart_copy, or signal)\",\n ...T.bot.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from bot; and not __fish_seen_subcommand_from futures_grid spot_grid smart_copy signal' -a '${s}'`),\n \"\",\n \"# bot futures_grid commands\",\n ...T.futures_grid.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from futures_grid' -a '${s}'`),\n \"\",\n \"# bot spot_grid commands\",\n ...T.spot_grid.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from spot_grid' -a '${s}'`),\n \"\",\n \"# bot smart_copy commands\",\n ...T.smart_copy.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from smart_copy' -a '${s}'`),\n \"\",\n \"# bot signal commands\",\n ...T.signal.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from signal' -a '${s}'`),\n \"\",\n \"# earn subcommands (only before entering dual)\",\n ...T.earn.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from earn; and not __fish_seen_subcommand_from dual' -a '${s}'`),\n \"\",\n \"# earn dual commands\",\n ...T.dual.map((s) => `complete -c ${cmd} -n '__fish_seen_subcommand_from dual' -a '${s}'`),\n \"\",\n ];\n return lines.join(\"\\n\");\n}\n","import { Command } from \"commander\";\nimport { toToolErrorPayload } from \"@pionex-ai/core\";\nimport { print, makeRunner } from \"../helpers.js\";\n\nexport function buildMarketCommand(): Command {\n const market = new Command(\"market\").description(\"Market data (public, no auth required)\");\n\n market\n .command(\"depth <symbol>\")\n .description(\"Get order book depth for a symbol\")\n .option(\"--limit <n>\", \"Number of price levels to return\", parseInt)\n .action(async (symbol: string, opts: { limit?: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_market_get_depth\", { symbol, limit: opts.limit });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n market\n .command(\"trades <symbol>\")\n .description(\"Get recent trades for a symbol\")\n .option(\"--limit <n>\", \"Number of trades to return\", parseInt)\n .action(async (symbol: string, opts: { limit?: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_market_get_trades\", { symbol, limit: opts.limit });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n market\n .command(\"symbols\")\n .description(\"Get symbol/trading pair information\")\n .option(\"--symbols <list>\", \"Comma-separated symbol list (e.g. BTC_USDT)\")\n .option(\"--type <type>\", \"Symbol type filter\")\n .action(async (opts: { symbols?: string; type?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_market_get_symbol_info\", { symbols: opts.symbols, type: opts.type });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n market\n .command(\"tickers\")\n .description(\"Get 24h ticker statistics\")\n .option(\"--symbol <symbol>\", \"Filter by symbol (e.g. BTC_USDT)\")\n .option(\"--type <type>\", \"Symbol type filter\")\n .action(async (opts: { symbol?: string; type?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_market_get_tickers\", { symbol: opts.symbol, type: opts.type });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n market\n .command(\"book_tickers\")\n .description(\"Get best bid/ask prices for symbols\")\n .option(\"--symbol <symbol>\", \"Filter by symbol (e.g. BTC_USDT)\")\n .option(\"--type <type>\", \"Symbol type filter\")\n .action(async (opts: { symbol?: string; type?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_market_get_book_tickers\", { symbol: opts.symbol, type: opts.type });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n market\n .command(\"klines [symbol] [interval]\")\n .description(\"Get candlestick/kline data\\n Valid intervals: 1M 5M 15M 30M 60M 4H 8H 12H 1D\\n Example: pionex-trade-cli market klines BTC_USDT 60M\")\n .option(\"--symbol <symbol>\", \"Trading pair (e.g. BTC_USDT)\")\n .option(\"--interval <interval>\", \"Kline interval: 1M 5M 15M 30M 60M 4H 8H 12H 1D\")\n .option(\"--end-time <ms>\", \"End time in milliseconds\", parseInt)\n .option(\"--limit <n>\", \"Number of klines to return\", parseInt)\n .action(async (posSymbol: string | undefined, posInterval: string | undefined, opts: { symbol?: string; interval?: string; endTime?: number; limit?: number }, cmd: Command) => {\n try {\n const symbol = opts.symbol ?? posSymbol;\n const interval = opts.interval ?? posInterval;\n if (!symbol || !interval) {\n throw new Error(\"Missing symbol/interval. Example: pionex-trade-cli market klines BTC_USDT 60M\");\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_market_get_klines\", { symbol, interval, endTime: opts.endTime, limit: opts.limit });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return market;\n}\n","import { Command } from \"commander\";\nimport { toToolErrorPayload } from \"@pionex-ai/core\";\nimport { print, makeRunner } from \"../helpers.js\";\n\nexport function buildAccountCommand(): Command {\n const account = new Command(\"account\").description(\"Account data (requires auth)\");\n\n account\n .command(\"balance\")\n .description(\"Get account balance for all assets\")\n .action(async (_opts: Record<string, unknown>, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_account_get_balance\", {});\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return account;\n}\n","import { Command } from \"commander\";\nimport { toToolErrorPayload } from \"@pionex-ai/core\";\nimport { print, makeRunner } from \"../helpers.js\";\n\nexport function buildWalletCommand(): Command {\n const wallet = new Command(\"wallet\").description(\"Wallet data (requires auth)\");\n\n wallet\n .command(\"balance_full\")\n .description(\"Get full account balance overview (spot + futures, with coin prices and USDT/BTC totals)\")\n .option(\"--app-lang <lang>\", \"App language, e.g. en or zh (overrides sys-lang)\")\n .option(\"--sys-lang <lang>\", \"System language fallback\")\n .action(async (opts: { appLang?: string; sysLang?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const args: Record<string, string> = {};\n if (opts.appLang) args[\"appLang\"] = opts.appLang;\n if (opts.sysLang) args[\"sysLang\"] = opts.sysLang;\n const out = await run(\"pionex_wallet_get_balance_full\", args);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return wallet;\n}\n","import { Command } from \"commander\";\nimport { toToolErrorPayload } from \"@pionex-ai/core\";\nimport { print, makeRunner, isDryRun } from \"../helpers.js\";\n\nexport function buildOrdersCommand(): Command {\n const orders = new Command(\"orders\").description(\"Spot orders (requires auth)\");\n\n orders\n .command(\"new\")\n .description(\"Place a new spot order\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair (e.g. BTC_USDT)\")\n .requiredOption(\"--side <side>\", \"BUY or SELL\")\n .requiredOption(\"--type <type>\", \"Order type (MARKET, LIMIT, etc.)\")\n .option(\"--client-order-id <id>\", \"Client-assigned order ID\")\n .option(\"--size <size>\", \"Base asset quantity\")\n .option(\"--price <price>\", \"Limit price\")\n .option(\"--amount <amount>\", \"Quote asset amount (for market buy)\")\n .option(\"--IOC\", \"Immediate-or-cancel flag\")\n .action(async (opts: { symbol: string; side: string; type: string; clientOrderId?: string; size?: string; price?: string; amount?: string; IOC?: boolean }, cmd: Command) => {\n try {\n const payload = {\n symbol: opts.symbol,\n side: opts.side,\n type: opts.type,\n clientOrderId: opts.clientOrderId,\n size: opts.size,\n price: opts.price,\n amount: opts.amount,\n IOC: opts.IOC,\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_orders_new_order\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_new_order\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"get\")\n .description(\"Get an order by ID\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .requiredOption(\"--order-id <id>\", \"Order ID\", parseInt)\n .action(async (opts: { symbol: string; orderId: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_get_order\", { symbol: opts.symbol, orderId: opts.orderId });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"open\")\n .description(\"Get open orders for a symbol\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .action(async (opts: { symbol: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_get_open_orders\", { symbol: opts.symbol });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"all\")\n .description(\"Get all orders for a symbol\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .option(\"--limit <n>\", \"Maximum number of orders to return\", parseInt)\n .action(async (opts: { symbol: string; limit?: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_get_all_orders\", { symbol: opts.symbol, limit: opts.limit });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"fills\")\n .description(\"Get fill records for a symbol\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .option(\"--start-time <ms>\", \"Start time in milliseconds\", parseInt)\n .option(\"--end-time <ms>\", \"End time in milliseconds\", parseInt)\n .action(async (opts: { symbol: string; startTime?: number; endTime?: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_get_fills\", { symbol: opts.symbol, startTime: opts.startTime, endTime: opts.endTime });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"fills_by_order_id\")\n .description(\"Get fill records for a specific order\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .requiredOption(\"--order-id <id>\", \"Order ID\", parseInt)\n .action(async (opts: { symbol: string; orderId: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_get_fills_by_order_id\", { symbol: opts.symbol, orderId: opts.orderId });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"cancel\")\n .description(\"Cancel an order\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .requiredOption(\"--order-id <id>\", \"Order ID\", parseInt)\n .action(async (opts: { symbol: string; orderId: number }, cmd: Command) => {\n try {\n const payload = { symbol: opts.symbol, orderId: opts.orderId };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_orders_cancel_order\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_cancel_order\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n orders\n .command(\"cancel_all\")\n .description(\"Cancel all open orders for a symbol\")\n .requiredOption(\"--symbol <symbol>\", \"Trading pair\")\n .action(async (opts: { symbol: string }, cmd: Command) => {\n try {\n const payload = { symbol: opts.symbol };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_orders_cancel_all_orders\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_orders_cancel_all_orders\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return orders;\n}\n","import { Command } from \"commander\";\nimport { toToolErrorPayload, parseAndValidateCreateFuturesGridBuOrderData, parseAndValidateCreateSpotGridBuOrderData } from \"@pionex-ai/core\";\nimport { print, makeRunner, isDryRun, parseJsonFlag } from \"../helpers.js\";\n\nfunction buildFuturesGridCommand(): Command {\n const fg = new Command(\"futures_grid\").description(\"Futures Grid bot sub-commands (requires auth)\");\n\n fg.command(\"get\")\n .description(\"Get a Futures Grid bot order by ID\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .option(\"--lang <lang>\", \"Response language (e.g. en, zh)\")\n .action(async (opts: { buOrderId: string; lang?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_get_order\", { buOrderId: opts.buOrderId, lang: opts.lang });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n fg.command(\"create\")\n .description(\n \"Create a Futures Grid bot\\n\" +\n \" Example: pionex-trade-cli bot futures_grid create --base BTC --quote USDT \\\\\\n\" +\n \" --bu-order-data-json '{\\\"top\\\":\\\"110000\\\",\\\"bottom\\\":\\\"90000\\\",\\\"row\\\":100,\\\"grid_type\\\":\\\"arithmetic\\\",\\\"trend\\\":\\\"long\\\",\\\"leverage\\\":5,\\\"quoteInvestment\\\":\\\"100\\\"}'\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC, normalized to BTC.PERP if needed)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .requiredOption(\"--bu-order-data-json <json>\", \"JSON object with grid parameters\")\n .option(\"--copy-from <source>\", \"Copy source type\")\n .option(\"--copy-type <type>\", \"Copy type\")\n .option(\"--copy-bot-order-id <id>\", \"Bot order ID to copy from\")\n .action(async (opts: { base: string; quote: string; buOrderDataJson: string; copyFrom?: string; copyType?: string; copyBotOrderId?: string }, cmd: Command) => {\n try {\n const buOrderDataRaw = parseJsonFlag(opts.buOrderDataJson, \"bu-order-data-json\");\n const buOrderData = parseAndValidateCreateFuturesGridBuOrderData(buOrderDataRaw);\n const payload: Record<string, unknown> = {\n base: opts.base,\n quote: opts.quote,\n buOrderData,\n copyFrom: opts.copyFrom,\n copyType: opts.copyType,\n copyBotOrderId: opts.copyBotOrderId,\n };\n if (isDryRun(cmd)) {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_create\", { ...payload, __dryRun: true });\n print(out.data);\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_create\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n fg.command(\"adjust_params\")\n .description(\"Adjust parameters of an existing Futures Grid bot\")\n .requiredOption(\"--body-json <json>\", \"JSON object with parameters to adjust\")\n .action(async (opts: { bodyJson: string }, cmd: Command) => {\n try {\n const payload = parseJsonFlag(opts.bodyJson, \"body-json\");\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_futures_grid_adjust_params\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_adjust_params\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n fg.command(\"reduce\")\n .description(\"Reduce position of a Futures Grid bot\")\n .requiredOption(\"--body-json <json>\", \"JSON object with reduce parameters\")\n .action(async (opts: { bodyJson: string }, cmd: Command) => {\n try {\n const payload = parseJsonFlag(opts.bodyJson, \"body-json\");\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_futures_grid_reduce\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_reduce\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n fg.command(\"check_params\")\n .description(\n \"Validate Futures Grid bot parameters before creating an order\\n\" +\n \" Example: pionex-trade-cli bot futures_grid check_params --base BTC --quote USDT \\\\\\n\" +\n \" --bu-order-data-json '{\\\"top\\\":\\\"110000\\\",\\\"bottom\\\":\\\"90000\\\",\\\"row\\\":100,\\\"grid_type\\\":\\\"arithmetic\\\",\\\"trend\\\":\\\"long\\\",\\\"leverage\\\":5,\\\"quoteInvestment\\\":\\\"100\\\"}'\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .requiredOption(\"--bu-order-data-json <json>\", \"JSON object with grid parameters\")\n .action(async (opts: { base: string; quote: string; buOrderDataJson: string }, cmd: Command) => {\n try {\n const buOrderDataRaw = parseJsonFlag(opts.buOrderDataJson, \"bu-order-data-json\");\n const buOrderData = parseAndValidateCreateFuturesGridBuOrderData(buOrderDataRaw);\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_check_params\", { base: opts.base, quote: opts.quote, buOrderData });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n fg.command(\"cancel\")\n .description(\"Cancel a Futures Grid bot\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .option(\"--close-note <note>\", \"Close note\")\n .option(\"--close-sell-model <model>\", \"Sell model on close\")\n .option(\"--immediate\", \"Close immediately\")\n .option(\"--close-slippage <slippage>\", \"Slippage tolerance on close\")\n .action(async (opts: { buOrderId: string; closeNote?: string; closeSellModel?: string; immediate?: boolean; closeSlippage?: string }, cmd: Command) => {\n try {\n const payload = {\n buOrderId: opts.buOrderId,\n closeNote: opts.closeNote,\n closeSellModel: opts.closeSellModel,\n immediate: opts.immediate,\n closeSlippage: opts.closeSlippage,\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_futures_grid_cancel\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_futures_grid_cancel\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return fg;\n}\n\nfunction buildSpotGridCommand(): Command {\n const sg = new Command(\"spot_grid\").description(\"Spot Grid bot sub-commands (requires auth)\");\n\n sg.command(\"get\")\n .description(\"Get a Spot Grid bot order by ID\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .action(async (opts: { buOrderId: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_get_order\", { buOrderId: opts.buOrderId });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"get_ai_strategy\")\n .description(\"Get AI-recommended Spot Grid strategy parameters\")\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .action(async (opts: { base: string; quote: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_get_ai_strategy\", { base: opts.base, quote: opts.quote });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"create\")\n .description(\n \"Create a Spot Grid bot\\n\" +\n \" Example: pionex-trade-cli bot spot_grid create --base BTC --quote USDT \\\\\\n\" +\n \" --bu-order-data-json '{\\\"top\\\":\\\"110000\\\",\\\"bottom\\\":\\\"90000\\\",\\\"row\\\":50,\\\"gridType\\\":\\\"arithmetic\\\",\\\"quoteTotalInvestment\\\":\\\"100\\\"}'\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .requiredOption(\"--bu-order-data-json <json>\", \"JSON object with grid parameters\")\n .option(\"--note <note>\", \"Optional note for this bot\")\n .action(async (opts: { base: string; quote: string; buOrderDataJson: string; note?: string }, cmd: Command) => {\n try {\n const buOrderDataRaw = parseJsonFlag(opts.buOrderDataJson, \"bu-order-data-json\");\n const buOrderData = parseAndValidateCreateSpotGridBuOrderData(buOrderDataRaw);\n const payload: Record<string, unknown> = { base: opts.base, quote: opts.quote, note: opts.note, buOrderData };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_spot_grid_create\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_create\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"adjust_params\")\n .description(\"Adjust parameters of an existing Spot Grid bot\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .option(\"--top <price>\", \"New upper price boundary\")\n .option(\"--bottom <price>\", \"New lower price boundary\")\n .option(\"--row <n>\", \"New number of grid rows\", parseInt)\n .option(\"--quote-invest <amount>\", \"Additional quote investment amount\")\n .action(async (opts: { buOrderId: string; top?: string; bottom?: string; row?: number; quoteInvest?: string }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = {\n buOrderId: opts.buOrderId,\n top: opts.top,\n bottom: opts.bottom,\n row: opts.row,\n quoteInvest: opts.quoteInvest,\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_spot_grid_adjust_params\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_adjust_params\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"invest_in\")\n .description(\"Add investment to an existing Spot Grid bot\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .requiredOption(\"--quote-invest <amount>\", \"Quote asset amount to invest\")\n .action(async (opts: { buOrderId: string; quoteInvest: string }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = { buOrderId: opts.buOrderId, quoteInvest: opts.quoteInvest };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_spot_grid_invest_in\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_invest_in\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"check_params\")\n .description(\n \"Validate Spot Grid bot parameters before creating an order\\n\" +\n \" Example: pionex-trade-cli bot spot_grid check_params --base BTC --quote USDT \\\\\\n\" +\n \" --bu-order-data-json '{\\\"top\\\":\\\"110000\\\",\\\"bottom\\\":\\\"90000\\\",\\\"row\\\":50,\\\"gridType\\\":\\\"arithmetic\\\",\\\"quoteTotalInvestment\\\":\\\"100\\\"}'\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .requiredOption(\"--bu-order-data-json <json>\", \"JSON object with grid parameters\")\n .action(async (opts: { base: string; quote: string; buOrderDataJson: string }, cmd: Command) => {\n try {\n const buOrderDataRaw = parseJsonFlag(opts.buOrderDataJson, \"bu-order-data-json\");\n const buOrderData = parseAndValidateCreateSpotGridBuOrderData(buOrderDataRaw);\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_check_params\", { base: opts.base, quote: opts.quote, buOrderData });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"cancel\")\n .description(\"Cancel a Spot Grid bot\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .option(\"--close-sell-model <model>\", \"Sell model on close: NOT_SELL | TO_QUOTE | TO_USDT\")\n .option(\"--slippage <slippage>\", \"Slippage tolerance\")\n .action(async (opts: { buOrderId: string; closeSellModel?: string; slippage?: string }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = {\n buOrderId: opts.buOrderId,\n closeSellModel: opts.closeSellModel,\n slippage: opts.slippage,\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_spot_grid_cancel\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_cancel\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sg.command(\"profit\")\n .description(\"Withdraw profit from a Spot Grid bot\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .requiredOption(\"--amount <amount>\", \"Amount to withdraw\")\n .action(async (opts: { buOrderId: string; amount: string }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = { buOrderId: opts.buOrderId, amount: opts.amount };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_spot_grid_profit\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_spot_grid_profit\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return sg;\n}\n\nfunction buildSmartCopyCommand(): Command {\n const sc = new Command(\"smart_copy\").description(\"Smart Copy bot sub-commands (requires auth)\");\n\n sc.command(\"get\")\n .description(\"Get a Smart Copy bot order by ID\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .action(async (opts: { buOrderId: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_smart_copy_get_order\", { buOrderId: opts.buOrderId });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sc.command(\"create\")\n .description(\n \"Create a Smart Copy bot\\n\" +\n \" Example: pionex-trade-cli bot smart_copy create --base BTC --quote USDT \\\\\\n\" +\n \" --bu-order-data-json '{\\\"quote_total_investment\\\":\\\"100\\\",\\\"portfolio\\\":[{\\\"base\\\":\\\"BTC\\\",\\\"signal_type\\\":\\\"<uuid>\\\",\\\"leverage\\\":2,\\\"percent\\\":\\\"1\\\"}]}'\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .requiredOption(\"--bu-order-data-json <json>\", \"JSON with quote_total_investment and portfolio array\")\n .option(\"--copy-from <id>\", \"Source bot order ID to copy settings from\")\n .option(\"--copy-type <type>\", \"Copy type\")\n .option(\"--note <note>\", \"Optional note\")\n .action(async (opts: { base: string; quote: string; buOrderDataJson: string; copyFrom?: string; copyType?: string; note?: string }, cmd: Command) => {\n try {\n const bu_order_data = parseJsonFlag(opts.buOrderDataJson, \"bu-order-data-json\");\n const payload: Record<string, unknown> = {\n base: opts.base,\n quote: opts.quote,\n bu_order_data,\n copy_from: opts.copyFrom,\n copy_type: opts.copyType,\n note: opts.note,\n };\n if (isDryRun(cmd)) {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_smart_copy_create\", { ...payload, __dryRun: true });\n print(out.data);\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_smart_copy_create\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sc.command(\"check_params\")\n .description(\n \"Validate Smart Copy parameters before creating an order\\n\" +\n \" Example: pionex-trade-cli bot smart_copy check_params --base BTC --quote USDT \\\\\\n\" +\n \" --leverage 2 --quote-investment 0 --signal-type <uuid>\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (e.g. USDT)\")\n .requiredOption(\"--leverage <n>\", \"Leverage multiplier\", parseInt)\n .requiredOption(\"--quote-investment <amount>\", \"Investment amount; use '0' to get range only\")\n .option(\"--signal-type <uuid>\", \"Optional signal provider UUID\")\n .option(\"--signal-param <json>\", \"Optional signal parameters as a JSON string\")\n .action(async (opts: { base: string; quote: string; leverage: number; quoteInvestment: string; signalType?: string; signalParam?: string }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = {\n base: opts.base,\n quote: opts.quote,\n leverage: opts.leverage,\n quote_investment: opts.quoteInvestment,\n signal_type: opts.signalType,\n signal_param: opts.signalParam,\n };\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_smart_copy_check_params\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n sc.command(\"cancel\")\n .description(\"Cancel a Smart Copy bot\")\n .requiredOption(\"--bu-order-id <id>\", \"Bot order ID\")\n .option(\"--close-note <note>\", \"Optional close note\")\n .option(\"--convert-into-earn-coin\", \"Convert remaining funds into earn coin\")\n .action(async (opts: { buOrderId: string; closeNote?: string; convertIntoEarnCoin?: boolean }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = {\n bu_order_id: opts.buOrderId,\n close_note: opts.closeNote,\n convert_into_earn_coin: opts.convertIntoEarnCoin,\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_smart_copy_cancel\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_smart_copy_cancel\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return sc;\n}\n\nfunction buildSignalCommand(): Command {\n const sig = new Command(\"signal\").description(\"Signal provider sub-commands (requires auth)\");\n\n sig.command(\"listener\")\n .description(\n \"Push a trading signal to the Pionex signal platform (signal provider use)\\n\" +\n \" Example: pionex-trade-cli bot signal listener --signal-type <uuid> --signal-param '{}' \\\\\\n\" +\n \" --base BTC --quote USDT --time 2024-01-01T12:00:00Z --price 85000 \\\\\\n\" +\n \" --action buy --position-size 1 --contracts 1\"\n )\n .requiredOption(\"--signal-type <uuid>\", \"Signal provider UUID\")\n .requiredOption(\"--signal-param <json>\", \"Signal parameters as a JSON string (e.g. '{}')\")\n .requiredOption(\"--base <base>\", \"Base currency (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote currency (e.g. USDT)\")\n .requiredOption(\"--time <iso>\", \"Signal timestamp in RFC 3339 format (e.g. 2024-01-01T12:00:00Z)\")\n .requiredOption(\"--price <price>\", \"Current price at time of signal (e.g. 85000)\")\n .requiredOption(\"--action <action>\", \"'buy' to open a position, 'sell' to close\")\n .requiredOption(\"--position-size <size>\", \"Target position size as a fraction (e.g. '1' for 100%)\")\n .requiredOption(\"--contracts <n>\", \"Number of contracts\")\n .option(\"--direction <dir>\", \"Optional trade direction\")\n .action(async (opts: { signalType: string; signalParam: string; base: string; quote: string; time: string; price: string; action: string; positionSize: string; contracts: string; direction?: string }, cmd: Command) => {\n try {\n const payload: Record<string, unknown> = {\n signalType: opts.signalType,\n signalParam: opts.signalParam,\n base: opts.base,\n quote: opts.quote,\n time: opts.time,\n price: opts.price,\n data: {\n action: opts.action,\n position_size: opts.positionSize,\n contracts: opts.contracts,\n direction: opts.direction,\n },\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_bot_signal_listener\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_signal_listener\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return sig;\n}\n\nexport function buildBotCommand(): Command {\n const bot = new Command(\"bot\").description(\"Bot management (requires auth)\");\n\n bot.command(\"order_list\")\n .description(\"List bot orders across all bot types\")\n .option(\"--status <status>\", \"Filter by status: running | finished\")\n .option(\"--base <base>\", \"Filter by base asset (e.g. BTC)\")\n .option(\"--quote <quote>\", \"Filter by quote asset (e.g. USDT)\")\n .option(\"--page-token <token>\", \"Pagination token from previous response\")\n .option(\"--bu-order-types <list>\", \"Comma-separated types: futures_grid,spot_grid,smart_copy\")\n .action(async (opts: { status?: string; base?: string; quote?: string; pageToken?: string; buOrderTypes?: string }, cmd: Command) => {\n try {\n const buOrderTypes = opts.buOrderTypes ? opts.buOrderTypes.split(\",\").map((s) => s.trim()) : undefined;\n const run = makeRunner(cmd);\n const out = await run(\"pionex_bot_order_list\", {\n status: opts.status,\n base: opts.base,\n quote: opts.quote,\n pageToken: opts.pageToken,\n buOrderTypes,\n });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n bot.addCommand(buildFuturesGridCommand());\n bot.addCommand(buildSpotGridCommand());\n bot.addCommand(buildSmartCopyCommand());\n bot.addCommand(buildSignalCommand());\n\n return bot;\n}\n","import { Command } from \"commander\";\nimport { toToolErrorPayload } from \"@pionex-ai/core\";\nimport { print, makeRunner, isDryRun } from \"../helpers.js\";\n\nfunction buildDualCommand(): Command {\n const dual = new Command(\"dual\").description(\"Dual Investment commands\");\n\n dual\n .command(\"symbols\")\n .description(\"List supported Dual Investment trading pairs\")\n .option(\"--base <base>\", \"Filter by base asset (e.g. BTC)\")\n .action(async (opts: { base?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_symbols\", { base: opts.base });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"open_products\")\n .description(\n \"List open Dual Investment products\\n\" +\n \" BTC/ETH: --quote USDXO; others: --quote USDT\\n\" +\n \" Product ID format: {BASE}-{QUOTE}-{YYMMDD}-{STRIKE}-{C|P}-{CURRENCY}\"\n )\n .requiredOption(\"--base <base>\", \"Base asset (e.g. BTC)\")\n .requiredOption(\"--quote <quote>\", \"Quote asset (USDXO for BTC/ETH, USDT for others)\")\n .requiredOption(\"--type <type>\", \"Product type: DUAL_BASE | DUAL_CURRENCY\")\n .option(\"--currency <currency>\", \"Settlement currency (e.g. USDT, USDC)\")\n .action(async (opts: { base: string; quote: string; type: string; currency?: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_open_products\", { base: opts.base, quote: opts.quote, type: opts.type, currency: opts.currency });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"prices\")\n .description(\"Get yield rates for products (call before invest — pass profit value unchanged)\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .requiredOption(\"--quote <quote>\", \"Quote asset\")\n .requiredOption(\"--product-ids <ids>\", \"Comma-separated product IDs\")\n .action(async (opts: { base: string; quote: string; productIds: string }, cmd: Command) => {\n try {\n const productIds = opts.productIds.split(\",\").map((s) => s.trim());\n if (productIds.length === 0) throw new Error(\"--product-ids must not be empty\");\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_prices\", { base: opts.base, quote: opts.quote, productIds });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"index\")\n .description(\"Get index price for a trading pair\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .requiredOption(\"--quote <quote>\", \"Quote asset\")\n .action(async (opts: { base: string; quote: string }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_index\", { base: opts.base, quote: opts.quote });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"delivery_prices\")\n .description(\"Get historical delivery prices\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .option(\"--quote <quote>\", \"Quote asset\")\n .option(\"--start-time <ms>\", \"Start time in milliseconds\", parseInt)\n .option(\"--end-time <ms>\", \"End time in milliseconds\", parseInt)\n .action(async (opts: { base: string; quote?: string; startTime?: number; endTime?: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_delivery_prices\", { base: opts.base, quote: opts.quote, startTime: opts.startTime, endTime: opts.endTime });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"balances\")\n .description(\"Get Dual Investment balances (requires read auth)\")\n .option(\"--merge\", \"Merge balances across currencies\")\n .action(async (opts: { merge?: boolean }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_balances\", { merge: opts.merge });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"get_invests\")\n .description(\"Batch query Dual Investment orders (requires read auth)\")\n .option(\"--base <base>\", \"Filter by base asset\")\n .requiredOption(\"--client-dual-ids <ids>\", \"Comma-separated client dual IDs\")\n .action(async (opts: { base?: string; clientDualIds: string }, cmd: Command) => {\n try {\n const clientDualIds = opts.clientDualIds.split(\",\").map((s) => s.trim());\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_get_invests\", { base: opts.base, clientDualIds });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"records\")\n .description(\"Get Dual Investment history (requires read auth)\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .requiredOption(\"--end-time <ms>\", \"End time in milliseconds\", parseInt)\n .option(\"--quote <quote>\", \"Quote asset\")\n .option(\"--currency <currency>\", \"Settlement currency\")\n .option(\"--filter <filter>\", \"Status filter\")\n .option(\"--start-time <ms>\", \"Start time in milliseconds\", parseInt)\n .option(\"--limit <n>\", \"Maximum records to return\", parseInt)\n .action(async (opts: { base: string; endTime: number; quote?: string; currency?: string; filter?: string; startTime?: number; limit?: number }, cmd: Command) => {\n try {\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_records\", {\n base: opts.base,\n quote: opts.quote,\n currency: opts.currency,\n filter: opts.filter,\n startTime: opts.startTime,\n endTime: opts.endTime,\n limit: opts.limit,\n });\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"invest\")\n .description(\"Create a Dual Investment order (requires earn auth)\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .requiredOption(\"--product-id <id>\", \"Product ID\")\n .option(\"--client-dual-id <id>\", \"Client-assigned order ID\")\n .option(\"--base-amount <amount>\", \"Base asset amount to invest\")\n .option(\"--currency-amount <amount>\", \"Currency amount to invest\")\n .requiredOption(\"--profit <rate>\", \"Yield rate from prices command (pass unchanged)\")\n .action(async (opts: { base: string; productId: string; clientDualId?: string; baseAmount?: string; currencyAmount?: string; profit: string }, cmd: Command) => {\n try {\n const payload = {\n base: opts.base,\n productId: opts.productId,\n clientDualId: opts.clientDualId,\n baseAmount: opts.baseAmount,\n currencyAmount: opts.currencyAmount,\n profit: opts.profit,\n };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_earn_dual_invest\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_invest\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"revoke_invest\")\n .description(\"Revoke a pending Dual Investment order (requires earn auth)\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .requiredOption(\"--client-dual-id <id>\", \"Client dual order ID\")\n .requiredOption(\"--product-id <id>\", \"Product ID\")\n .action(async (opts: { base: string; clientDualId: string; productId: string }, cmd: Command) => {\n try {\n const payload = { base: opts.base, clientDualId: opts.clientDualId, productId: opts.productId };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_earn_dual_revoke_invest\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_revoke_invest\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n dual\n .command(\"collect\")\n .description(\"Collect settled Dual Investment earnings (requires earn auth)\")\n .requiredOption(\"--base <base>\", \"Base asset\")\n .requiredOption(\"--client-dual-id <id>\", \"Client dual order ID\")\n .requiredOption(\"--product-id <id>\", \"Product ID\")\n .action(async (opts: { base: string; clientDualId: string; productId: string }, cmd: Command) => {\n try {\n const payload = { base: opts.base, clientDualId: opts.clientDualId, productId: opts.productId };\n if (isDryRun(cmd)) {\n print({ tool: \"pionex_earn_dual_collect\", args: payload });\n return;\n }\n const run = makeRunner(cmd);\n const out = await run(\"pionex_earn_dual_collect\", payload);\n print(out.data);\n } catch (e) {\n process.stderr.write(JSON.stringify(toToolErrorPayload(e), null, 2) + \"\\n\");\n process.exit(1);\n }\n });\n\n return dual;\n}\n\nexport function buildEarnCommand(): Command {\n const earn = new Command(\"earn\").description(\"Earn products (requires auth)\");\n earn.addCommand(buildDualCommand());\n return earn;\n}\n","import { Command } from \"commander\";\n\nexport function buildCapabilitiesCommand(): Command {\n return new Command(\"capabilities\")\n .description(\"Print all available commands as JSON (for AI agent self-discovery)\")\n .action(() => {\n const caps = {\n market: [\"depth\", \"trades\", \"symbols\", \"tickers\", \"book_tickers\", \"klines\"],\n account: [\"balance\"],\n orders: [\"new\", \"get\", \"open\", \"all\", \"fills\", \"fills_by_order_id\", \"cancel\", \"cancel_all\"],\n bot: {\n order_list: true,\n futures_grid: [\"get\", \"create\", \"adjust_params\", \"reduce\", \"cancel\"],\n spot_grid: [\"get\", \"get_ai_strategy\", \"create\", \"adjust_params\", \"invest_in\", \"cancel\", \"profit\"],\n },\n earn: {\n dual: [\n \"symbols\",\n \"open_products\",\n \"prices\",\n \"index\",\n \"delivery_prices\",\n \"balances\",\n \"get_invests\",\n \"records\",\n \"invest\",\n \"revoke_invest\",\n \"collect\",\n ],\n },\n };\n process.stdout.write(JSON.stringify(caps, null, 2) + \"\\n\");\n });\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,WAAAA,gBAAe;;;ACAxB,SAAS,qBAAqB;AAE9B,IAAM,WAAW,cAAc,YAAY,GAAG;AAQvC,IAAM,kBAAkB;AAAA,EAC7B,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UAAQ,WAAW,mBAAmB,CAAC;AACvC,UAAQ,WAAW,mBAAmB,CAAC;AACvC,UAAQ,WAAW,gBAAgB,CAAC;AACpC,UAAQ,WAAW,iBAAiB,CAAC;AACrC,UAAQ,WAAW,yBAAyB,CAAC;AAG7C,UACG,QAAQ,kBAAkB,EAC1B,YAAY,+EAA+E,EAC3F,OAAO,MAAM;AACZ,eAAW,mBAAmB;AAC9B,YAAQ,OAAO;AAAA,MACb;AAAA,IAGF;AAAA,EACF,CAAC;AAEH,UACG,QAAQ,uBAAuB,EAC/B;AAAA,IACC;AAAA,EAEF,EACC,OAAO,MAAM;AACZ,YAAQ,OAAO,MAAM,uBAAuB,CAAC;AAAA,EAC/C,CAAC;AAEH,SAAO;AACT;","names":["Command","completion","Command","Command","Command","Command","Command","Command","Command","Command","run","out","Command","Command","Command","Command"]}
|