@okx_ai/okx-trade-cli 1.3.9-beta.1 → 1.3.9-beta.3

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 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 ? "deb85df8" : "dev";
14926
+ var GIT_HASH = true ? "11688040" : "dev";
14922
14927
  function maskKey2(key) {
14923
14928
  if (!key) return "(not set)";
14924
14929
  if (key.length <= 8) return "****";
@@ -16132,8 +16137,8 @@ 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]",
16136
- description: "List sub-orders of a grid bot (filled or live)"
16140
+ usage: "okx bot grid sub-orders --algoOrdType <type> --algoId <id> [--pending] [--groupId <id>] [--after <id>] [--before <id>] [--limit <n>]",
16141
+ description: "List sub-orders of a grid bot (default filled; --pending for open orders)"
16137
16142
  },
16138
16143
  create: {
16139
16144
  toolName: "grid_create_order",
@@ -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" },
@@ -17167,6 +17173,9 @@ var CLI_OPTIONS = {
17167
17173
  stopType: { type: "string" },
17168
17174
  topUpAmt: { type: "string" },
17169
17175
  live: { type: "boolean", default: false },
17176
+ // grid sub-orders pending filter (separate from global --live trading mode,
17177
+ // which is mutually exclusive with --demo and so unusable in demo mode)
17178
+ pending: { type: "boolean", default: false },
17170
17179
  // market extras
17171
17180
  instType: { type: "string" },
17172
17181
  instCategory: { type: "string" },
@@ -19518,6 +19527,7 @@ function parseSiteKey(raw) {
19518
19527
  const lower = raw.toLowerCase();
19519
19528
  if (lower === "eea" || raw === "2") return "eea";
19520
19529
  if (lower === "us" || raw === "3") return "us";
19530
+ if (lower === "tr" || raw === "4") return "tr";
19521
19531
  if (lower === "global" || raw === "1") return "global";
19522
19532
  return "global";
19523
19533
  }
@@ -19606,6 +19616,7 @@ async function cmdConfigInit(lang = "en") {
19606
19616
  outputLine(" 1) Global (www.okx.com) [default]");
19607
19617
  outputLine(" 2) EEA (my.okx.com)");
19608
19618
  outputLine(" 3) US (app.okx.com)");
19619
+ outputLine(" 4) TR (tr.okx.com)");
19609
19620
  const siteRaw = (await prompt(rl, t.sitePrompt)).trim();
19610
19621
  const siteKey = parseSiteKey(siteRaw);
19611
19622
  const demoRaw = (await prompt(rl, t.demoPrompt)).trim().toLowerCase();
@@ -19655,7 +19666,7 @@ function cmdConfigAddProfile(kvPairs, force) {
19655
19666
  if (!pp) missing.push("PP");
19656
19667
  if (missing.length > 0) {
19657
19668
  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]");
19669
+ errorLine("Usage: okx config add-profile AK=<key> SK=<secret> PP=<passphrase> [site=global|eea|us|tr] [demo=true|false] [name=<name>] [--force]");
19659
19670
  process.exitCode = 1;
19660
19671
  return;
19661
19672
  }
@@ -20399,7 +20410,11 @@ async function cmdGridSubOrders(run, opts) {
20399
20410
  const result = await run("grid_get_sub_orders", {
20400
20411
  algoOrdType: opts.algoOrdType,
20401
20412
  algoId: opts.algoId,
20402
- type: opts.type
20413
+ type: opts.type,
20414
+ groupId: opts.groupId,
20415
+ after: opts.after,
20416
+ before: opts.before,
20417
+ limit: opts.limit
20403
20418
  });
20404
20419
  const orders = getData8(result) ?? [];
20405
20420
  if (opts.json) return printJson(orders);
@@ -21807,7 +21822,7 @@ async function cmdEventCancel(run, opts) {
21807
21822
  // src/index.ts
21808
21823
  var _require3 = createRequire3(import.meta.url);
21809
21824
  var CLI_VERSION2 = _require3("../package.json").version;
21810
- var GIT_HASH2 = true ? "deb85df8" : "dev";
21825
+ var GIT_HASH2 = true ? "11688040" : "dev";
21811
21826
  function handlePilotCommand(action, json, force, binaryPath) {
21812
21827
  if (action === "status") return cmdPilotStatus(json, binaryPath);
21813
21828
  if (action === "install") return cmdPilotInstall(json, binaryPath);
@@ -22696,7 +22711,14 @@ function handleBotGridCommand(run, v, rest, json) {
22696
22711
  return cmdGridSubOrders(run, {
22697
22712
  algoOrdType: v.algoOrdType,
22698
22713
  algoId: v.algoId,
22699
- type: v.live ? "live" : "filled",
22714
+ // --pending selects open/pending sub-orders. --live is a deprecated alias
22715
+ // kept for backward compatibility; prefer --pending (works in demo mode,
22716
+ // whereas --live is mutually exclusive with --demo).
22717
+ type: v.pending || v.live ? "live" : "filled",
22718
+ groupId: v.groupId,
22719
+ after: v.after,
22720
+ before: v.before,
22721
+ limit: v.limit,
22700
22722
  json
22701
22723
  });
22702
22724
  if (subAction === "create")
@@ -23244,10 +23266,21 @@ function wrapRunnerWithLogger(baseRunner, logger, verbose = false) {
23244
23266
  }
23245
23267
  };
23246
23268
  }
23269
+ function buildLoadProfileOptions(v) {
23270
+ return {
23271
+ profile: v.profile,
23272
+ site: v.site,
23273
+ demo: v.demo,
23274
+ live: v.live,
23275
+ verbose: v.verbose,
23276
+ userAgent: `okx-trade-cli/${CLI_VERSION2}`,
23277
+ sourceTag: "CLI"
23278
+ };
23279
+ }
23247
23280
  async function runDiagnose(v) {
23248
23281
  let config;
23249
23282
  try {
23250
- config = await loadProfileConfig({ profile: v.profile, demo: v.demo, live: v.live, verbose: v.verbose, userAgent: `okx-trade-cli/${CLI_VERSION2}`, sourceTag: "CLI" });
23283
+ config = await loadProfileConfig(buildLoadProfileOptions(v));
23251
23284
  } catch {
23252
23285
  }
23253
23286
  return cmdDiagnose(config, v.profile ?? "default", { mcp: v.mcp, cli: v.cli, all: v.all, output: v.output });
@@ -23312,7 +23345,7 @@ async function main() {
23312
23345
  const json = v.json ?? false;
23313
23346
  const mgmt = routeManagementCommand(module, action, rest, json, v);
23314
23347
  if (mgmt !== void 0) return mgmt === true ? void 0 : mgmt;
23315
- const config = await loadProfileConfig({ profile: v.profile, demo: v.demo, live: v.live, verbose: v.verbose, userAgent: `okx-trade-cli/${CLI_VERSION2}`, sourceTag: "CLI" });
23348
+ const config = await loadProfileConfig(buildLoadProfileOptions(v));
23316
23349
  setEnvContext({ demo: config.demo, profile: v.profile ?? "default" });
23317
23350
  setJsonEnvEnabled(v.env ?? false);
23318
23351
  const client = new OkxRestClient(config);
@@ -23349,6 +23382,7 @@ main().catch((error) => {
23349
23382
  });
23350
23383
  export {
23351
23384
  assertNoTpConflict,
23385
+ buildLoadProfileOptions,
23352
23386
  handleAccountWriteCommand,
23353
23387
  handleBotCommand,
23354
23388
  handleBotDcaCommand,