@okx_ai/okx-trade-cli 1.3.8 → 1.3.9-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall-download.js +0 -152
package/dist/index.js
CHANGED
|
@@ -1542,8 +1542,8 @@ var OKX_CODE_BEHAVIORS = {
|
|
|
1542
1542
|
"50013": { retry: true, suggestion: "System busy. Retry after 1-2 seconds." },
|
|
1543
1543
|
"50026": { retry: true, suggestion: "System error. Retry in a few minutes." },
|
|
1544
1544
|
// Region / compliance restriction -> do not retry
|
|
1545
|
-
"51155": { retry: false, suggestion: "Feature unavailable in your region (site: {site}). Verify your site setting matches your account registration region. Available sites: global, eea, us. Do not retry." },
|
|
1546
|
-
"51734": { retry: false, suggestion: "Feature not supported for your KYC country (site: {site}). Verify your site setting matches your account registration region. Available sites: global, eea, us. Do not retry." },
|
|
1545
|
+
"51155": { retry: false, suggestion: "Feature unavailable in your region (site: {site}). Verify your site setting matches your account registration region. Available sites: global, eea, us, tr. Do not retry." },
|
|
1546
|
+
"51734": { retry: false, suggestion: "Feature not supported for your KYC country (site: {site}). Verify your site setting matches your account registration region. Available sites: global, eea, us, tr. Do not retry." },
|
|
1547
1547
|
// Account issues -> do not retry
|
|
1548
1548
|
"50007": { retry: false, suggestion: "Account suspended. Contact OKX support. Do not retry." },
|
|
1549
1549
|
"50009": { retry: false, suggestion: "Account blocked by risk control. Contact OKX support. Do not retry." },
|
|
@@ -2744,6 +2744,11 @@ var OKX_SITES = {
|
|
|
2744
2744
|
label: "US",
|
|
2745
2745
|
apiBaseUrl: "https://us.okx.com",
|
|
2746
2746
|
webUrl: "https://app.okx.com"
|
|
2747
|
+
},
|
|
2748
|
+
tr: {
|
|
2749
|
+
label: "TR",
|
|
2750
|
+
apiBaseUrl: "https://tr.okx.com",
|
|
2751
|
+
webUrl: "https://tr.okx.com"
|
|
2747
2752
|
}
|
|
2748
2753
|
};
|
|
2749
2754
|
var SITE_IDS = Object.keys(OKX_SITES);
|
|
@@ -14918,7 +14923,7 @@ async function cmdDiagnoseMcp(options = {}) {
|
|
|
14918
14923
|
|
|
14919
14924
|
// src/commands/diagnose.ts
|
|
14920
14925
|
var CLI_VERSION = readCliVersion();
|
|
14921
|
-
var GIT_HASH = true ? "
|
|
14926
|
+
var GIT_HASH = true ? "1c1b0a96" : "dev";
|
|
14922
14927
|
function maskKey2(key) {
|
|
14923
14928
|
if (!key) return "(not set)";
|
|
14924
14929
|
if (key.length <= 8) return "****";
|
|
@@ -16132,7 +16137,7 @@ var CLI_REGISTRY = {
|
|
|
16132
16137
|
},
|
|
16133
16138
|
"sub-orders": {
|
|
16134
16139
|
toolName: "grid_get_sub_orders",
|
|
16135
|
-
usage: "okx bot grid sub-orders --algoOrdType <type> --algoId <id> [--live]",
|
|
16140
|
+
usage: "okx bot grid sub-orders --algoOrdType <type> --algoId <id> [--live] [--groupId <id>] [--after <id>] [--before <id>] [--limit <n>]",
|
|
16136
16141
|
description: "List sub-orders of a grid bot (filled or live)"
|
|
16137
16142
|
},
|
|
16138
16143
|
create: {
|
|
@@ -17153,6 +17158,7 @@ var CLI_OPTIONS = {
|
|
|
17153
17158
|
activePx: { type: "string" },
|
|
17154
17159
|
// grid bot
|
|
17155
17160
|
algoOrdType: { type: "string" },
|
|
17161
|
+
groupId: { type: "string" },
|
|
17156
17162
|
gridNum: { type: "string" },
|
|
17157
17163
|
maxPx: { type: "string" },
|
|
17158
17164
|
minPx: { type: "string" },
|
|
@@ -19518,6 +19524,7 @@ function parseSiteKey(raw) {
|
|
|
19518
19524
|
const lower = raw.toLowerCase();
|
|
19519
19525
|
if (lower === "eea" || raw === "2") return "eea";
|
|
19520
19526
|
if (lower === "us" || raw === "3") return "us";
|
|
19527
|
+
if (lower === "tr" || raw === "4") return "tr";
|
|
19521
19528
|
if (lower === "global" || raw === "1") return "global";
|
|
19522
19529
|
return "global";
|
|
19523
19530
|
}
|
|
@@ -19606,6 +19613,7 @@ async function cmdConfigInit(lang = "en") {
|
|
|
19606
19613
|
outputLine(" 1) Global (www.okx.com) [default]");
|
|
19607
19614
|
outputLine(" 2) EEA (my.okx.com)");
|
|
19608
19615
|
outputLine(" 3) US (app.okx.com)");
|
|
19616
|
+
outputLine(" 4) TR (tr.okx.com)");
|
|
19609
19617
|
const siteRaw = (await prompt(rl, t.sitePrompt)).trim();
|
|
19610
19618
|
const siteKey = parseSiteKey(siteRaw);
|
|
19611
19619
|
const demoRaw = (await prompt(rl, t.demoPrompt)).trim().toLowerCase();
|
|
@@ -19655,7 +19663,7 @@ function cmdConfigAddProfile(kvPairs, force) {
|
|
|
19655
19663
|
if (!pp) missing.push("PP");
|
|
19656
19664
|
if (missing.length > 0) {
|
|
19657
19665
|
errorLine(`Error: missing required parameter(s): ${missing.join(", ")}`);
|
|
19658
|
-
errorLine("Usage: okx config add-profile AK=<key> SK=<secret> PP=<passphrase> [site=global|eea|us] [demo=true|false] [name=<name>] [--force]");
|
|
19666
|
+
errorLine("Usage: okx config add-profile AK=<key> SK=<secret> PP=<passphrase> [site=global|eea|us|tr] [demo=true|false] [name=<name>] [--force]");
|
|
19659
19667
|
process.exitCode = 1;
|
|
19660
19668
|
return;
|
|
19661
19669
|
}
|
|
@@ -20399,7 +20407,11 @@ async function cmdGridSubOrders(run, opts) {
|
|
|
20399
20407
|
const result = await run("grid_get_sub_orders", {
|
|
20400
20408
|
algoOrdType: opts.algoOrdType,
|
|
20401
20409
|
algoId: opts.algoId,
|
|
20402
|
-
type: opts.type
|
|
20410
|
+
type: opts.type,
|
|
20411
|
+
groupId: opts.groupId,
|
|
20412
|
+
after: opts.after,
|
|
20413
|
+
before: opts.before,
|
|
20414
|
+
limit: opts.limit
|
|
20403
20415
|
});
|
|
20404
20416
|
const orders = getData8(result) ?? [];
|
|
20405
20417
|
if (opts.json) return printJson(orders);
|
|
@@ -21807,7 +21819,7 @@ async function cmdEventCancel(run, opts) {
|
|
|
21807
21819
|
// src/index.ts
|
|
21808
21820
|
var _require3 = createRequire3(import.meta.url);
|
|
21809
21821
|
var CLI_VERSION2 = _require3("../package.json").version;
|
|
21810
|
-
var GIT_HASH2 = true ? "
|
|
21822
|
+
var GIT_HASH2 = true ? "1c1b0a96" : "dev";
|
|
21811
21823
|
function handlePilotCommand(action, json, force, binaryPath) {
|
|
21812
21824
|
if (action === "status") return cmdPilotStatus(json, binaryPath);
|
|
21813
21825
|
if (action === "install") return cmdPilotInstall(json, binaryPath);
|
|
@@ -22697,6 +22709,10 @@ function handleBotGridCommand(run, v, rest, json) {
|
|
|
22697
22709
|
algoOrdType: v.algoOrdType,
|
|
22698
22710
|
algoId: v.algoId,
|
|
22699
22711
|
type: v.live ? "live" : "filled",
|
|
22712
|
+
groupId: v.groupId,
|
|
22713
|
+
after: v.after,
|
|
22714
|
+
before: v.before,
|
|
22715
|
+
limit: v.limit,
|
|
22700
22716
|
json
|
|
22701
22717
|
});
|
|
22702
22718
|
if (subAction === "create")
|
|
@@ -23244,10 +23260,21 @@ function wrapRunnerWithLogger(baseRunner, logger, verbose = false) {
|
|
|
23244
23260
|
}
|
|
23245
23261
|
};
|
|
23246
23262
|
}
|
|
23263
|
+
function buildLoadProfileOptions(v) {
|
|
23264
|
+
return {
|
|
23265
|
+
profile: v.profile,
|
|
23266
|
+
site: v.site,
|
|
23267
|
+
demo: v.demo,
|
|
23268
|
+
live: v.live,
|
|
23269
|
+
verbose: v.verbose,
|
|
23270
|
+
userAgent: `okx-trade-cli/${CLI_VERSION2}`,
|
|
23271
|
+
sourceTag: "CLI"
|
|
23272
|
+
};
|
|
23273
|
+
}
|
|
23247
23274
|
async function runDiagnose(v) {
|
|
23248
23275
|
let config;
|
|
23249
23276
|
try {
|
|
23250
|
-
config = await loadProfileConfig(
|
|
23277
|
+
config = await loadProfileConfig(buildLoadProfileOptions(v));
|
|
23251
23278
|
} catch {
|
|
23252
23279
|
}
|
|
23253
23280
|
return cmdDiagnose(config, v.profile ?? "default", { mcp: v.mcp, cli: v.cli, all: v.all, output: v.output });
|
|
@@ -23312,7 +23339,7 @@ async function main() {
|
|
|
23312
23339
|
const json = v.json ?? false;
|
|
23313
23340
|
const mgmt = routeManagementCommand(module, action, rest, json, v);
|
|
23314
23341
|
if (mgmt !== void 0) return mgmt === true ? void 0 : mgmt;
|
|
23315
|
-
const config = await loadProfileConfig(
|
|
23342
|
+
const config = await loadProfileConfig(buildLoadProfileOptions(v));
|
|
23316
23343
|
setEnvContext({ demo: config.demo, profile: v.profile ?? "default" });
|
|
23317
23344
|
setJsonEnvEnabled(v.env ?? false);
|
|
23318
23345
|
const client = new OkxRestClient(config);
|
|
@@ -23349,6 +23376,7 @@ main().catch((error) => {
|
|
|
23349
23376
|
});
|
|
23350
23377
|
export {
|
|
23351
23378
|
assertNoTpConflict,
|
|
23379
|
+
buildLoadProfileOptions,
|
|
23352
23380
|
handleAccountWriteCommand,
|
|
23353
23381
|
handleBotCommand,
|
|
23354
23382
|
handleBotDcaCommand,
|