@okx_ai/okx-trade-cli 1.3.1-beta.14 → 1.3.1-beta.16

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
@@ -42,7 +42,7 @@ import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, mkdirSy
42
42
  import { join as join7, dirname as dirname4 } from "path";
43
43
  import { homedir as homedir5 } from "os";
44
44
 
45
- // ../../node_modules/smol-toml/dist/error.js
45
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/error.js
46
46
  function getLineColFromPtr(string, ptr) {
47
47
  let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
48
48
  return [lines.length, lines.pop().length + 1];
@@ -82,7 +82,7 @@ ${codeblock}`, options);
82
82
  }
83
83
  };
84
84
 
85
- // ../../node_modules/smol-toml/dist/util.js
85
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/util.js
86
86
  function isEscaped(str, ptr) {
87
87
  let i = 0;
88
88
  while (str[ptr - ++i] === "\\")
@@ -113,14 +113,9 @@ function skipComment(str, ptr) {
113
113
  }
114
114
  function skipVoid(str, ptr, banNewLines, banComments) {
115
115
  let c;
116
- while (1) {
117
- while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
118
- ptr++;
119
- if (banComments || c !== "#")
120
- break;
121
- ptr = skipComment(str, ptr);
122
- }
123
- return ptr;
116
+ while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
117
+ ptr++;
118
+ return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
124
119
  }
125
120
  function skipUntil(str, ptr, sep2, end, banNewLines = false) {
126
121
  if (!end) {
@@ -161,7 +156,7 @@ function getStringEnd(str, seek) {
161
156
  return seek;
162
157
  }
163
158
 
164
- // ../../node_modules/smol-toml/dist/date.js
159
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/date.js
165
160
  var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
166
161
  var TomlDate = class _TomlDate extends Date {
167
162
  #hasDate = false;
@@ -253,7 +248,7 @@ var TomlDate = class _TomlDate extends Date {
253
248
  }
254
249
  };
255
250
 
256
- // ../../node_modules/smol-toml/dist/primitive.js
251
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/primitive.js
257
252
  var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
258
253
  var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
259
254
  var LEADING_ZERO = /^[+-]?0[0-9_]/;
@@ -392,7 +387,7 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
392
387
  return date;
393
388
  }
394
389
 
395
- // ../../node_modules/smol-toml/dist/extract.js
390
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/extract.js
396
391
  function sliceAndTrimEndOf(str, startPtr, endPtr) {
397
392
  let value = str.slice(startPtr, endPtr);
398
393
  let commentIdx = value.indexOf("#");
@@ -459,7 +454,7 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
459
454
  ];
460
455
  }
461
456
 
462
- // ../../node_modules/smol-toml/dist/struct.js
457
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/struct.js
463
458
  var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
464
459
  function parseKey(str, ptr, end = "=") {
465
460
  let dot = ptr - 1;
@@ -607,7 +602,7 @@ function parseArray(str, ptr, depth, integersAsBigInt) {
607
602
  return [res, ptr];
608
603
  }
609
604
 
610
- // ../../node_modules/smol-toml/dist/parse.js
605
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/parse.js
611
606
  function peekTable(key, table, meta, type) {
612
607
  let t = table;
613
608
  let m = meta;
@@ -732,7 +727,7 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
732
727
  return res;
733
728
  }
734
729
 
735
- // ../../node_modules/smol-toml/dist/stringify.js
730
+ // ../../node_modules/.pnpm/smol-toml@1.6.0/node_modules/smol-toml/dist/stringify.js
736
731
  var BARE_KEY = /^[a-z0-9-_]+$/i;
737
732
  function extendedTypeOf(obj) {
738
733
  let type = typeof obj;
@@ -921,7 +916,7 @@ function getDohBinaryPath() {
921
916
  return process.env.OKX_DOH_BINARY_PATH;
922
917
  }
923
918
  const ext = process.platform === "win32" ? ".exe" : "";
924
- return join(DOH_BIN_DIR, `okx-doh-resolver${ext}`);
919
+ return join(DOH_BIN_DIR, `okx-pilot${ext}`);
925
920
  }
926
921
  function execDohBinary(domain, exclude = [], userAgent) {
927
922
  if (!ALLOWED_DOMAIN_RE.test(domain)) {
@@ -992,7 +987,7 @@ function classifyAndCache(node, hostname, failedNodes, cachePath) {
992
987
  if (!node) {
993
988
  return { mode: null, node: null };
994
989
  }
995
- if (node.ip === hostname || node.host === hostname) {
990
+ if (node.ip === hostname && node.host === hostname) {
996
991
  writeCache(hostname, {
997
992
  mode: "direct",
998
993
  node: null,
@@ -1450,10 +1445,10 @@ var OKX_CODE_BEHAVIORS = {
1450
1445
  "50011": { retry: true, suggestion: "Rate limited. Back off and retry after a delay." },
1451
1446
  "50061": { retry: true, suggestion: "Too many connections. Reduce request frequency and retry." },
1452
1447
  // Server temporarily unavailable → retryable
1453
- "50001": { retry: true, suggestion: "OKX system upgrade in progress. Retry in a few minutes." },
1454
- "50004": { retry: true, suggestion: "Endpoint temporarily unavailable. Retry later." },
1448
+ "50001": { retry: true, suggestion: "Service temporarily unavailable. Retry in a few minutes." },
1449
+ "50004": { retry: true, suggestion: "Endpoint request timeout. Retry later." },
1455
1450
  "50013": { retry: true, suggestion: "System busy. Retry after 1-2 seconds." },
1456
- "50026": { retry: true, suggestion: "Order book system upgrading. Retry in a few minutes." },
1451
+ "50026": { retry: true, suggestion: "System error. Retry in a few minutes." },
1457
1452
  // Region / compliance restriction → do not retry
1458
1453
  "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." },
1459
1454
  "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." },
@@ -5374,7 +5369,7 @@ function registerOnchainEarnTools() {
5374
5369
  ];
5375
5370
  }
5376
5371
  var DCD_CODE_BEHAVIORS = {
5377
- "50001": { retry: true, suggestion: "DCD service is down. Retry in a few minutes." },
5372
+ "50001": { retry: true, suggestion: "Service temporarily unavailable. Retry in a few minutes." },
5378
5373
  "50002": { retry: false, suggestion: "Invalid JSON in request body. This is likely a bug \u2014 check request parameters." },
5379
5374
  "50014": { retry: false, suggestion: "Missing required parameter. Check that all required fields are provided." },
5380
5375
  "50016": { retry: false, suggestion: "notionalCcy does not match productId option type. Use baseCcy for CALL, quoteCcy for PUT." },
@@ -7819,7 +7814,7 @@ function registerMarketFilterTools() {
7819
7814
  sortBy: {
7820
7815
  type: "string",
7821
7816
  enum: ["last", "chg24hPct", "marketCapUsd", "volUsd24h", "fundingRate", "oiUsd", "listTime"],
7822
- description: "Sort field. Default: volUsd24h. Note: marketCapUsd is only meaningful for SPOT (null for SWAP/FUTURES)."
7817
+ description: "Sort field. Default: volUsd24h. Note: marketCapUsd is only meaningful for SPOT (null for SWAP/FUTURES). To rank by OI *change* (oiDeltaPct / absOiDeltaPct), use market_filter_oi_change \u2014 market_filter only sorts by the current snapshot."
7823
7818
  },
7824
7819
  sortOrder: {
7825
7820
  type: "string",
@@ -7932,7 +7927,7 @@ function registerMarketFilterTools() {
7932
7927
  bar: {
7933
7928
  type: "string",
7934
7929
  enum: [...OI_BARS],
7935
- description: "Bar window for OI change computation: 5m, 15m, 1H, 4H, 1D. Default: 1H"
7930
+ description: "Bar window for OI change computation: 5m, 15m, 1H, 4H, 1D (case-insensitive on server, but send canonical form here). Default: 1H"
7936
7931
  },
7937
7932
  // Filters
7938
7933
  minOiUsd: {
@@ -7950,8 +7945,8 @@ function registerMarketFilterTools() {
7950
7945
  // Sort / pagination
7951
7946
  sortBy: {
7952
7947
  type: "string",
7953
- enum: ["oiUsd", "oiDeltaUsd", "oiDeltaPct", "volUsd24h", "last"],
7954
- description: "Sort field. Default: oiDeltaPct (largest movers first)"
7948
+ enum: ["oiUsd", "oiDeltaUsd", "oiDeltaPct", "absOiDeltaPct", "volUsd24h", "fundingRate", "last"],
7949
+ description: "Sort field. Default: oiDeltaPct (largest movers first, signed \u2014 longs and shorts separate). Use absOiDeltaPct to sort by |oiDeltaPct| (largest-magnitude moves regardless of direction). fundingRate is also supported for SWAP. Do NOT use the market_filter tool's sort fields (chg24hPct, marketCapUsd, listTime) here \u2014 they are not in the OI-change Row."
7955
7950
  },
7956
7951
  sortOrder: {
7957
7952
  type: "string",
@@ -7992,38 +7987,40 @@ var NEWS_DETAIL = "/api/v5/orbit/news-detail";
7992
7987
  var NEWS_DOMAINS = "/api/v5/orbit/news-platform";
7993
7988
  var SENTIMENT_QUERY = "/api/v5/orbit/currency-sentiment-query";
7994
7989
  var SENTIMENT_RANKING = "/api/v5/orbit/currency-sentiment-ranking";
7995
- var NEWS_LANGUAGE = ["en_US", "zh_CN"];
7990
+ var NEWS_LANGUAGE = ["en-US", "zh-CN"];
7996
7991
  function langHeader(lang) {
7997
- const resolved = lang === "zh_CN" ? "zh_CN" : "en_US";
7998
- return { "Accept-Language": resolved };
7992
+ if (lang === "zh-CN" || lang === "zh_CN") return { "Accept-Language": "zh-CN" };
7993
+ return { "Accept-Language": "en-US" };
7999
7994
  }
8000
7995
  var NEWS_DETAIL_LVL = ["brief", "summary", "full"];
8001
- var NEWS_IMPORTANCE = ["high", "medium", "low"];
7996
+ var NEWS_IMPORTANCE = ["high", "low"];
8002
7997
  var NEWS_SENTIMENT = ["bullish", "bearish", "neutral"];
8003
7998
  var NEWS_SORT = ["latest", "relevant"];
8004
7999
  var SENTIMENT_PERIOD = ["1h", "4h", "24h"];
8005
8000
  var D_COINS_NEWS = 'Comma-separated uppercase ticker symbols (e.g. "BTC,ETH"). Normalize names/aliases to standard tickers.';
8006
8001
  var D_COINS_SENTIMENT = 'Comma-separated uppercase ticker symbols, max 20 (e.g. "BTC,ETH"). Normalize names/aliases to standard tickers.';
8007
- var D_LANGUAGE = "Content language: zh_CN or en_US. Infer from user's message. No server default.";
8008
- var D_BEGIN = "Start time, Unix epoch milliseconds. Parse relative time if given (e.g. 'yesterday', 'last 7 days').";
8002
+ var D_LANGUAGE = "Content language: zh-CN or en-US. Infer from user's message. No server default.";
8003
+ var D_BEGIN = "Start time, Unix epoch milliseconds. API defaults to 72 hours ago when omitted. Pass explicitly for older topics (e.g. 'last 30 days'). Max range: 180 days. Parse relative time if given.";
8009
8004
  var D_END = "End time, Unix epoch milliseconds. Parse relative time if given. Omit for no upper bound.";
8010
- var D_IMPORTANCE = "Importance filter: high (server default), medium, low. Omit unless user wants broader coverage.";
8005
+ var D_IMPORTANCE = "Importance filter: 'low' returns all news (both low and high importance); 'high' narrows to major/breaking news only. Omitted \u2192 server default (high-only). Default to 'low' for broad browsing; pass 'high' only when the user explicitly asks for major news.";
8006
+ var D_PLATFORM = "Filter by news source. Use values from news_get_domains (e.g. blockbeats, odaily_flash). Omit for all sources.";
8011
8007
  var D_LIMIT = "Number of results (default 10, max 50).";
8012
8008
  function registerNewsTools() {
8013
- return [
8009
+ const tools = [
8014
8010
  // -----------------------------------------------------------------------
8015
8011
  // News browsing tools
8016
8012
  // -----------------------------------------------------------------------
8017
8013
  {
8018
8014
  name: "news_get_latest",
8019
8015
  module: "news",
8020
- description: "Get crypto news sorted by time. Omitting importance still returns only high-importance news (server default). Pass importance='medium' or 'low' explicitly to broaden results. Use when user asks 'what happened recently', 'latest news', 'any big news today', or wants to browse without a keyword. For coin-specific news, use news_get_by_coin instead.",
8016
+ description: "Get crypto news sorted by time. For broad browsing ('what happened recently', 'latest news', 'any big news today'), pass importance='low' to include both high and low importance. Server default (when importance omitted) returns only high-importance news. For coin-specific news, use news_get_by_coin instead.",
8021
8017
  isWrite: false,
8022
8018
  inputSchema: {
8023
8019
  type: "object",
8024
8020
  properties: {
8025
8021
  coins: { type: "string", description: D_COINS_NEWS + " Optional." },
8026
8022
  importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
8023
+ platform: { type: "string", description: D_PLATFORM },
8027
8024
  begin: { type: "number", description: D_BEGIN },
8028
8025
  end: { type: "number", description: D_END },
8029
8026
  language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
@@ -8044,6 +8041,7 @@ function registerNewsTools() {
8044
8041
  compactObject({
8045
8042
  sortBy: "latest",
8046
8043
  importance: readString(args, "importance"),
8044
+ platform: readString(args, "platform"),
8047
8045
  ccyList: readString(args, "coins"),
8048
8046
  begin: readNumber(args, "begin"),
8049
8047
  end: readNumber(args, "end"),
@@ -8067,6 +8065,7 @@ function registerNewsTools() {
8067
8065
  properties: {
8068
8066
  coins: { type: "string", description: D_COINS_NEWS + " Required." },
8069
8067
  importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
8068
+ platform: { type: "string", description: D_PLATFORM },
8070
8069
  begin: { type: "number", description: D_BEGIN },
8071
8070
  end: { type: "number", description: D_END },
8072
8071
  language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
@@ -8087,6 +8086,7 @@ function registerNewsTools() {
8087
8086
  sortBy: "latest",
8088
8087
  ccyList: coins,
8089
8088
  importance: readString(args, "importance"),
8089
+ platform: readString(args, "platform"),
8090
8090
  begin: readNumber(args, "begin"),
8091
8091
  end: readNumber(args, "end"),
8092
8092
  detailLvl: readString(args, "detailLvl"),
@@ -8112,6 +8112,7 @@ function registerNewsTools() {
8112
8112
  },
8113
8113
  coins: { type: "string", description: D_COINS_NEWS + " Optional." },
8114
8114
  importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
8115
+ platform: { type: "string", description: D_PLATFORM },
8115
8116
  sentiment: {
8116
8117
  type: "string",
8117
8118
  enum: [...NEWS_SENTIMENT],
@@ -8139,6 +8140,7 @@ function registerNewsTools() {
8139
8140
  keyword: readString(args, "keyword") || void 0,
8140
8141
  sortBy: readString(args, "sortBy") ?? "relevant",
8141
8142
  importance: readString(args, "importance"),
8143
+ platform: readString(args, "platform"),
8142
8144
  ccyList: readString(args, "coins"),
8143
8145
  sentiment: readString(args, "sentiment"),
8144
8146
  begin: readNumber(args, "begin"),
@@ -8284,6 +8286,24 @@ function registerNewsTools() {
8284
8286
  }
8285
8287
  }
8286
8288
  ];
8289
+ const domainsIdx = tools.findIndex((t) => t.name === "news_get_domains");
8290
+ if (domainsIdx === -1) throw new Error("news_get_domains not found in tools list");
8291
+ const [domainsTool] = tools.splice(domainsIdx, 1);
8292
+ return [...tools.map(withNewsDemoGuard), domainsTool];
8293
+ }
8294
+ var NEWS_DEMO_MESSAGE = "News features are not available in demo/simulated trading mode.";
8295
+ var NEWS_DEMO_SUGGESTION = "Switch to a live profile to use News features.";
8296
+ function withNewsDemoGuard(tool) {
8297
+ const originalHandler = tool.handler;
8298
+ return {
8299
+ ...tool,
8300
+ handler: async (args, context) => {
8301
+ if (context.config.demo) {
8302
+ throw new ConfigError(NEWS_DEMO_MESSAGE, NEWS_DEMO_SUGGESTION);
8303
+ }
8304
+ return originalHandler(args, context);
8305
+ }
8306
+ };
8287
8307
  }
8288
8308
  function registerOptionAlgoTools() {
8289
8309
  return [
@@ -10267,7 +10287,7 @@ function getPlatformDir() {
10267
10287
  return map[`${p}-${a}`] ?? null;
10268
10288
  }
10269
10289
  function getBinaryName() {
10270
- return platform() === "win32" ? "okx-doh-resolver.exe" : "okx-doh-resolver";
10290
+ return platform() === "win32" ? "okx-pilot.exe" : "okx-pilot";
10271
10291
  }
10272
10292
  function hashFile(filePath) {
10273
10293
  const buf = readFileSync7(filePath);
@@ -10906,34 +10926,12 @@ function runOkxAuthCapture(args) {
10906
10926
  });
10907
10927
  }
10908
10928
  async function cmdAuthLogin(args) {
10909
- let site = args.site?.trim();
10910
- if (!site) site = process.env.OKX_SITE?.trim();
10911
- if (!site) {
10912
- try {
10913
- const cfg = readFullConfig();
10914
- const profileName = cfg.default_profile ?? "default";
10915
- site = cfg.profiles?.[profileName]?.site?.trim();
10916
- } catch {
10917
- }
10918
- }
10919
10929
  const cliArgs = ["login"];
10920
- if (site) cliArgs.push("--site", site);
10930
+ if (args.site) cliArgs.push("--site", args.site);
10921
10931
  if (args.manual) cliArgs.push("--manual");
10922
10932
  const code = await runOkxAuth(cliArgs);
10923
10933
  if (code !== 0) {
10924
10934
  process.exitCode = code;
10925
- return;
10926
- }
10927
- const explicit = args.site?.trim();
10928
- if (explicit) {
10929
- try {
10930
- const cfg = readFullConfig();
10931
- const profileName = cfg.default_profile ?? "default";
10932
- const profiles = { ...cfg.profiles ?? {} };
10933
- profiles[profileName] = { ...profiles[profileName] ?? {}, site: explicit };
10934
- writeFullConfig({ ...cfg, default_profile: profileName, profiles });
10935
- } catch {
10936
- }
10937
10935
  }
10938
10936
  }
10939
10937
  async function cmdAuthLogout() {
@@ -11685,7 +11683,7 @@ async function cmdDiagnoseMcp(options = {}) {
11685
11683
 
11686
11684
  // src/commands/diagnose.ts
11687
11685
  var CLI_VERSION = readCliVersion();
11688
- var GIT_HASH = true ? "17e06f4" : "dev";
11686
+ var GIT_HASH = true ? "cd25c1f" : "dev";
11689
11687
  function maskKey2(key) {
11690
11688
  if (!key) return "(not set)";
11691
11689
  if (key.length <= 8) return "****";
@@ -12224,17 +12222,17 @@ var CLI_REGISTRY = {
12224
12222
  },
12225
12223
  filter: {
12226
12224
  toolName: "market_filter",
12227
- usage: "okx market filter --instType <SPOT|SWAP|FUTURES> [--sortBy <field>] [--sortOrder <asc|desc>] [--limit <n>] [--baseCcy <ccy>] [--quoteCcy <ccy>] [--settleCcy <ccy>] [--instFamily <fam>] [--ctType <linear|inverse>] [--minLast <n>] [--maxLast <n>] [--minChg24hPct <n>] [--maxChg24hPct <n>] [--minMarketCapUsd <n>] [--maxMarketCapUsd <n>] [--minVolUsd24h <n>] [--maxVolUsd24h <n>] [--minFundingRate <n>] [--maxFundingRate <n>] [--minOiUsd <n>] [--maxOiUsd <n>]",
12228
- description: "Screen / rank instruments by multi-dimensional criteria (price, volume, OI, funding rate, market cap, etc.)"
12225
+ usage: "okx market filter --instType <SPOT|SWAP|FUTURES> [--sortBy <last|chg24hPct|marketCapUsd|volUsd24h|fundingRate|oiUsd|listTime>] [--sortOrder <asc|desc>] [--limit <1-100>] [--baseCcy <ccy>] [--quoteCcy <ccy>] [--settleCcy <ccy>] [--instFamily <fam>] [--ctType <linear|inverse>] [--minLast <n>] [--maxLast <n>] [--minChg24hPct <n>] [--maxChg24hPct <n>] [--minMarketCapUsd <n>] [--maxMarketCapUsd <n>] [--minVolUsd24h <n>] [--maxVolUsd24h <n>] [--minFundingRate <n>] [--maxFundingRate <n>] [--minOiUsd <n>] [--maxOiUsd <n>]",
12226
+ description: "Screen / rank instruments by multi-dimensional criteria (price, volume, OI, funding rate, market cap, etc.). For OI *change* ranking use `market oi-change`."
12229
12227
  },
12230
12228
  "oi-history": {
12231
12229
  toolName: "market_get_oi_history",
12232
- usage: "okx market oi-history <instId> [--bar <5m|15m|1H|4H|1D>] [--limit <n>] [--ts <ms>]",
12230
+ usage: "okx market oi-history <instId> [--bar <5m|15m|1H|4H|1D>] [--limit <1-500>] [--ts <ms>]",
12233
12231
  description: "Open interest history time series with bar-over-bar delta for a single instrument"
12234
12232
  },
12235
12233
  "oi-change": {
12236
12234
  toolName: "market_filter_oi_change",
12237
- usage: "okx market oi-change --instType <SWAP|FUTURES> [--bar <5m|15m|1H|4H|1D>] [--sortBy <field>] [--sortOrder <asc|desc>] [--limit <n>] [--minOiUsd <n>] [--minVolUsd24h <n>] [--minAbsOiDeltaPct <n>]",
12235
+ usage: "okx market oi-change --instType <SWAP|FUTURES> [--bar <5m|15m|1H|4H|1D>] [--sortBy <oiUsd|oiDeltaUsd|oiDeltaPct|absOiDeltaPct|volUsd24h|fundingRate|last>] [--sortOrder <asc|desc>] [--limit <1-100>] [--minOiUsd <n>] [--minVolUsd24h <n>] [--minAbsOiDeltaPct <n>]",
12238
12236
  description: "Find instruments with largest OI changes over a bar window (accumulation/distribution scanner)"
12239
12237
  }
12240
12238
  },
@@ -12247,10 +12245,10 @@ var CLI_REGISTRY = {
12247
12245
  usage: "okx market indicator list",
12248
12246
  description: "List all supported technical indicators"
12249
12247
  },
12250
- "<instId> <indicator>": {
12248
+ "<indicator> <instId>": {
12251
12249
  toolName: "market_get_indicator",
12252
- usage: "okx market indicator <instId> <indicator> [--bar <bar>] [--limit <n>] [--backtest-time <ts>] [--params <json>]",
12253
- description: "Get indicator values for an instrument (e.g. okx market indicator BTC-USDT-SWAP rsi)"
12250
+ usage: "okx market indicator <indicator> <instId> [--bar <3m|5m|15m|1H|4H|12Hutc|1Dutc|3Dutc|1Wutc>] [--limit <1-100>] [--backtest-time <ts>] [--params <json>]",
12251
+ description: "Get indicator values for an instrument (e.g. okx market indicator rsi BTC-USDT-SWAP). NOTE: 1m is not supported for indicators."
12254
12252
  }
12255
12253
  }
12256
12254
  }
@@ -13009,29 +13007,29 @@ var CLI_REGISTRY = {
13009
13007
  commands: {
13010
13008
  latest: {
13011
13009
  toolName: "news_get_latest",
13012
- usage: "okx news latest [--coins BTC,ETH] [--lang zh_CN] [--limit 20]"
13010
+ usage: "okx news latest [--coins BTC,ETH] [--platform blockbeats] [--lang zh-CN] [--limit 20]"
13013
13011
  },
13014
13012
  important: {
13015
13013
  toolName: "news_get_latest",
13016
- usage: "okx news important [--coins BTC,ETH] [--lang zh_CN] [--limit 20]",
13014
+ usage: "okx news important [--coins BTC,ETH] [--lang zh-CN] [--limit 20]",
13017
13015
  description: "Get important/high-impact crypto news"
13018
13016
  },
13019
13017
  "by-coin": {
13020
13018
  toolName: "news_get_by_coin",
13021
- usage: "okx news by-coin --coins BTC [--importance high] [--lang zh_CN]"
13019
+ usage: "okx news by-coin --coins BTC [--importance high] [--platform blockbeats] [--lang zh-CN]"
13022
13020
  },
13023
13021
  search: {
13024
13022
  toolName: "news_search",
13025
- usage: "okx news search --keyword <term> [--coins BTC] [--sentiment bullish] [--lang zh_CN]"
13023
+ usage: "okx news search --keyword <term> [--coins BTC] [--sentiment bullish] [--platform blockbeats] [--lang zh-CN]"
13026
13024
  },
13027
13025
  detail: {
13028
13026
  toolName: "news_get_detail",
13029
- usage: "okx news detail <id> [--lang zh_CN]"
13027
+ usage: "okx news detail <id> [--lang zh-CN]"
13030
13028
  },
13031
- domains: {
13029
+ platforms: {
13032
13030
  toolName: "news_get_domains",
13033
- usage: "okx news domains",
13034
- description: "List available news source domains"
13031
+ usage: "okx news platforms",
13032
+ description: "List available news platforms"
13035
13033
  },
13036
13034
  "coin-sentiment": {
13037
13035
  toolName: "news_get_coin_sentiment",
@@ -13044,7 +13042,7 @@ var CLI_REGISTRY = {
13044
13042
  },
13045
13043
  "by-sentiment": {
13046
13044
  toolName: "news_search",
13047
- usage: "okx news by-sentiment --sentiment bullish [--coins BTC] [--sort-by latest]",
13045
+ usage: "okx news by-sentiment --sentiment bullish [--coins BTC] [--importance high] [--platform <source>] [--sort-by latest] [--begin <ms>] [--end <ms>]",
13048
13046
  description: "Browse news filtered by sentiment direction"
13049
13047
  },
13050
13048
  "sentiment-rank": {
@@ -13251,7 +13249,8 @@ function formatTime(ts) {
13251
13249
  async function cmdNewsLatest(run, opts) {
13252
13250
  const result = await run("news_get_latest", {
13253
13251
  coins: opts.coins,
13254
- importance: opts.importance,
13252
+ importance: opts.importance ?? "low",
13253
+ platform: opts.platform,
13255
13254
  begin: opts.begin,
13256
13255
  end: opts.end,
13257
13256
  language: opts.language,
@@ -13278,6 +13277,7 @@ async function cmdNewsImportant(run, opts) {
13278
13277
  const result = await run("news_get_latest", {
13279
13278
  coins: opts.coins,
13280
13279
  importance: "high",
13280
+ platform: opts.platform,
13281
13281
  begin: opts.begin,
13282
13282
  end: opts.end,
13283
13283
  language: opts.language,
@@ -13301,7 +13301,8 @@ async function cmdNewsImportant(run, opts) {
13301
13301
  async function cmdNewsByCoin(run, coins, opts) {
13302
13302
  const result = await run("news_get_by_coin", {
13303
13303
  coins,
13304
- importance: opts.importance,
13304
+ importance: opts.importance ?? "low",
13305
+ platform: opts.platform,
13305
13306
  begin: opts.begin,
13306
13307
  end: opts.end,
13307
13308
  language: opts.language,
@@ -13326,7 +13327,8 @@ async function cmdNewsSearch(run, keyword, opts) {
13326
13327
  const result = await run("news_search", {
13327
13328
  keyword: keyword || void 0,
13328
13329
  coins: opts.coins,
13329
- importance: opts.importance,
13330
+ importance: opts.importance ?? "low",
13331
+ platform: opts.platform,
13330
13332
  sentiment: opts.sentiment,
13331
13333
  sortBy: opts.sortBy,
13332
13334
  begin: opts.begin,
@@ -13379,12 +13381,12 @@ async function cmdNewsDetail(run, id, opts) {
13379
13381
  content
13380
13382
  });
13381
13383
  }
13382
- async function cmdNewsDomains(run, opts) {
13384
+ async function cmdNewsPlatforms(run, opts) {
13383
13385
  const result = await run("news_get_domains", {});
13384
13386
  const raw = getData(result);
13385
13387
  const items = raw?.[0]?.["platform"] ?? [];
13386
13388
  if (opts.json) return printJson(items);
13387
- outputLine("Available news source domains:");
13389
+ outputLine("Available news platforms:");
13388
13390
  items.forEach((d) => outputLine(` ${d}`));
13389
13391
  }
13390
13392
  async function cmdNewsCoinSentiment(run, coins, opts) {
@@ -13766,6 +13768,7 @@ var CLI_OPTIONS = {
13766
13768
  coins: { type: "string" },
13767
13769
  sentiment: { type: "string" },
13768
13770
  importance: { type: "string" },
13771
+ platform: { type: "string" },
13769
13772
  keyword: { type: "string" },
13770
13773
  "detail-lvl": { type: "string" },
13771
13774
  period: { type: "string" },
@@ -17580,7 +17583,7 @@ async function cmdEventCancel(run, opts) {
17580
17583
  // src/index.ts
17581
17584
  var _require3 = createRequire3(import.meta.url);
17582
17585
  var CLI_VERSION2 = _require3("../package.json").version;
17583
- var GIT_HASH2 = true ? "17e06f4" : "dev";
17586
+ var GIT_HASH2 = true ? "cd25c1f" : "dev";
17584
17587
  function handleDohCommand(action, json, force, binaryPath) {
17585
17588
  if (action === "status") return cmdDohStatus(json, binaryPath);
17586
17589
  if (action === "install") return cmdDohInstall(json, binaryPath);
@@ -18424,21 +18427,22 @@ function handleNewsCommand(run, action, rest, v, json) {
18424
18427
  const limit = v.limit !== void 0 ? Number(v.limit) : void 0;
18425
18428
  const begin = v.begin !== void 0 ? Number(v.begin) : void 0;
18426
18429
  const end = v.end !== void 0 ? Number(v.end) : void 0;
18427
- const language = v.lang ?? "en_US";
18430
+ const language = v.lang ?? "en-US";
18428
18431
  const detailLvl = v["detail-lvl"];
18429
18432
  const after = v.after;
18430
18433
  const period = v.period;
18431
18434
  const points = v.points !== void 0 ? Number(v.points) : 24;
18432
18435
  const sortBy = v["sort-by"];
18433
- const searchOpts = { coins: v.coins, importance: v.importance, sentiment: v.sentiment, sortBy, begin, end, language, detailLvl, limit, after, json };
18434
- const listOpts = { coins: v.coins, importance: v.importance, begin, end, language, detailLvl, limit, after, json };
18436
+ const platform3 = v.platform;
18437
+ const searchOpts = { coins: v.coins, importance: v.importance, platform: platform3, sentiment: v.sentiment, sortBy, begin, end, language, detailLvl, limit, after, json };
18438
+ const listOpts = { coins: v.coins, importance: v.importance, platform: platform3, begin, end, language, detailLvl, limit, after, json };
18435
18439
  const dispatch = {
18436
18440
  latest: () => cmdNewsLatest(run, listOpts),
18437
- important: () => cmdNewsImportant(run, { coins: v.coins, begin, end, language, detailLvl, limit, json }),
18438
- "by-coin": () => cmdNewsByCoin(run, v.coins ?? rest[0], { importance: v.importance, begin, end, language, detailLvl, limit, json }),
18441
+ important: () => cmdNewsImportant(run, { coins: v.coins, platform: platform3, begin, end, language, detailLvl, limit, json }),
18442
+ "by-coin": () => cmdNewsByCoin(run, v.coins ?? rest[0], { importance: v.importance, platform: platform3, begin, end, language, detailLvl, limit, json }),
18439
18443
  search: () => cmdNewsSearch(run, v.keyword ?? rest[0], searchOpts),
18440
18444
  detail: () => cmdNewsDetail(run, rest[0], { language, json }),
18441
- domains: () => cmdNewsDomains(run, { json }),
18445
+ platforms: () => cmdNewsPlatforms(run, { json }),
18442
18446
  "coin-sentiment": () => cmdNewsCoinSentiment(run, v.coins ?? rest[0], { period, json }),
18443
18447
  "coin-trend": () => cmdNewsCoinTrend(run, v.coins ?? rest[0], { period, points, json }),
18444
18448
  // by-sentiment is a convenience wrapper over news_search (no keyword, sentiment filter only)
@@ -18570,13 +18574,25 @@ function printVersion() {
18570
18574
  }
18571
18575
  }
18572
18576
  function routeManagementCommand(module, action, rest, json, v) {
18573
- if (module === "config") return handleConfigCommand(action, rest, json, v.lang, v.force);
18574
- if (module === "setup") return handleSetupCommand(v);
18577
+ if (module === "config") {
18578
+ const r = handleConfigCommand(action, rest, json, v.lang, v.force);
18579
+ return r ?? true;
18580
+ }
18581
+ if (module === "setup") {
18582
+ handleSetupCommand(v);
18583
+ return true;
18584
+ }
18575
18585
  if (module === "auth") return handleAuthCommand(action, rest, v);
18576
18586
  if (module === "upgrade") return cmdUpgrade(CLI_VERSION2, { beta: v.beta, check: v.check, force: v.force }, json);
18577
- if (module === "doh") return handleDohCommand(action, json, v.force ?? false);
18587
+ if (module === "doh") {
18588
+ const r = handleDohCommand(action, json, v.force ?? false);
18589
+ return r ?? true;
18590
+ }
18578
18591
  if (module === "diagnose") return runDiagnose(v);
18579
- if (module === "list-tools") return cmdListTools(json);
18592
+ if (module === "list-tools") {
18593
+ cmdListTools(json);
18594
+ return true;
18595
+ }
18580
18596
  return void 0;
18581
18597
  }
18582
18598
  async function main() {
@@ -18598,7 +18614,7 @@ async function main() {
18598
18614
  const v = values;
18599
18615
  const json = v.json ?? false;
18600
18616
  const mgmt = routeManagementCommand(module, action, rest, json, v);
18601
- if (mgmt) return mgmt;
18617
+ if (mgmt !== void 0) return mgmt === true ? void 0 : mgmt;
18602
18618
  const config = await loadProfileConfig({ profile: v.profile, demo: v.demo, live: v.live, verbose: v.verbose, userAgent: `okx-trade-cli/${CLI_VERSION2}`, sourceTag: "CLI" });
18603
18619
  setEnvContext({ demo: config.demo, profile: v.profile ?? "default" });
18604
18620
  setJsonEnvEnabled(v.env ?? false);