@okx_ai/okx-trade-cli 1.2.8-beta.6 → 1.2.8
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 +106 -714
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1106,14 +1106,13 @@ var OkxRestClient = class _OkxRestClient {
|
|
|
1106
1106
|
rateLimit
|
|
1107
1107
|
});
|
|
1108
1108
|
}
|
|
1109
|
-
async privateGet(path42, query, rateLimit
|
|
1109
|
+
async privateGet(path42, query, rateLimit) {
|
|
1110
1110
|
return this.request({
|
|
1111
1111
|
method: "GET",
|
|
1112
1112
|
path: path42,
|
|
1113
1113
|
auth: "private",
|
|
1114
1114
|
query,
|
|
1115
|
-
rateLimit
|
|
1116
|
-
extraHeaders
|
|
1115
|
+
rateLimit
|
|
1117
1116
|
});
|
|
1118
1117
|
}
|
|
1119
1118
|
async publicPost(path42, body, rateLimit) {
|
|
@@ -1321,11 +1320,6 @@ var OkxRestClient = class _OkxRestClient {
|
|
|
1321
1320
|
if (this.config.demo) {
|
|
1322
1321
|
headers.set("x-simulated-trading", "1");
|
|
1323
1322
|
}
|
|
1324
|
-
if (reqConfig.extraHeaders) {
|
|
1325
|
-
for (const [key, value] of Object.entries(reqConfig.extraHeaders)) {
|
|
1326
|
-
headers.set(key, value);
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
1323
|
return headers;
|
|
1330
1324
|
}
|
|
1331
1325
|
// ---------------------------------------------------------------------------
|
|
@@ -1640,7 +1634,6 @@ var MODULES = [
|
|
|
1640
1634
|
"futures",
|
|
1641
1635
|
"option",
|
|
1642
1636
|
"account",
|
|
1643
|
-
"news",
|
|
1644
1637
|
...EARN_SUB_MODULE_IDS,
|
|
1645
1638
|
...BOT_SUB_MODULE_IDS,
|
|
1646
1639
|
"skills"
|
|
@@ -5770,304 +5763,6 @@ function registerMarketTools() {
|
|
|
5770
5763
|
}
|
|
5771
5764
|
];
|
|
5772
5765
|
}
|
|
5773
|
-
var NEWS_SEARCH = "/api/v5/orbit/news-search";
|
|
5774
|
-
var NEWS_DETAIL = "/api/v5/orbit/news-detail";
|
|
5775
|
-
var NEWS_DOMAINS = "/api/v5/orbit/news-platform";
|
|
5776
|
-
var SENTIMENT_QUERY = "/api/v5/orbit/currency-sentiment-query";
|
|
5777
|
-
var SENTIMENT_RANKING = "/api/v5/orbit/currency-sentiment-ranking";
|
|
5778
|
-
var NEWS_LANGUAGE = ["en_US", "zh_CN"];
|
|
5779
|
-
function langHeader(lang) {
|
|
5780
|
-
if (lang === "zh_CN" || lang === "en_US") return { "Accept-Language": lang };
|
|
5781
|
-
return void 0;
|
|
5782
|
-
}
|
|
5783
|
-
var NEWS_DETAIL_LVL = ["brief", "summary", "full"];
|
|
5784
|
-
var NEWS_IMPORTANCE = ["high", "medium", "low"];
|
|
5785
|
-
var NEWS_SENTIMENT = ["bullish", "bearish", "neutral"];
|
|
5786
|
-
var NEWS_SORT = ["latest", "relevant"];
|
|
5787
|
-
var SENTIMENT_PERIOD = ["1h", "4h", "24h"];
|
|
5788
|
-
var D_COINS_NEWS = 'Comma-separated uppercase ticker symbols (e.g. "BTC,ETH"). Normalize names/aliases to standard tickers.';
|
|
5789
|
-
var D_COINS_SENTIMENT = 'Comma-separated uppercase ticker symbols, max 20 (e.g. "BTC,ETH"). Normalize names/aliases to standard tickers.';
|
|
5790
|
-
var D_LANGUAGE = "Content language: zh_CN or en_US. Infer from user's message. No server default.";
|
|
5791
|
-
var D_BEGIN = "Start time, Unix epoch milliseconds. Parse relative time if given (e.g. 'yesterday', 'last 7 days').";
|
|
5792
|
-
var D_END = "End time, Unix epoch milliseconds. Parse relative time if given. Omit for no upper bound.";
|
|
5793
|
-
var D_IMPORTANCE = "Importance filter: high (server default), medium, low. Omit unless user wants broader coverage.";
|
|
5794
|
-
var D_LIMIT = "Number of results (default 10, max 50).";
|
|
5795
|
-
function registerNewsTools() {
|
|
5796
|
-
return [
|
|
5797
|
-
// -----------------------------------------------------------------------
|
|
5798
|
-
// News browsing tools
|
|
5799
|
-
// -----------------------------------------------------------------------
|
|
5800
|
-
{
|
|
5801
|
-
name: "news_get_latest",
|
|
5802
|
-
module: "news",
|
|
5803
|
-
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.",
|
|
5804
|
-
isWrite: false,
|
|
5805
|
-
inputSchema: {
|
|
5806
|
-
type: "object",
|
|
5807
|
-
properties: {
|
|
5808
|
-
coins: { type: "string", description: D_COINS_NEWS + " Optional." },
|
|
5809
|
-
importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
|
|
5810
|
-
begin: { type: "number", description: D_BEGIN },
|
|
5811
|
-
end: { type: "number", description: D_END },
|
|
5812
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
|
|
5813
|
-
detailLvl: {
|
|
5814
|
-
type: "string",
|
|
5815
|
-
enum: [...NEWS_DETAIL_LVL],
|
|
5816
|
-
description: "Content level: summary (AI summary, default), full (original text), brief (title only)."
|
|
5817
|
-
},
|
|
5818
|
-
limit: { type: "number", description: D_LIMIT },
|
|
5819
|
-
after: { type: "string", description: "Pagination cursor from previous response nextCursor." }
|
|
5820
|
-
},
|
|
5821
|
-
required: []
|
|
5822
|
-
},
|
|
5823
|
-
handler: async (rawArgs, context) => {
|
|
5824
|
-
const args = asRecord(rawArgs);
|
|
5825
|
-
const response = await context.client.privateGet(
|
|
5826
|
-
NEWS_SEARCH,
|
|
5827
|
-
compactObject({
|
|
5828
|
-
sortBy: "latest",
|
|
5829
|
-
importance: readString(args, "importance"),
|
|
5830
|
-
ccyList: readString(args, "coins"),
|
|
5831
|
-
begin: readNumber(args, "begin"),
|
|
5832
|
-
end: readNumber(args, "end"),
|
|
5833
|
-
detailLvl: readString(args, "detailLvl"),
|
|
5834
|
-
limit: readNumber(args, "limit") ?? 10,
|
|
5835
|
-
cursor: readString(args, "after")
|
|
5836
|
-
}),
|
|
5837
|
-
publicRateLimit("news_get_latest", 20),
|
|
5838
|
-
langHeader(readString(args, "language"))
|
|
5839
|
-
);
|
|
5840
|
-
return normalizeResponse(response);
|
|
5841
|
-
}
|
|
5842
|
-
},
|
|
5843
|
-
{
|
|
5844
|
-
name: "news_get_by_coin",
|
|
5845
|
-
module: "news",
|
|
5846
|
-
description: "Get news for specific coins or tokens. Use when user mentions a coin: 'BTC news', 'any SOL updates'. Supports multiple coins (comma-separated).",
|
|
5847
|
-
isWrite: false,
|
|
5848
|
-
inputSchema: {
|
|
5849
|
-
type: "object",
|
|
5850
|
-
properties: {
|
|
5851
|
-
coins: { type: "string", description: D_COINS_NEWS + " Required." },
|
|
5852
|
-
importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
|
|
5853
|
-
begin: { type: "number", description: D_BEGIN },
|
|
5854
|
-
end: { type: "number", description: D_END },
|
|
5855
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
|
|
5856
|
-
detailLvl: { type: "string", enum: [...NEWS_DETAIL_LVL] },
|
|
5857
|
-
limit: { type: "number", description: D_LIMIT }
|
|
5858
|
-
},
|
|
5859
|
-
required: ["coins"]
|
|
5860
|
-
},
|
|
5861
|
-
handler: async (rawArgs, context) => {
|
|
5862
|
-
const args = asRecord(rawArgs);
|
|
5863
|
-
const coins = readString(args, "coins");
|
|
5864
|
-
if (!coins) {
|
|
5865
|
-
throw new Error(`Missing required parameter "coins".`);
|
|
5866
|
-
}
|
|
5867
|
-
const response = await context.client.privateGet(
|
|
5868
|
-
NEWS_SEARCH,
|
|
5869
|
-
compactObject({
|
|
5870
|
-
sortBy: "latest",
|
|
5871
|
-
ccyList: coins,
|
|
5872
|
-
importance: readString(args, "importance"),
|
|
5873
|
-
begin: readNumber(args, "begin"),
|
|
5874
|
-
end: readNumber(args, "end"),
|
|
5875
|
-
detailLvl: readString(args, "detailLvl"),
|
|
5876
|
-
limit: readNumber(args, "limit") ?? 10
|
|
5877
|
-
}),
|
|
5878
|
-
publicRateLimit("news_get_by_coin", 20),
|
|
5879
|
-
langHeader(readString(args, "language"))
|
|
5880
|
-
);
|
|
5881
|
-
return normalizeResponse(response);
|
|
5882
|
-
}
|
|
5883
|
-
},
|
|
5884
|
-
{
|
|
5885
|
-
name: "news_search",
|
|
5886
|
-
module: "news",
|
|
5887
|
-
description: "Search crypto news by keyword with optional filters. Use when user provides specific search terms: 'SEC ETF news', 'stablecoin regulation', 'Bitcoin halving'. For coin-only queries prefer news_get_by_coin.",
|
|
5888
|
-
isWrite: false,
|
|
5889
|
-
inputSchema: {
|
|
5890
|
-
type: "object",
|
|
5891
|
-
properties: {
|
|
5892
|
-
keyword: {
|
|
5893
|
-
type: "string",
|
|
5894
|
-
description: "Search keyword(s) extracted from user query (topic/entity). Multiple words are AND-combined. Omit to browse by filters only."
|
|
5895
|
-
},
|
|
5896
|
-
coins: { type: "string", description: D_COINS_NEWS + " Optional." },
|
|
5897
|
-
importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
|
|
5898
|
-
sentiment: {
|
|
5899
|
-
type: "string",
|
|
5900
|
-
enum: [...NEWS_SENTIMENT],
|
|
5901
|
-
description: "Filter by sentiment if mentioned alongside the keyword."
|
|
5902
|
-
},
|
|
5903
|
-
sortBy: {
|
|
5904
|
-
type: "string",
|
|
5905
|
-
enum: [...NEWS_SORT],
|
|
5906
|
-
description: "Sort order: relevant (by relevance, default for keyword search), latest (by time)."
|
|
5907
|
-
},
|
|
5908
|
-
begin: { type: "number", description: D_BEGIN },
|
|
5909
|
-
end: { type: "number", description: D_END },
|
|
5910
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
|
|
5911
|
-
detailLvl: { type: "string", enum: [...NEWS_DETAIL_LVL] },
|
|
5912
|
-
limit: { type: "number", description: D_LIMIT },
|
|
5913
|
-
after: { type: "string", description: "Pagination cursor from previous response nextCursor." }
|
|
5914
|
-
},
|
|
5915
|
-
required: []
|
|
5916
|
-
},
|
|
5917
|
-
handler: async (rawArgs, context) => {
|
|
5918
|
-
const args = asRecord(rawArgs);
|
|
5919
|
-
const response = await context.client.privateGet(
|
|
5920
|
-
NEWS_SEARCH,
|
|
5921
|
-
compactObject({
|
|
5922
|
-
keyword: readString(args, "keyword") || void 0,
|
|
5923
|
-
sortBy: readString(args, "sortBy") ?? "relevant",
|
|
5924
|
-
importance: readString(args, "importance"),
|
|
5925
|
-
ccyList: readString(args, "coins"),
|
|
5926
|
-
sentiment: readString(args, "sentiment"),
|
|
5927
|
-
begin: readNumber(args, "begin"),
|
|
5928
|
-
end: readNumber(args, "end"),
|
|
5929
|
-
detailLvl: readString(args, "detailLvl"),
|
|
5930
|
-
limit: readNumber(args, "limit") ?? 10,
|
|
5931
|
-
cursor: readString(args, "after")
|
|
5932
|
-
}),
|
|
5933
|
-
publicRateLimit("news_search", 20),
|
|
5934
|
-
langHeader(readString(args, "language"))
|
|
5935
|
-
);
|
|
5936
|
-
return normalizeResponse(response);
|
|
5937
|
-
}
|
|
5938
|
-
},
|
|
5939
|
-
{
|
|
5940
|
-
name: "news_get_detail",
|
|
5941
|
-
module: "news",
|
|
5942
|
-
description: "Get full article content by news ID (returns title + summary + full original text). Use when user says 'show full article', 'read more', or provides a specific news ID from a previous result.",
|
|
5943
|
-
isWrite: false,
|
|
5944
|
-
inputSchema: {
|
|
5945
|
-
type: "object",
|
|
5946
|
-
properties: {
|
|
5947
|
-
id: {
|
|
5948
|
-
type: "string",
|
|
5949
|
-
description: "News article ID from a previous news_get_latest / news_get_by_coin / news_search result. Required."
|
|
5950
|
-
},
|
|
5951
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE }
|
|
5952
|
-
},
|
|
5953
|
-
required: ["id"]
|
|
5954
|
-
},
|
|
5955
|
-
handler: async (rawArgs, context) => {
|
|
5956
|
-
const args = asRecord(rawArgs);
|
|
5957
|
-
const id = readString(args, "id");
|
|
5958
|
-
if (!id) {
|
|
5959
|
-
throw new Error(`Missing required parameter "id".`);
|
|
5960
|
-
}
|
|
5961
|
-
const response = await context.client.privateGet(
|
|
5962
|
-
NEWS_DETAIL,
|
|
5963
|
-
{ id },
|
|
5964
|
-
publicRateLimit("news_get_detail", 20),
|
|
5965
|
-
langHeader(readString(args, "language"))
|
|
5966
|
-
);
|
|
5967
|
-
return normalizeResponse(response);
|
|
5968
|
-
}
|
|
5969
|
-
},
|
|
5970
|
-
{
|
|
5971
|
-
name: "news_get_domains",
|
|
5972
|
-
module: "news",
|
|
5973
|
-
description: "List available news source domains (e.g. coindesk, cointelegraph). Use when user asks what news sources are available or which platforms are covered.",
|
|
5974
|
-
isWrite: false,
|
|
5975
|
-
inputSchema: {
|
|
5976
|
-
type: "object",
|
|
5977
|
-
properties: {},
|
|
5978
|
-
required: []
|
|
5979
|
-
},
|
|
5980
|
-
handler: async (_rawArgs, context) => {
|
|
5981
|
-
const response = await context.client.privateGet(
|
|
5982
|
-
NEWS_DOMAINS,
|
|
5983
|
-
{},
|
|
5984
|
-
publicRateLimit("news_get_domains", 20)
|
|
5985
|
-
);
|
|
5986
|
-
return normalizeResponse(response);
|
|
5987
|
-
}
|
|
5988
|
-
},
|
|
5989
|
-
// -----------------------------------------------------------------------
|
|
5990
|
-
// Token sentiment tools
|
|
5991
|
-
// -----------------------------------------------------------------------
|
|
5992
|
-
{
|
|
5993
|
-
name: "news_get_coin_sentiment",
|
|
5994
|
-
module: "news",
|
|
5995
|
-
description: "Get sentiment snapshot or time-series trend for coins. Returns bullish/bearish ratios and mention counts. Pass trendPoints for trend data (1h\u219224 points, 4h\u21926, 24h\u21927). Use when user asks about coin sentiment, sentiment trend, or how bullish/bearish a coin is.",
|
|
5996
|
-
isWrite: false,
|
|
5997
|
-
inputSchema: {
|
|
5998
|
-
type: "object",
|
|
5999
|
-
properties: {
|
|
6000
|
-
coins: { type: "string", description: D_COINS_SENTIMENT + " Required." },
|
|
6001
|
-
period: {
|
|
6002
|
-
type: "string",
|
|
6003
|
-
enum: [...SENTIMENT_PERIOD],
|
|
6004
|
-
description: "Aggregation granularity: 1h, 4h, 24h. Snapshot default: 24h. Trend default: 1h."
|
|
6005
|
-
},
|
|
6006
|
-
trendPoints: {
|
|
6007
|
-
type: "number",
|
|
6008
|
-
description: "Trend data points. Pass for time-series trend; omit for snapshot. Guide: 1h\u219224, 4h\u21926, 24h\u21927."
|
|
6009
|
-
}
|
|
6010
|
-
},
|
|
6011
|
-
required: ["coins"]
|
|
6012
|
-
},
|
|
6013
|
-
handler: async (rawArgs, context) => {
|
|
6014
|
-
const args = asRecord(rawArgs);
|
|
6015
|
-
const coins = readString(args, "coins");
|
|
6016
|
-
if (!coins) {
|
|
6017
|
-
throw new Error(`Missing required parameter "coins".`);
|
|
6018
|
-
}
|
|
6019
|
-
const trendPoints = readNumber(args, "trendPoints");
|
|
6020
|
-
const inclTrend = trendPoints !== void 0;
|
|
6021
|
-
const response = await context.client.privateGet(
|
|
6022
|
-
SENTIMENT_QUERY,
|
|
6023
|
-
compactObject({
|
|
6024
|
-
ccy: coins,
|
|
6025
|
-
period: readString(args, "period") ?? (inclTrend ? "1h" : "24h"),
|
|
6026
|
-
...inclTrend ? { inclTrend: true, limit: trendPoints } : {}
|
|
6027
|
-
}),
|
|
6028
|
-
publicRateLimit("news_get_coin_sentiment", 20)
|
|
6029
|
-
);
|
|
6030
|
-
return normalizeResponse(response);
|
|
6031
|
-
}
|
|
6032
|
-
},
|
|
6033
|
-
{
|
|
6034
|
-
name: "news_get_sentiment_ranking",
|
|
6035
|
-
module: "news",
|
|
6036
|
-
description: "Get coin ranking by social hotness or sentiment direction. Use when user asks which coins are trending, most bullish/bearish coins. Sort by hot (mention count), bullish, or bearish.",
|
|
6037
|
-
isWrite: false,
|
|
6038
|
-
inputSchema: {
|
|
6039
|
-
type: "object",
|
|
6040
|
-
properties: {
|
|
6041
|
-
period: {
|
|
6042
|
-
type: "string",
|
|
6043
|
-
enum: [...SENTIMENT_PERIOD],
|
|
6044
|
-
description: "Aggregation granularity: 1h, 4h, 24h (default)."
|
|
6045
|
-
},
|
|
6046
|
-
sortBy: {
|
|
6047
|
-
type: "string",
|
|
6048
|
-
enum: ["hot", "bullish", "bearish"],
|
|
6049
|
-
description: "Sort: hot=by mentions (default), bullish=most bullish, bearish=most bearish."
|
|
6050
|
-
},
|
|
6051
|
-
limit: { type: "number", description: D_LIMIT }
|
|
6052
|
-
},
|
|
6053
|
-
required: []
|
|
6054
|
-
},
|
|
6055
|
-
handler: async (rawArgs, context) => {
|
|
6056
|
-
const args = asRecord(rawArgs);
|
|
6057
|
-
const response = await context.client.privateGet(
|
|
6058
|
-
SENTIMENT_RANKING,
|
|
6059
|
-
compactObject({
|
|
6060
|
-
period: readString(args, "period") ?? "24h",
|
|
6061
|
-
sortBy: readString(args, "sortBy") ?? "hot",
|
|
6062
|
-
limit: readNumber(args, "limit") ?? 10
|
|
6063
|
-
}),
|
|
6064
|
-
publicRateLimit("news_get_sentiment_ranking", 20)
|
|
6065
|
-
);
|
|
6066
|
-
return normalizeResponse(response);
|
|
6067
|
-
}
|
|
6068
|
-
}
|
|
6069
|
-
];
|
|
6070
|
-
}
|
|
6071
5766
|
function registerOptionAlgoTools() {
|
|
6072
5767
|
return [
|
|
6073
5768
|
{
|
|
@@ -7541,7 +7236,6 @@ function allToolSpecs() {
|
|
|
7541
7236
|
...registerOptionAlgoTools(),
|
|
7542
7237
|
...registerAlgoTradeTools(),
|
|
7543
7238
|
...registerAccountTools(),
|
|
7544
|
-
...registerNewsTools(),
|
|
7545
7239
|
...registerBotTools(),
|
|
7546
7240
|
...registerAllEarnTools(),
|
|
7547
7241
|
...registerAuditTools(),
|
|
@@ -8554,7 +8248,7 @@ async function cmdDiagnoseMcp(options = {}) {
|
|
|
8554
8248
|
|
|
8555
8249
|
// src/commands/diagnose.ts
|
|
8556
8250
|
var CLI_VERSION = readCliVersion();
|
|
8557
|
-
var GIT_HASH = true ? "
|
|
8251
|
+
var GIT_HASH = true ? "0b9b3b7" : "dev";
|
|
8558
8252
|
function maskKey2(key) {
|
|
8559
8253
|
if (!key) return "(not set)";
|
|
8560
8254
|
if (key.length <= 8) return "****";
|
|
@@ -8952,223 +8646,6 @@ async function cmdUpgrade(currentVersion, options, json) {
|
|
|
8952
8646
|
}
|
|
8953
8647
|
}
|
|
8954
8648
|
|
|
8955
|
-
// src/commands/news.ts
|
|
8956
|
-
function getData(result) {
|
|
8957
|
-
return result.data;
|
|
8958
|
-
}
|
|
8959
|
-
function formatTime(ts) {
|
|
8960
|
-
if (!ts) return "-";
|
|
8961
|
-
return new Date(Number(ts)).toLocaleString();
|
|
8962
|
-
}
|
|
8963
|
-
async function cmdNewsLatest(run, opts) {
|
|
8964
|
-
const result = await run("news_get_latest", {
|
|
8965
|
-
coins: opts.coins,
|
|
8966
|
-
importance: opts.importance,
|
|
8967
|
-
begin: opts.begin,
|
|
8968
|
-
end: opts.end,
|
|
8969
|
-
language: opts.language,
|
|
8970
|
-
detailLvl: opts.detailLvl,
|
|
8971
|
-
limit: opts.limit,
|
|
8972
|
-
after: opts.after
|
|
8973
|
-
});
|
|
8974
|
-
const raw = getData(result);
|
|
8975
|
-
const pageData = raw?.[0];
|
|
8976
|
-
if (opts.json) return printJson(pageData ?? null);
|
|
8977
|
-
const items = pageData?.["details"] ?? [];
|
|
8978
|
-
printTable(
|
|
8979
|
-
items.map((n) => ({
|
|
8980
|
-
id: n["id"],
|
|
8981
|
-
time: formatTime(n["cTime"] ?? n["createTime"]),
|
|
8982
|
-
platforms: n["platformList"]?.join(",") ?? "-",
|
|
8983
|
-
title: String(n["title"] ?? "").slice(0, 80)
|
|
8984
|
-
}))
|
|
8985
|
-
);
|
|
8986
|
-
const cursor = pageData?.["nextCursor"];
|
|
8987
|
-
if (cursor) outputLine(`[next] --after ${cursor}`);
|
|
8988
|
-
}
|
|
8989
|
-
async function cmdNewsImportant(run, opts) {
|
|
8990
|
-
const result = await run("news_get_latest", {
|
|
8991
|
-
coins: opts.coins,
|
|
8992
|
-
importance: "high",
|
|
8993
|
-
begin: opts.begin,
|
|
8994
|
-
end: opts.end,
|
|
8995
|
-
language: opts.language,
|
|
8996
|
-
detailLvl: opts.detailLvl,
|
|
8997
|
-
limit: opts.limit
|
|
8998
|
-
});
|
|
8999
|
-
const raw = getData(result);
|
|
9000
|
-
const pageData = raw?.[0];
|
|
9001
|
-
if (opts.json) return printJson(pageData ?? null);
|
|
9002
|
-
const items = pageData?.["details"] ?? [];
|
|
9003
|
-
printTable(
|
|
9004
|
-
items.map((n) => ({
|
|
9005
|
-
id: n["id"],
|
|
9006
|
-
time: formatTime(n["cTime"] ?? n["createTime"]),
|
|
9007
|
-
importance: n["importance"] ?? "-",
|
|
9008
|
-
platforms: n["platformList"]?.join(",") ?? "-",
|
|
9009
|
-
title: String(n["title"] ?? "").slice(0, 80)
|
|
9010
|
-
}))
|
|
9011
|
-
);
|
|
9012
|
-
}
|
|
9013
|
-
async function cmdNewsByCoin(run, coins, opts) {
|
|
9014
|
-
const result = await run("news_get_by_coin", {
|
|
9015
|
-
coins,
|
|
9016
|
-
importance: opts.importance,
|
|
9017
|
-
begin: opts.begin,
|
|
9018
|
-
end: opts.end,
|
|
9019
|
-
language: opts.language,
|
|
9020
|
-
detailLvl: opts.detailLvl,
|
|
9021
|
-
limit: opts.limit
|
|
9022
|
-
});
|
|
9023
|
-
const raw = getData(result);
|
|
9024
|
-
const pageData = raw?.[0];
|
|
9025
|
-
if (opts.json) return printJson(pageData ?? null);
|
|
9026
|
-
const items = pageData?.["details"] ?? [];
|
|
9027
|
-
printTable(
|
|
9028
|
-
items.map((n) => ({
|
|
9029
|
-
id: n["id"],
|
|
9030
|
-
time: formatTime(n["cTime"] ?? n["createTime"]),
|
|
9031
|
-
coins: n["ccyList"]?.join(",") ?? "-",
|
|
9032
|
-
platforms: n["platformList"]?.join(",") ?? "-",
|
|
9033
|
-
title: String(n["title"] ?? "").slice(0, 80)
|
|
9034
|
-
}))
|
|
9035
|
-
);
|
|
9036
|
-
}
|
|
9037
|
-
async function cmdNewsSearch(run, keyword, opts) {
|
|
9038
|
-
const result = await run("news_search", {
|
|
9039
|
-
keyword: keyword || void 0,
|
|
9040
|
-
coins: opts.coins,
|
|
9041
|
-
importance: opts.importance,
|
|
9042
|
-
sentiment: opts.sentiment,
|
|
9043
|
-
sortBy: opts.sortBy,
|
|
9044
|
-
begin: opts.begin,
|
|
9045
|
-
end: opts.end,
|
|
9046
|
-
language: opts.language,
|
|
9047
|
-
detailLvl: opts.detailLvl,
|
|
9048
|
-
limit: opts.limit,
|
|
9049
|
-
after: opts.after
|
|
9050
|
-
});
|
|
9051
|
-
const raw = getData(result);
|
|
9052
|
-
const pageData = raw?.[0];
|
|
9053
|
-
if (opts.json) return printJson(pageData ?? null);
|
|
9054
|
-
const items = pageData?.["details"] ?? [];
|
|
9055
|
-
printTable(
|
|
9056
|
-
items.map((n) => ({
|
|
9057
|
-
id: n["id"],
|
|
9058
|
-
time: formatTime(n["cTime"] ?? n["createTime"]),
|
|
9059
|
-
platforms: n["platformList"]?.join(",") ?? "-",
|
|
9060
|
-
title: String(n["title"] ?? "").slice(0, 80)
|
|
9061
|
-
}))
|
|
9062
|
-
);
|
|
9063
|
-
const cursor = pageData?.["nextCursor"];
|
|
9064
|
-
if (cursor) outputLine(`[next] --after ${cursor}`);
|
|
9065
|
-
}
|
|
9066
|
-
async function cmdNewsDetail(run, id, opts) {
|
|
9067
|
-
const result = await run("news_get_detail", { id, language: opts.language });
|
|
9068
|
-
const items = getData(result);
|
|
9069
|
-
if (opts.json) return printJson(items);
|
|
9070
|
-
const article = items?.[0];
|
|
9071
|
-
if (!article) {
|
|
9072
|
-
outputLine("Article not found.");
|
|
9073
|
-
return;
|
|
9074
|
-
}
|
|
9075
|
-
const rawContent = article["content"] ? String(article["content"]) : void 0;
|
|
9076
|
-
let content;
|
|
9077
|
-
if (rawContent && rawContent.length > 500) {
|
|
9078
|
-
content = rawContent.slice(0, 500) + "... (use --json for full text)";
|
|
9079
|
-
} else {
|
|
9080
|
-
content = rawContent;
|
|
9081
|
-
}
|
|
9082
|
-
printKv({
|
|
9083
|
-
id: article["id"],
|
|
9084
|
-
title: article["title"],
|
|
9085
|
-
platforms: article["platformList"]?.join(", ") ?? "-",
|
|
9086
|
-
time: formatTime(article["cTime"] ?? article["createTime"]),
|
|
9087
|
-
sourceUrl: article["sourceUrl"],
|
|
9088
|
-
coins: article["ccyList"]?.join(", ") ?? "-",
|
|
9089
|
-
importance: article["importance"] ?? "-",
|
|
9090
|
-
summary: article["summary"] ?? "(see content)",
|
|
9091
|
-
content
|
|
9092
|
-
});
|
|
9093
|
-
}
|
|
9094
|
-
async function cmdNewsDomains(run, opts) {
|
|
9095
|
-
const result = await run("news_get_domains", {});
|
|
9096
|
-
const raw = getData(result);
|
|
9097
|
-
const items = raw?.[0]?.["platform"] ?? [];
|
|
9098
|
-
if (opts.json) return printJson(items);
|
|
9099
|
-
outputLine("Available news source domains:");
|
|
9100
|
-
(items ?? []).forEach((d) => outputLine(` ${d}`));
|
|
9101
|
-
}
|
|
9102
|
-
async function cmdNewsCoinSentiment(run, coins, opts) {
|
|
9103
|
-
const result = await run("news_get_coin_sentiment", {
|
|
9104
|
-
coins,
|
|
9105
|
-
period: opts.period
|
|
9106
|
-
});
|
|
9107
|
-
const raw = getData(result);
|
|
9108
|
-
if (opts.json) return printJson(raw);
|
|
9109
|
-
const items = raw?.[0]?.["details"] ?? [];
|
|
9110
|
-
printTable(
|
|
9111
|
-
items.map((c) => {
|
|
9112
|
-
const snt = c["sentiment"];
|
|
9113
|
-
return {
|
|
9114
|
-
symbol: c["ccy"],
|
|
9115
|
-
label: snt?.["label"] ?? "-",
|
|
9116
|
-
bullish: snt?.["bullishRatio"] ?? "-",
|
|
9117
|
-
bearish: snt?.["bearishRatio"] ?? "-",
|
|
9118
|
-
mentions: c["mentionCnt"]
|
|
9119
|
-
};
|
|
9120
|
-
})
|
|
9121
|
-
);
|
|
9122
|
-
}
|
|
9123
|
-
async function cmdNewsCoinTrend(run, coin, opts) {
|
|
9124
|
-
const result = await run("news_get_coin_sentiment", {
|
|
9125
|
-
coins: coin,
|
|
9126
|
-
period: opts.period,
|
|
9127
|
-
trendPoints: opts.points
|
|
9128
|
-
});
|
|
9129
|
-
const raw = getData(result);
|
|
9130
|
-
if (opts.json) return printJson(raw);
|
|
9131
|
-
const items = raw?.[0]?.["details"] ?? [];
|
|
9132
|
-
const coinData = items?.[0];
|
|
9133
|
-
if (!coinData) {
|
|
9134
|
-
outputLine("No trend data.");
|
|
9135
|
-
return;
|
|
9136
|
-
}
|
|
9137
|
-
const trend = coinData["trend"] ?? [];
|
|
9138
|
-
outputLine(`Sentiment trend for ${coin} (period: ${opts.period ?? "1h"}):`);
|
|
9139
|
-
printTable(
|
|
9140
|
-
trend.map((t) => ({
|
|
9141
|
-
time: formatTime(t["ts"]),
|
|
9142
|
-
bullish: t["bullishRatio"],
|
|
9143
|
-
bearish: t["bearishRatio"],
|
|
9144
|
-
mentions: t["mentionCnt"]
|
|
9145
|
-
}))
|
|
9146
|
-
);
|
|
9147
|
-
}
|
|
9148
|
-
async function cmdNewsSentimentRank(run, opts) {
|
|
9149
|
-
const result = await run("news_get_sentiment_ranking", {
|
|
9150
|
-
period: opts.period,
|
|
9151
|
-
sortBy: opts.sortBy,
|
|
9152
|
-
limit: opts.limit
|
|
9153
|
-
});
|
|
9154
|
-
const raw = getData(result);
|
|
9155
|
-
if (opts.json) return printJson(raw);
|
|
9156
|
-
const items = raw?.[0]?.["details"] ?? [];
|
|
9157
|
-
printTable(
|
|
9158
|
-
items.map((c, i) => {
|
|
9159
|
-
const snt = c["sentiment"];
|
|
9160
|
-
return {
|
|
9161
|
-
rank: i + 1,
|
|
9162
|
-
symbol: c["ccy"],
|
|
9163
|
-
label: snt?.["label"] ?? "-",
|
|
9164
|
-
bullish: snt?.["bullishRatio"] ?? "-",
|
|
9165
|
-
bearish: snt?.["bearishRatio"] ?? "-",
|
|
9166
|
-
mentions: c["mentionCnt"]
|
|
9167
|
-
};
|
|
9168
|
-
})
|
|
9169
|
-
);
|
|
9170
|
-
}
|
|
9171
|
-
|
|
9172
8649
|
// src/config/loader.ts
|
|
9173
8650
|
function loadProfileConfig(opts) {
|
|
9174
8651
|
return loadConfig({
|
|
@@ -9780,51 +9257,6 @@ var HELP_TREE = {
|
|
|
9780
9257
|
upgrade: {
|
|
9781
9258
|
description: "Upgrade okx CLI and MCP server to the latest stable version",
|
|
9782
9259
|
usage: "okx upgrade [--check] [--beta] [--force] [--json]"
|
|
9783
|
-
},
|
|
9784
|
-
news: {
|
|
9785
|
-
description: "Orbit News \u2014 crypto news feed, coin sentiment, and trend analysis",
|
|
9786
|
-
commands: {
|
|
9787
|
-
latest: {
|
|
9788
|
-
usage: "okx news latest [--limit <n>] [--lang <zh_CN|en_US>]",
|
|
9789
|
-
description: "Get latest crypto news"
|
|
9790
|
-
},
|
|
9791
|
-
important: {
|
|
9792
|
-
usage: "okx news important [--limit <n>] [--lang <zh_CN|en_US>]",
|
|
9793
|
-
description: "Get important / high-impact crypto news"
|
|
9794
|
-
},
|
|
9795
|
-
"by-coin": {
|
|
9796
|
-
usage: "okx news by-coin --coins <BTC,ETH,...> [--limit <n>] [--lang <zh_CN|en_US>]",
|
|
9797
|
-
description: "Get news filtered by coin(s)"
|
|
9798
|
-
},
|
|
9799
|
-
"by-sentiment": {
|
|
9800
|
-
usage: "okx news by-sentiment --sentiment <bullish|bearish|neutral> [--limit <n>] [--lang <zh_CN|en_US>]",
|
|
9801
|
-
description: "Get news filtered by sentiment"
|
|
9802
|
-
},
|
|
9803
|
-
search: {
|
|
9804
|
-
usage: "okx news search --keyword <text> [--limit <n>] [--lang <zh_CN|en_US>]",
|
|
9805
|
-
description: "Search news by keyword"
|
|
9806
|
-
},
|
|
9807
|
-
detail: {
|
|
9808
|
-
usage: "okx news detail <articleId> [--lang <zh_CN|en_US>]",
|
|
9809
|
-
description: "Get full article detail by ID"
|
|
9810
|
-
},
|
|
9811
|
-
domains: {
|
|
9812
|
-
usage: "okx news domains",
|
|
9813
|
-
description: "List available news source domains"
|
|
9814
|
-
},
|
|
9815
|
-
"coin-sentiment": {
|
|
9816
|
-
usage: "okx news coin-sentiment --coins <BTC,ETH,...> [--period <1h|24h>]",
|
|
9817
|
-
description: "Get sentiment score for specific coin(s)"
|
|
9818
|
-
},
|
|
9819
|
-
"coin-trend": {
|
|
9820
|
-
usage: "okx news coin-trend <coin> [--period <1h|24h>] [--points <n>]",
|
|
9821
|
-
description: "Get sentiment trend data points for a coin"
|
|
9822
|
-
},
|
|
9823
|
-
"sentiment-rank": {
|
|
9824
|
-
usage: "okx news sentiment-rank [--period <1h|24h>] [--sort-by <hot|bullish|bearish>] [--limit <n>]",
|
|
9825
|
-
description: "Get coin ranking by social hotness or sentiment direction"
|
|
9826
|
-
}
|
|
9827
|
-
}
|
|
9828
9260
|
}
|
|
9829
9261
|
};
|
|
9830
9262
|
function printGlobalHelp() {
|
|
@@ -10108,16 +9540,8 @@ var CLI_OPTIONS = {
|
|
|
10108
9540
|
params: { type: "string" },
|
|
10109
9541
|
list: { type: "boolean", default: false },
|
|
10110
9542
|
"backtest-time": { type: "string" },
|
|
10111
|
-
// news
|
|
10112
|
-
coins: { type: "string" },
|
|
10113
|
-
sentiment: { type: "string" },
|
|
10114
|
-
importance: { type: "string" },
|
|
10115
|
-
keyword: { type: "string" },
|
|
10116
|
-
"detail-lvl": { type: "string" },
|
|
10117
|
-
period: { type: "string" },
|
|
10118
|
-
points: { type: "string" },
|
|
10119
|
-
"sort-by": { type: "string" },
|
|
10120
9543
|
// skill marketplace
|
|
9544
|
+
keyword: { type: "string" },
|
|
10121
9545
|
categories: { type: "string" },
|
|
10122
9546
|
dir: { type: "string" },
|
|
10123
9547
|
page: { type: "string" },
|
|
@@ -10156,12 +9580,12 @@ function parseCli(argv) {
|
|
|
10156
9580
|
}
|
|
10157
9581
|
|
|
10158
9582
|
// src/commands/market.ts
|
|
10159
|
-
function
|
|
9583
|
+
function getData(result) {
|
|
10160
9584
|
return result.data;
|
|
10161
9585
|
}
|
|
10162
9586
|
async function cmdMarketInstruments(run, opts) {
|
|
10163
9587
|
const result = await run("market_get_instruments", { instType: opts.instType, instId: opts.instId });
|
|
10164
|
-
const items =
|
|
9588
|
+
const items = getData(result);
|
|
10165
9589
|
if (opts.json) return printJson(items);
|
|
10166
9590
|
printTable(
|
|
10167
9591
|
(items ?? []).slice(0, 50).map((t) => ({
|
|
@@ -10176,7 +9600,7 @@ async function cmdMarketInstruments(run, opts) {
|
|
|
10176
9600
|
}
|
|
10177
9601
|
async function cmdMarketFundingRate(run, instId, opts) {
|
|
10178
9602
|
const result = await run("market_get_funding_rate", { instId, history: opts.history, limit: opts.limit });
|
|
10179
|
-
const items =
|
|
9603
|
+
const items = getData(result);
|
|
10180
9604
|
if (opts.json) return printJson(items);
|
|
10181
9605
|
if (opts.history) {
|
|
10182
9606
|
printTable(
|
|
@@ -10204,7 +9628,7 @@ async function cmdMarketFundingRate(run, instId, opts) {
|
|
|
10204
9628
|
}
|
|
10205
9629
|
async function cmdMarketMarkPrice(run, opts) {
|
|
10206
9630
|
const result = await run("market_get_mark_price", { instType: opts.instType, instId: opts.instId });
|
|
10207
|
-
const items =
|
|
9631
|
+
const items = getData(result);
|
|
10208
9632
|
if (opts.json) return printJson(items);
|
|
10209
9633
|
printTable(
|
|
10210
9634
|
(items ?? []).map((r) => ({
|
|
@@ -10217,7 +9641,7 @@ async function cmdMarketMarkPrice(run, opts) {
|
|
|
10217
9641
|
}
|
|
10218
9642
|
async function cmdMarketTrades(run, instId, opts) {
|
|
10219
9643
|
const result = await run("market_get_trades", { instId, limit: opts.limit });
|
|
10220
|
-
const items =
|
|
9644
|
+
const items = getData(result);
|
|
10221
9645
|
if (opts.json) return printJson(items);
|
|
10222
9646
|
printTable(
|
|
10223
9647
|
(items ?? []).map((t) => ({
|
|
@@ -10231,7 +9655,7 @@ async function cmdMarketTrades(run, instId, opts) {
|
|
|
10231
9655
|
}
|
|
10232
9656
|
async function cmdMarketIndexTicker(run, opts) {
|
|
10233
9657
|
const result = await run("market_get_index_ticker", { instId: opts.instId, quoteCcy: opts.quoteCcy });
|
|
10234
|
-
const items =
|
|
9658
|
+
const items = getData(result);
|
|
10235
9659
|
if (opts.json) return printJson(items);
|
|
10236
9660
|
printTable(
|
|
10237
9661
|
(items ?? []).map((t) => ({
|
|
@@ -10245,7 +9669,7 @@ async function cmdMarketIndexTicker(run, opts) {
|
|
|
10245
9669
|
}
|
|
10246
9670
|
async function cmdMarketIndexCandles(run, instId, opts) {
|
|
10247
9671
|
const result = await run("market_get_index_candles", { instId, bar: opts.bar, limit: opts.limit, history: opts.history });
|
|
10248
|
-
const candles =
|
|
9672
|
+
const candles = getData(result);
|
|
10249
9673
|
if (opts.json) return printJson(candles);
|
|
10250
9674
|
printTable(
|
|
10251
9675
|
(candles ?? []).map(([ts, o, h, l, c]) => ({
|
|
@@ -10259,7 +9683,7 @@ async function cmdMarketIndexCandles(run, instId, opts) {
|
|
|
10259
9683
|
}
|
|
10260
9684
|
async function cmdMarketPriceLimit(run, instId, json) {
|
|
10261
9685
|
const result = await run("market_get_price_limit", { instId });
|
|
10262
|
-
const items =
|
|
9686
|
+
const items = getData(result);
|
|
10263
9687
|
if (json) return printJson(items);
|
|
10264
9688
|
const r = items?.[0];
|
|
10265
9689
|
if (!r) {
|
|
@@ -10275,7 +9699,7 @@ async function cmdMarketPriceLimit(run, instId, json) {
|
|
|
10275
9699
|
}
|
|
10276
9700
|
async function cmdMarketOpenInterest(run, opts) {
|
|
10277
9701
|
const result = await run("market_get_open_interest", { instType: opts.instType, instId: opts.instId });
|
|
10278
|
-
const items =
|
|
9702
|
+
const items = getData(result);
|
|
10279
9703
|
if (opts.json) return printJson(items);
|
|
10280
9704
|
printTable(
|
|
10281
9705
|
(items ?? []).map((r) => ({
|
|
@@ -10288,7 +9712,7 @@ async function cmdMarketOpenInterest(run, opts) {
|
|
|
10288
9712
|
}
|
|
10289
9713
|
async function cmdMarketTicker(run, instId, json) {
|
|
10290
9714
|
const result = await run("market_get_ticker", { instId });
|
|
10291
|
-
const items =
|
|
9715
|
+
const items = getData(result);
|
|
10292
9716
|
if (json) return printJson(items);
|
|
10293
9717
|
if (!items?.length) {
|
|
10294
9718
|
outputLine("No data");
|
|
@@ -10312,7 +9736,7 @@ async function cmdMarketTicker(run, instId, json) {
|
|
|
10312
9736
|
}
|
|
10313
9737
|
async function cmdMarketTickers(run, instType, json) {
|
|
10314
9738
|
const result = await run("market_get_tickers", { instType });
|
|
10315
|
-
const items =
|
|
9739
|
+
const items = getData(result);
|
|
10316
9740
|
if (json) return printJson(items);
|
|
10317
9741
|
printTable(
|
|
10318
9742
|
(items ?? []).map((t) => ({
|
|
@@ -10326,7 +9750,7 @@ async function cmdMarketTickers(run, instType, json) {
|
|
|
10326
9750
|
}
|
|
10327
9751
|
async function cmdMarketOrderbook(run, instId, sz, json) {
|
|
10328
9752
|
const result = await run("market_get_orderbook", { instId, sz });
|
|
10329
|
-
const data =
|
|
9753
|
+
const data = getData(result);
|
|
10330
9754
|
if (json) return printJson(data);
|
|
10331
9755
|
const book = data[0];
|
|
10332
9756
|
if (!book) {
|
|
@@ -10343,7 +9767,7 @@ async function cmdMarketOrderbook(run, instId, sz, json) {
|
|
|
10343
9767
|
}
|
|
10344
9768
|
async function cmdMarketCandles(run, instId, opts) {
|
|
10345
9769
|
const result = await run("market_get_candles", { instId, bar: opts.bar, limit: opts.limit, after: opts.after, before: opts.before });
|
|
10346
|
-
const candles =
|
|
9770
|
+
const candles = getData(result);
|
|
10347
9771
|
if (opts.json) return printJson(candles);
|
|
10348
9772
|
printTable(
|
|
10349
9773
|
(candles ?? []).map(([ts, o, h, l, c, vol]) => ({
|
|
@@ -10367,7 +9791,7 @@ async function cmdMarketIndicator(run, indicator, instId, opts) {
|
|
|
10367
9791
|
limit: opts.limit,
|
|
10368
9792
|
backtestTime: opts.backtestTime
|
|
10369
9793
|
});
|
|
10370
|
-
const outerArray =
|
|
9794
|
+
const outerArray = getData(result);
|
|
10371
9795
|
if (opts.json) return printJson(outerArray);
|
|
10372
9796
|
if (!outerArray?.length) {
|
|
10373
9797
|
process.stdout.write("No data\n");
|
|
@@ -10410,7 +9834,7 @@ async function cmdMarketInstrumentsByCategory(run, opts) {
|
|
|
10410
9834
|
instType: opts.instType,
|
|
10411
9835
|
instId: opts.instId
|
|
10412
9836
|
});
|
|
10413
|
-
const items =
|
|
9837
|
+
const items = getData(result);
|
|
10414
9838
|
if (opts.json) return printJson(items);
|
|
10415
9839
|
const CATEGORY_LABELS = {
|
|
10416
9840
|
"3": "Stock tokens",
|
|
@@ -10437,7 +9861,7 @@ async function cmdMarketInstrumentsByCategory(run, opts) {
|
|
|
10437
9861
|
}
|
|
10438
9862
|
async function cmdMarketStockTokens(run, opts) {
|
|
10439
9863
|
const result = await run("market_get_stock_tokens", { instType: opts.instType, instId: opts.instId });
|
|
10440
|
-
const items =
|
|
9864
|
+
const items = getData(result);
|
|
10441
9865
|
if (opts.json) return printJson(items);
|
|
10442
9866
|
printTable(
|
|
10443
9867
|
(items ?? []).slice(0, 50).map((t) => ({
|
|
@@ -10456,12 +9880,12 @@ async function cmdMarketStockTokens(run, opts) {
|
|
|
10456
9880
|
import * as fs6 from "fs";
|
|
10457
9881
|
import * as path4 from "path";
|
|
10458
9882
|
import * as os5 from "os";
|
|
10459
|
-
function
|
|
9883
|
+
function getData2(result) {
|
|
10460
9884
|
return result.data;
|
|
10461
9885
|
}
|
|
10462
9886
|
async function cmdAccountBalance(run, ccy, json) {
|
|
10463
9887
|
const result = await run("account_get_balance", { ccy });
|
|
10464
|
-
const data =
|
|
9888
|
+
const data = getData2(result);
|
|
10465
9889
|
if (json) return printJson(data);
|
|
10466
9890
|
const details = data?.[0]?.["details"] ?? [];
|
|
10467
9891
|
const rows = details.filter((d) => Number(d["eq"]) > 0).map((d) => ({
|
|
@@ -10514,7 +9938,7 @@ async function cmdAccountAssetBalance(run, ccy, json, showValuation) {
|
|
|
10514
9938
|
}
|
|
10515
9939
|
async function cmdAccountPositions(run, opts) {
|
|
10516
9940
|
const result = await run("account_get_positions", { instType: opts.instType, instId: opts.instId });
|
|
10517
|
-
const positions =
|
|
9941
|
+
const positions = getData2(result);
|
|
10518
9942
|
if (opts.json) return printJson(positions);
|
|
10519
9943
|
const open = (positions ?? []).filter((p) => Number(p["pos"]) !== 0);
|
|
10520
9944
|
if (!open.length) {
|
|
@@ -10536,7 +9960,7 @@ async function cmdAccountPositions(run, opts) {
|
|
|
10536
9960
|
async function cmdAccountBills(run, opts) {
|
|
10537
9961
|
const toolName = opts.archive ? "account_get_bills_archive" : "account_get_bills";
|
|
10538
9962
|
const result = await run(toolName, { instType: opts.instType, ccy: opts.ccy, limit: opts.limit });
|
|
10539
|
-
const bills =
|
|
9963
|
+
const bills = getData2(result);
|
|
10540
9964
|
if (opts.json) return printJson(bills);
|
|
10541
9965
|
printTable(
|
|
10542
9966
|
(bills ?? []).map((b) => ({
|
|
@@ -10552,7 +9976,7 @@ async function cmdAccountBills(run, opts) {
|
|
|
10552
9976
|
}
|
|
10553
9977
|
async function cmdAccountFees(run, opts) {
|
|
10554
9978
|
const result = await run("account_get_trade_fee", { instType: opts.instType, instId: opts.instId });
|
|
10555
|
-
const data =
|
|
9979
|
+
const data = getData2(result);
|
|
10556
9980
|
if (opts.json) return printJson(data);
|
|
10557
9981
|
const fee = data?.[0];
|
|
10558
9982
|
if (!fee) {
|
|
@@ -10570,7 +9994,7 @@ async function cmdAccountFees(run, opts) {
|
|
|
10570
9994
|
}
|
|
10571
9995
|
async function cmdAccountConfig(run, json) {
|
|
10572
9996
|
const result = await run("account_get_config", {});
|
|
10573
|
-
const data =
|
|
9997
|
+
const data = getData2(result);
|
|
10574
9998
|
if (json) return printJson(data);
|
|
10575
9999
|
const cfg = data?.[0];
|
|
10576
10000
|
if (!cfg) {
|
|
@@ -10589,14 +10013,14 @@ async function cmdAccountConfig(run, json) {
|
|
|
10589
10013
|
}
|
|
10590
10014
|
async function cmdAccountSetPositionMode(run, posMode, json) {
|
|
10591
10015
|
const result = await run("account_set_position_mode", { posMode });
|
|
10592
|
-
const data =
|
|
10016
|
+
const data = getData2(result);
|
|
10593
10017
|
if (json) return printJson(data);
|
|
10594
10018
|
const r = data?.[0];
|
|
10595
10019
|
outputLine(`Position mode set: ${r?.["posMode"]}`);
|
|
10596
10020
|
}
|
|
10597
10021
|
async function cmdAccountMaxSize(run, opts) {
|
|
10598
10022
|
const result = await run("account_get_max_size", { instId: opts.instId, tdMode: opts.tdMode, px: opts.px });
|
|
10599
|
-
const data =
|
|
10023
|
+
const data = getData2(result);
|
|
10600
10024
|
if (opts.json) return printJson(data);
|
|
10601
10025
|
const r = data?.[0];
|
|
10602
10026
|
if (!r) {
|
|
@@ -10607,7 +10031,7 @@ async function cmdAccountMaxSize(run, opts) {
|
|
|
10607
10031
|
}
|
|
10608
10032
|
async function cmdAccountMaxAvailSize(run, opts) {
|
|
10609
10033
|
const result = await run("account_get_max_avail_size", { instId: opts.instId, tdMode: opts.tdMode });
|
|
10610
|
-
const data =
|
|
10034
|
+
const data = getData2(result);
|
|
10611
10035
|
if (opts.json) return printJson(data);
|
|
10612
10036
|
const r = data?.[0];
|
|
10613
10037
|
if (!r) {
|
|
@@ -10618,7 +10042,7 @@ async function cmdAccountMaxAvailSize(run, opts) {
|
|
|
10618
10042
|
}
|
|
10619
10043
|
async function cmdAccountMaxWithdrawal(run, ccy, json) {
|
|
10620
10044
|
const result = await run("account_get_max_withdrawal", { ccy });
|
|
10621
|
-
const data =
|
|
10045
|
+
const data = getData2(result);
|
|
10622
10046
|
if (json) return printJson(data);
|
|
10623
10047
|
printTable(
|
|
10624
10048
|
(data ?? []).map((r) => ({
|
|
@@ -10630,7 +10054,7 @@ async function cmdAccountMaxWithdrawal(run, ccy, json) {
|
|
|
10630
10054
|
}
|
|
10631
10055
|
async function cmdAccountPositionsHistory(run, opts) {
|
|
10632
10056
|
const result = await run("account_get_positions_history", { instType: opts.instType, instId: opts.instId, limit: opts.limit });
|
|
10633
|
-
const data =
|
|
10057
|
+
const data = getData2(result);
|
|
10634
10058
|
if (opts.json) return printJson(data);
|
|
10635
10059
|
printTable(
|
|
10636
10060
|
(data ?? []).map((p) => ({
|
|
@@ -10652,7 +10076,7 @@ async function cmdAccountTransfer(run, opts) {
|
|
|
10652
10076
|
type: opts.transferType,
|
|
10653
10077
|
subAcct: opts.subAcct
|
|
10654
10078
|
});
|
|
10655
|
-
const data =
|
|
10079
|
+
const data = getData2(result);
|
|
10656
10080
|
if (opts.json) return printJson(data);
|
|
10657
10081
|
const r = data?.[0];
|
|
10658
10082
|
outputLine(`Transfer: ${r?.["transId"]} (${r?.["ccy"]} ${r?.["amt"]})`);
|
|
@@ -10712,7 +10136,7 @@ function cmdAccountAudit(opts) {
|
|
|
10712
10136
|
}
|
|
10713
10137
|
|
|
10714
10138
|
// src/commands/spot.ts
|
|
10715
|
-
function
|
|
10139
|
+
function getData3(result) {
|
|
10716
10140
|
return result.data;
|
|
10717
10141
|
}
|
|
10718
10142
|
function emitWriteResult(item, label, idKey) {
|
|
@@ -10736,7 +10160,7 @@ function emitBatchResults(items) {
|
|
|
10736
10160
|
}
|
|
10737
10161
|
async function cmdSpotOrders(run, opts) {
|
|
10738
10162
|
const result = await run("spot_get_orders", { instId: opts.instId, status: opts.status });
|
|
10739
|
-
const orders =
|
|
10163
|
+
const orders = getData3(result);
|
|
10740
10164
|
if (opts.json) return printJson(orders);
|
|
10741
10165
|
printTable(
|
|
10742
10166
|
(orders ?? []).map((o) => ({
|
|
@@ -10765,7 +10189,7 @@ async function cmdSpotPlace(run, opts) {
|
|
|
10765
10189
|
slTriggerPx: opts.slTriggerPx,
|
|
10766
10190
|
slOrdPx: opts.slOrdPx
|
|
10767
10191
|
});
|
|
10768
|
-
const data =
|
|
10192
|
+
const data = getData3(result);
|
|
10769
10193
|
if (opts.json) return printJson(data);
|
|
10770
10194
|
emitWriteResult(data?.[0], "Order placed", "ordId");
|
|
10771
10195
|
}
|
|
@@ -10773,7 +10197,7 @@ async function cmdSpotCancel(run, opts) {
|
|
|
10773
10197
|
const { instId, ordId, clOrdId, json } = opts;
|
|
10774
10198
|
if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
|
|
10775
10199
|
const result = await run("spot_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
|
|
10776
|
-
const data =
|
|
10200
|
+
const data = getData3(result);
|
|
10777
10201
|
if (json) return printJson(data);
|
|
10778
10202
|
emitWriteResult(data?.[0], "Cancelled", "ordId");
|
|
10779
10203
|
}
|
|
@@ -10793,7 +10217,7 @@ async function cmdSpotAlgoPlace(run, opts) {
|
|
|
10793
10217
|
callbackSpread: opts.callbackSpread,
|
|
10794
10218
|
activePx: opts.activePx
|
|
10795
10219
|
});
|
|
10796
|
-
const data =
|
|
10220
|
+
const data = getData3(result);
|
|
10797
10221
|
if (opts.json) return printJson(data);
|
|
10798
10222
|
emitWriteResult(data?.[0], "Algo order placed", "algoId");
|
|
10799
10223
|
}
|
|
@@ -10807,19 +10231,19 @@ async function cmdSpotAlgoAmend(run, opts) {
|
|
|
10807
10231
|
newSlTriggerPx: opts.newSlTriggerPx,
|
|
10808
10232
|
newSlOrdPx: opts.newSlOrdPx
|
|
10809
10233
|
});
|
|
10810
|
-
const data =
|
|
10234
|
+
const data = getData3(result);
|
|
10811
10235
|
if (opts.json) return printJson(data);
|
|
10812
10236
|
emitWriteResult(data?.[0], "Algo order amended", "algoId");
|
|
10813
10237
|
}
|
|
10814
10238
|
async function cmdSpotAlgoCancel(run, instId, algoId, json) {
|
|
10815
10239
|
const result = await run("spot_cancel_algo_order", { instId, algoId });
|
|
10816
|
-
const data =
|
|
10240
|
+
const data = getData3(result);
|
|
10817
10241
|
if (json) return printJson(data);
|
|
10818
10242
|
emitWriteResult(data?.[0], "Algo order cancelled", "algoId");
|
|
10819
10243
|
}
|
|
10820
10244
|
async function cmdSpotGet(run, opts) {
|
|
10821
10245
|
const result = await run("spot_get_order", { instId: opts.instId, ordId: opts.ordId, clOrdId: opts.clOrdId });
|
|
10822
|
-
const data =
|
|
10246
|
+
const data = getData3(result);
|
|
10823
10247
|
if (opts.json) return printJson(data);
|
|
10824
10248
|
const o = data?.[0];
|
|
10825
10249
|
if (!o) {
|
|
@@ -10847,7 +10271,7 @@ async function cmdSpotAmend(run, opts) {
|
|
|
10847
10271
|
newSz: opts.newSz,
|
|
10848
10272
|
newPx: opts.newPx
|
|
10849
10273
|
});
|
|
10850
|
-
const data =
|
|
10274
|
+
const data = getData3(result);
|
|
10851
10275
|
if (opts.json) return printJson(data);
|
|
10852
10276
|
emitWriteResult(data?.[0], "Order amended", "ordId");
|
|
10853
10277
|
}
|
|
@@ -10857,7 +10281,7 @@ async function cmdSpotAlgoOrders(run, opts) {
|
|
|
10857
10281
|
status: opts.status,
|
|
10858
10282
|
ordType: opts.ordType
|
|
10859
10283
|
});
|
|
10860
|
-
const orders =
|
|
10284
|
+
const orders = getData3(result);
|
|
10861
10285
|
if (opts.json) return printJson(orders);
|
|
10862
10286
|
if (!(orders ?? []).length) {
|
|
10863
10287
|
outputLine("No algo orders");
|
|
@@ -10878,7 +10302,7 @@ async function cmdSpotAlgoOrders(run, opts) {
|
|
|
10878
10302
|
}
|
|
10879
10303
|
async function cmdSpotFills(run, opts) {
|
|
10880
10304
|
const result = await run("spot_get_fills", { instId: opts.instId, ordId: opts.ordId });
|
|
10881
|
-
const fills =
|
|
10305
|
+
const fills = getData3(result);
|
|
10882
10306
|
if (opts.json) return printJson(fills);
|
|
10883
10307
|
printTable(
|
|
10884
10308
|
(fills ?? []).map((f) => ({
|
|
@@ -10902,7 +10326,7 @@ async function cmdSpotAlgoTrailPlace(run, opts) {
|
|
|
10902
10326
|
callbackSpread: opts.callbackSpread,
|
|
10903
10327
|
activePx: opts.activePx
|
|
10904
10328
|
});
|
|
10905
|
-
const data =
|
|
10329
|
+
const data = getData3(result);
|
|
10906
10330
|
if (opts.json) return printJson(data);
|
|
10907
10331
|
emitWriteResult(data?.[0], "Trailing stop placed", "algoId");
|
|
10908
10332
|
}
|
|
@@ -10932,13 +10356,13 @@ async function cmdSpotBatch(run, opts) {
|
|
|
10932
10356
|
return;
|
|
10933
10357
|
}
|
|
10934
10358
|
const result = await run(tool, tool === "spot_batch_orders" ? { action: opts.action, orders: parsed } : { orders: parsed });
|
|
10935
|
-
const data =
|
|
10359
|
+
const data = getData3(result);
|
|
10936
10360
|
if (opts.json) return printJson(data);
|
|
10937
10361
|
emitBatchResults(data ?? []);
|
|
10938
10362
|
}
|
|
10939
10363
|
|
|
10940
10364
|
// src/commands/swap.ts
|
|
10941
|
-
function
|
|
10365
|
+
function getData4(result) {
|
|
10942
10366
|
return result.data;
|
|
10943
10367
|
}
|
|
10944
10368
|
function emitWriteResult2(item, label, idKey) {
|
|
@@ -10962,7 +10386,7 @@ function emitBatchResults2(items) {
|
|
|
10962
10386
|
}
|
|
10963
10387
|
async function cmdSwapPositions(run, instId, json) {
|
|
10964
10388
|
const result = await run("swap_get_positions", { instId });
|
|
10965
|
-
const positions =
|
|
10389
|
+
const positions = getData4(result);
|
|
10966
10390
|
if (json) return printJson(positions);
|
|
10967
10391
|
const open = (positions ?? []).filter((p) => Number(p["pos"]) !== 0);
|
|
10968
10392
|
if (!open.length) {
|
|
@@ -10983,7 +10407,7 @@ async function cmdSwapPositions(run, instId, json) {
|
|
|
10983
10407
|
}
|
|
10984
10408
|
async function cmdSwapOrders(run, opts) {
|
|
10985
10409
|
const result = await run("swap_get_orders", { instId: opts.instId, status: opts.status });
|
|
10986
|
-
const orders =
|
|
10410
|
+
const orders = getData4(result);
|
|
10987
10411
|
if (opts.json) return printJson(orders);
|
|
10988
10412
|
printTable(
|
|
10989
10413
|
(orders ?? []).map((o) => ({
|
|
@@ -11013,7 +10437,7 @@ async function cmdSwapPlace(run, opts) {
|
|
|
11013
10437
|
slTriggerPx: opts.slTriggerPx,
|
|
11014
10438
|
slOrdPx: opts.slOrdPx
|
|
11015
10439
|
});
|
|
11016
|
-
const data =
|
|
10440
|
+
const data = getData4(result);
|
|
11017
10441
|
if (opts.json) return printJson(data);
|
|
11018
10442
|
emitWriteResult2(data?.[0], "Order placed", "ordId");
|
|
11019
10443
|
}
|
|
@@ -11021,7 +10445,7 @@ async function cmdSwapCancel(run, opts) {
|
|
|
11021
10445
|
const { instId, ordId, clOrdId, json } = opts;
|
|
11022
10446
|
if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
|
|
11023
10447
|
const result = await run("swap_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
|
|
11024
|
-
const data =
|
|
10448
|
+
const data = getData4(result);
|
|
11025
10449
|
if (json) return printJson(data);
|
|
11026
10450
|
emitWriteResult2(data?.[0], "Cancelled", "ordId");
|
|
11027
10451
|
}
|
|
@@ -11043,7 +10467,7 @@ async function cmdSwapAlgoPlace(run, opts) {
|
|
|
11043
10467
|
callbackSpread: opts.callbackSpread,
|
|
11044
10468
|
activePx: opts.activePx
|
|
11045
10469
|
});
|
|
11046
|
-
const data =
|
|
10470
|
+
const data = getData4(result);
|
|
11047
10471
|
if (opts.json) return printJson(data);
|
|
11048
10472
|
emitWriteResult2(data?.[0], "Algo order placed", "algoId");
|
|
11049
10473
|
}
|
|
@@ -11057,7 +10481,7 @@ async function cmdSwapAlgoAmend(run, opts) {
|
|
|
11057
10481
|
newSlTriggerPx: opts.newSlTriggerPx,
|
|
11058
10482
|
newSlOrdPx: opts.newSlOrdPx
|
|
11059
10483
|
});
|
|
11060
|
-
const data =
|
|
10484
|
+
const data = getData4(result);
|
|
11061
10485
|
if (opts.json) return printJson(data);
|
|
11062
10486
|
emitWriteResult2(data?.[0], "Algo order amended", "algoId");
|
|
11063
10487
|
}
|
|
@@ -11073,13 +10497,13 @@ async function cmdSwapAlgoTrailPlace(run, opts) {
|
|
|
11073
10497
|
posSide: opts.posSide,
|
|
11074
10498
|
reduceOnly: opts.reduceOnly
|
|
11075
10499
|
});
|
|
11076
|
-
const data =
|
|
10500
|
+
const data = getData4(result);
|
|
11077
10501
|
if (opts.json) return printJson(data);
|
|
11078
10502
|
emitWriteResult2(data?.[0], "Trailing stop placed", "algoId");
|
|
11079
10503
|
}
|
|
11080
10504
|
async function cmdSwapAlgoCancel(run, instId, algoId, json) {
|
|
11081
10505
|
const result = await run("swap_cancel_algo_orders", { orders: [{ instId, algoId }] });
|
|
11082
|
-
const data =
|
|
10506
|
+
const data = getData4(result);
|
|
11083
10507
|
if (json) return printJson(data);
|
|
11084
10508
|
emitWriteResult2(data?.[0], "Algo order cancelled", "algoId");
|
|
11085
10509
|
}
|
|
@@ -11089,7 +10513,7 @@ async function cmdSwapAlgoOrders(run, opts) {
|
|
|
11089
10513
|
status: opts.status,
|
|
11090
10514
|
ordType: opts.ordType
|
|
11091
10515
|
});
|
|
11092
|
-
const orders =
|
|
10516
|
+
const orders = getData4(result);
|
|
11093
10517
|
if (opts.json) return printJson(orders);
|
|
11094
10518
|
if (!(orders ?? []).length) {
|
|
11095
10519
|
outputLine("No algo orders");
|
|
@@ -11110,7 +10534,7 @@ async function cmdSwapAlgoOrders(run, opts) {
|
|
|
11110
10534
|
}
|
|
11111
10535
|
async function cmdSwapFills(run, opts) {
|
|
11112
10536
|
const result = await run("swap_get_fills", { instId: opts.instId, ordId: opts.ordId, archive: opts.archive });
|
|
11113
|
-
const fills =
|
|
10537
|
+
const fills = getData4(result);
|
|
11114
10538
|
if (opts.json) return printJson(fills);
|
|
11115
10539
|
printTable(
|
|
11116
10540
|
(fills ?? []).map((f) => ({
|
|
@@ -11125,7 +10549,7 @@ async function cmdSwapFills(run, opts) {
|
|
|
11125
10549
|
}
|
|
11126
10550
|
async function cmdSwapGet(run, opts) {
|
|
11127
10551
|
const result = await run("swap_get_order", { instId: opts.instId, ordId: opts.ordId, clOrdId: opts.clOrdId });
|
|
11128
|
-
const data =
|
|
10552
|
+
const data = getData4(result);
|
|
11129
10553
|
if (opts.json) return printJson(data);
|
|
11130
10554
|
const o = data?.[0];
|
|
11131
10555
|
if (!o) {
|
|
@@ -11153,14 +10577,14 @@ async function cmdSwapClose(run, opts) {
|
|
|
11153
10577
|
posSide: opts.posSide,
|
|
11154
10578
|
autoCxl: opts.autoCxl
|
|
11155
10579
|
});
|
|
11156
|
-
const data =
|
|
10580
|
+
const data = getData4(result);
|
|
11157
10581
|
if (opts.json) return printJson(data);
|
|
11158
10582
|
const r = data?.[0];
|
|
11159
10583
|
outputLine(`Position closed: ${r?.["instId"]} ${r?.["posSide"] ?? ""}`);
|
|
11160
10584
|
}
|
|
11161
10585
|
async function cmdSwapGetLeverage(run, opts) {
|
|
11162
10586
|
const result = await run("swap_get_leverage", { instId: opts.instId, mgnMode: opts.mgnMode });
|
|
11163
|
-
const data =
|
|
10587
|
+
const data = getData4(result);
|
|
11164
10588
|
if (opts.json) return printJson(data);
|
|
11165
10589
|
printTable(
|
|
11166
10590
|
(data ?? []).map((r) => ({
|
|
@@ -11179,7 +10603,7 @@ async function cmdSwapAmend(run, opts) {
|
|
|
11179
10603
|
newSz: opts.newSz,
|
|
11180
10604
|
newPx: opts.newPx
|
|
11181
10605
|
});
|
|
11182
|
-
const data =
|
|
10606
|
+
const data = getData4(result);
|
|
11183
10607
|
if (opts.json) return printJson(data);
|
|
11184
10608
|
emitWriteResult2(data?.[0], "Order amended", "ordId");
|
|
11185
10609
|
}
|
|
@@ -11190,7 +10614,7 @@ async function cmdSwapSetLeverage(run, opts) {
|
|
|
11190
10614
|
mgnMode: opts.mgnMode,
|
|
11191
10615
|
posSide: opts.posSide
|
|
11192
10616
|
});
|
|
11193
|
-
const data =
|
|
10617
|
+
const data = getData4(result);
|
|
11194
10618
|
if (opts.json) return printJson(data);
|
|
11195
10619
|
const r = data?.[0];
|
|
11196
10620
|
outputLine(`Leverage set: ${r?.["lever"]}x ${r?.["instId"]}`);
|
|
@@ -11221,13 +10645,13 @@ async function cmdSwapBatch(run, opts) {
|
|
|
11221
10645
|
return;
|
|
11222
10646
|
}
|
|
11223
10647
|
const result = await run(tool, tool === "swap_batch_orders" ? { action: opts.action, orders: parsed } : { orders: parsed });
|
|
11224
|
-
const data =
|
|
10648
|
+
const data = getData4(result);
|
|
11225
10649
|
if (opts.json) return printJson(data);
|
|
11226
10650
|
emitBatchResults2(data ?? []);
|
|
11227
10651
|
}
|
|
11228
10652
|
|
|
11229
10653
|
// src/commands/futures.ts
|
|
11230
|
-
function
|
|
10654
|
+
function getData5(result) {
|
|
11231
10655
|
return result.data;
|
|
11232
10656
|
}
|
|
11233
10657
|
function emitWriteResult3(item, label, idKey) {
|
|
@@ -11251,7 +10675,7 @@ function emitBatchResults3(items) {
|
|
|
11251
10675
|
}
|
|
11252
10676
|
async function cmdFuturesOrders(run, opts) {
|
|
11253
10677
|
const result = await run("futures_get_orders", { instId: opts.instId, status: opts.status });
|
|
11254
|
-
const orders =
|
|
10678
|
+
const orders = getData5(result);
|
|
11255
10679
|
if (opts.json) return printJson(orders);
|
|
11256
10680
|
printTable(
|
|
11257
10681
|
(orders ?? []).map((o) => ({
|
|
@@ -11268,7 +10692,7 @@ async function cmdFuturesOrders(run, opts) {
|
|
|
11268
10692
|
}
|
|
11269
10693
|
async function cmdFuturesPositions(run, instId, json) {
|
|
11270
10694
|
const result = await run("futures_get_positions", { instId });
|
|
11271
|
-
const positions =
|
|
10695
|
+
const positions = getData5(result);
|
|
11272
10696
|
if (json) return printJson(positions);
|
|
11273
10697
|
const open = (positions ?? []).filter((p) => Number(p["pos"]) !== 0);
|
|
11274
10698
|
if (!open.length) {
|
|
@@ -11288,7 +10712,7 @@ async function cmdFuturesPositions(run, instId, json) {
|
|
|
11288
10712
|
}
|
|
11289
10713
|
async function cmdFuturesFills(run, opts) {
|
|
11290
10714
|
const result = await run("futures_get_fills", { instId: opts.instId, ordId: opts.ordId, archive: opts.archive });
|
|
11291
|
-
const fills =
|
|
10715
|
+
const fills = getData5(result);
|
|
11292
10716
|
if (opts.json) return printJson(fills);
|
|
11293
10717
|
printTable(
|
|
11294
10718
|
(fills ?? []).map((f) => ({
|
|
@@ -11317,7 +10741,7 @@ async function cmdFuturesPlace(run, opts) {
|
|
|
11317
10741
|
slTriggerPx: opts.slTriggerPx,
|
|
11318
10742
|
slOrdPx: opts.slOrdPx
|
|
11319
10743
|
});
|
|
11320
|
-
const data =
|
|
10744
|
+
const data = getData5(result);
|
|
11321
10745
|
if (opts.json) return printJson(data);
|
|
11322
10746
|
emitWriteResult3(data?.[0], "Order placed", "ordId");
|
|
11323
10747
|
}
|
|
@@ -11325,13 +10749,13 @@ async function cmdFuturesCancel(run, opts) {
|
|
|
11325
10749
|
const { instId, ordId, clOrdId, json } = opts;
|
|
11326
10750
|
if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
|
|
11327
10751
|
const result = await run("futures_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
|
|
11328
|
-
const data =
|
|
10752
|
+
const data = getData5(result);
|
|
11329
10753
|
if (json) return printJson(data);
|
|
11330
10754
|
emitWriteResult3(data?.[0], "Cancelled", "ordId");
|
|
11331
10755
|
}
|
|
11332
10756
|
async function cmdFuturesGet(run, opts) {
|
|
11333
10757
|
const result = await run("futures_get_order", { instId: opts.instId, ordId: opts.ordId });
|
|
11334
|
-
const data =
|
|
10758
|
+
const data = getData5(result);
|
|
11335
10759
|
if (opts.json) return printJson(data);
|
|
11336
10760
|
const o = data?.[0];
|
|
11337
10761
|
if (!o) {
|
|
@@ -11360,7 +10784,7 @@ async function cmdFuturesAmend(run, opts) {
|
|
|
11360
10784
|
newSz: opts.newSz,
|
|
11361
10785
|
newPx: opts.newPx
|
|
11362
10786
|
});
|
|
11363
|
-
const data =
|
|
10787
|
+
const data = getData5(result);
|
|
11364
10788
|
if (opts.json) return printJson(data);
|
|
11365
10789
|
emitWriteResult3(data?.[0], "Order amended", "ordId");
|
|
11366
10790
|
}
|
|
@@ -11371,7 +10795,7 @@ async function cmdFuturesClose(run, opts) {
|
|
|
11371
10795
|
posSide: opts.posSide,
|
|
11372
10796
|
autoCxl: opts.autoCxl
|
|
11373
10797
|
});
|
|
11374
|
-
const data =
|
|
10798
|
+
const data = getData5(result);
|
|
11375
10799
|
if (opts.json) return printJson(data);
|
|
11376
10800
|
const r = data?.[0];
|
|
11377
10801
|
outputLine(`Position closed: ${r?.["instId"]} ${r?.["posSide"] ?? ""}`);
|
|
@@ -11383,14 +10807,14 @@ async function cmdFuturesSetLeverage(run, opts) {
|
|
|
11383
10807
|
mgnMode: opts.mgnMode,
|
|
11384
10808
|
posSide: opts.posSide
|
|
11385
10809
|
});
|
|
11386
|
-
const data =
|
|
10810
|
+
const data = getData5(result);
|
|
11387
10811
|
if (opts.json) return printJson(data);
|
|
11388
10812
|
const r = data?.[0];
|
|
11389
10813
|
outputLine(`Leverage set: ${r?.["lever"]}x ${r?.["instId"]}`);
|
|
11390
10814
|
}
|
|
11391
10815
|
async function cmdFuturesGetLeverage(run, opts) {
|
|
11392
10816
|
const result = await run("futures_get_leverage", { instId: opts.instId, mgnMode: opts.mgnMode });
|
|
11393
|
-
const data =
|
|
10817
|
+
const data = getData5(result);
|
|
11394
10818
|
if (opts.json) return printJson(data);
|
|
11395
10819
|
printTable(
|
|
11396
10820
|
(data ?? []).map((r) => ({
|
|
@@ -11427,7 +10851,7 @@ async function cmdFuturesBatch(run, opts) {
|
|
|
11427
10851
|
return;
|
|
11428
10852
|
}
|
|
11429
10853
|
const result = await run(tool, { orders: parsed });
|
|
11430
|
-
const data =
|
|
10854
|
+
const data = getData5(result);
|
|
11431
10855
|
if (opts.json) return printJson(data);
|
|
11432
10856
|
emitBatchResults3(data ?? []);
|
|
11433
10857
|
}
|
|
@@ -11449,7 +10873,7 @@ async function cmdFuturesAlgoPlace(run, opts) {
|
|
|
11449
10873
|
callbackSpread: opts.callbackSpread,
|
|
11450
10874
|
activePx: opts.activePx
|
|
11451
10875
|
});
|
|
11452
|
-
const data =
|
|
10876
|
+
const data = getData5(result);
|
|
11453
10877
|
if (opts.json) return printJson(data);
|
|
11454
10878
|
emitWriteResult3(data?.[0], "Algo order placed", "algoId");
|
|
11455
10879
|
}
|
|
@@ -11465,7 +10889,7 @@ async function cmdFuturesAlgoTrailPlace(run, opts) {
|
|
|
11465
10889
|
posSide: opts.posSide,
|
|
11466
10890
|
reduceOnly: opts.reduceOnly
|
|
11467
10891
|
});
|
|
11468
|
-
const data =
|
|
10892
|
+
const data = getData5(result);
|
|
11469
10893
|
if (opts.json) return printJson(data);
|
|
11470
10894
|
emitWriteResult3(data?.[0], "Trailing stop placed", "algoId");
|
|
11471
10895
|
}
|
|
@@ -11479,13 +10903,13 @@ async function cmdFuturesAlgoAmend(run, opts) {
|
|
|
11479
10903
|
newSlTriggerPx: opts.newSlTriggerPx,
|
|
11480
10904
|
newSlOrdPx: opts.newSlOrdPx
|
|
11481
10905
|
});
|
|
11482
|
-
const data =
|
|
10906
|
+
const data = getData5(result);
|
|
11483
10907
|
if (opts.json) return printJson(data);
|
|
11484
10908
|
emitWriteResult3(data?.[0], "Algo order amended", "algoId");
|
|
11485
10909
|
}
|
|
11486
10910
|
async function cmdFuturesAlgoCancel(run, instId, algoId, json) {
|
|
11487
10911
|
const result = await run("futures_cancel_algo_orders", { orders: [{ instId, algoId }] });
|
|
11488
|
-
const data =
|
|
10912
|
+
const data = getData5(result);
|
|
11489
10913
|
if (json) return printJson(data);
|
|
11490
10914
|
emitWriteResult3(data?.[0], "Algo order cancelled", "algoId");
|
|
11491
10915
|
}
|
|
@@ -11495,7 +10919,7 @@ async function cmdFuturesAlgoOrders(run, opts) {
|
|
|
11495
10919
|
status: opts.status,
|
|
11496
10920
|
ordType: opts.ordType
|
|
11497
10921
|
});
|
|
11498
|
-
const orders =
|
|
10922
|
+
const orders = getData5(result);
|
|
11499
10923
|
if (opts.json) return printJson(orders);
|
|
11500
10924
|
if (!(orders ?? []).length) {
|
|
11501
10925
|
outputLine("No algo orders");
|
|
@@ -11516,7 +10940,7 @@ async function cmdFuturesAlgoOrders(run, opts) {
|
|
|
11516
10940
|
}
|
|
11517
10941
|
|
|
11518
10942
|
// src/commands/option.ts
|
|
11519
|
-
function
|
|
10943
|
+
function getData6(result) {
|
|
11520
10944
|
return result.data;
|
|
11521
10945
|
}
|
|
11522
10946
|
function emitWriteResult4(item, label, idKey) {
|
|
@@ -11544,7 +10968,7 @@ async function cmdOptionOrders(run, opts) {
|
|
|
11544
10968
|
uly: opts.uly,
|
|
11545
10969
|
status: opts.status
|
|
11546
10970
|
});
|
|
11547
|
-
const orders =
|
|
10971
|
+
const orders = getData6(result);
|
|
11548
10972
|
if (opts.json) return printJson(orders);
|
|
11549
10973
|
printTable(
|
|
11550
10974
|
(orders ?? []).map((o) => ({
|
|
@@ -11564,7 +10988,7 @@ async function cmdOptionGet(run, opts) {
|
|
|
11564
10988
|
ordId: opts.ordId,
|
|
11565
10989
|
clOrdId: opts.clOrdId
|
|
11566
10990
|
});
|
|
11567
|
-
const data =
|
|
10991
|
+
const data = getData6(result);
|
|
11568
10992
|
if (opts.json) return printJson(data);
|
|
11569
10993
|
const o = data?.[0];
|
|
11570
10994
|
if (!o) {
|
|
@@ -11589,7 +11013,7 @@ async function cmdOptionPositions(run, opts) {
|
|
|
11589
11013
|
instId: opts.instId,
|
|
11590
11014
|
uly: opts.uly
|
|
11591
11015
|
});
|
|
11592
|
-
const positions =
|
|
11016
|
+
const positions = getData6(result);
|
|
11593
11017
|
if (opts.json) return printJson(positions);
|
|
11594
11018
|
const open = (positions ?? []).filter((p) => Number(p["pos"]) !== 0);
|
|
11595
11019
|
if (!open.length) {
|
|
@@ -11616,7 +11040,7 @@ async function cmdOptionFills(run, opts) {
|
|
|
11616
11040
|
ordId: opts.ordId,
|
|
11617
11041
|
archive: opts.archive
|
|
11618
11042
|
});
|
|
11619
|
-
const fills =
|
|
11043
|
+
const fills = getData6(result);
|
|
11620
11044
|
if (opts.json) return printJson(fills);
|
|
11621
11045
|
printTable(
|
|
11622
11046
|
(fills ?? []).map((f) => ({
|
|
@@ -11634,7 +11058,7 @@ async function cmdOptionInstruments(run, opts) {
|
|
|
11634
11058
|
uly: opts.uly,
|
|
11635
11059
|
expTime: opts.expTime
|
|
11636
11060
|
});
|
|
11637
|
-
const instruments =
|
|
11061
|
+
const instruments = getData6(result);
|
|
11638
11062
|
if (opts.json) return printJson(instruments);
|
|
11639
11063
|
printTable(
|
|
11640
11064
|
(instruments ?? []).map((i) => ({
|
|
@@ -11652,7 +11076,7 @@ async function cmdOptionGreeks(run, opts) {
|
|
|
11652
11076
|
uly: opts.uly,
|
|
11653
11077
|
expTime: opts.expTime
|
|
11654
11078
|
});
|
|
11655
|
-
const greeks =
|
|
11079
|
+
const greeks = getData6(result);
|
|
11656
11080
|
if (opts.json) return printJson(greeks);
|
|
11657
11081
|
printTable(
|
|
11658
11082
|
(greeks ?? []).map((g) => ({
|
|
@@ -11681,7 +11105,7 @@ async function cmdOptionPlace(run, opts) {
|
|
|
11681
11105
|
slTriggerPx: opts.slTriggerPx,
|
|
11682
11106
|
slOrdPx: opts.slOrdPx
|
|
11683
11107
|
});
|
|
11684
|
-
const data =
|
|
11108
|
+
const data = getData6(result);
|
|
11685
11109
|
if (opts.json) return printJson(data);
|
|
11686
11110
|
emitWriteResult4(data?.[0], "Order placed", "ordId");
|
|
11687
11111
|
}
|
|
@@ -11691,7 +11115,7 @@ async function cmdOptionCancel(run, opts) {
|
|
|
11691
11115
|
ordId: opts.ordId,
|
|
11692
11116
|
clOrdId: opts.clOrdId
|
|
11693
11117
|
});
|
|
11694
|
-
const data =
|
|
11118
|
+
const data = getData6(result);
|
|
11695
11119
|
if (opts.json) return printJson(data);
|
|
11696
11120
|
emitWriteResult4(data?.[0], "Cancelled", "ordId");
|
|
11697
11121
|
}
|
|
@@ -11703,7 +11127,7 @@ async function cmdOptionAmend(run, opts) {
|
|
|
11703
11127
|
newSz: opts.newSz,
|
|
11704
11128
|
newPx: opts.newPx
|
|
11705
11129
|
});
|
|
11706
|
-
const data =
|
|
11130
|
+
const data = getData6(result);
|
|
11707
11131
|
if (opts.json) return printJson(data);
|
|
11708
11132
|
emitWriteResult4(data?.[0], "Amended", "ordId");
|
|
11709
11133
|
}
|
|
@@ -11722,7 +11146,7 @@ async function cmdOptionBatchCancel(run, opts) {
|
|
|
11722
11146
|
return;
|
|
11723
11147
|
}
|
|
11724
11148
|
const result = await run("option_batch_cancel", { orders: parsed });
|
|
11725
|
-
const data =
|
|
11149
|
+
const data = getData6(result);
|
|
11726
11150
|
if (opts.json) return printJson(data);
|
|
11727
11151
|
emitBatchResults4(data ?? []);
|
|
11728
11152
|
}
|
|
@@ -11741,7 +11165,7 @@ async function cmdOptionAlgoPlace(run, opts) {
|
|
|
11741
11165
|
reduceOnly: opts.reduceOnly,
|
|
11742
11166
|
clOrdId: opts.clOrdId
|
|
11743
11167
|
});
|
|
11744
|
-
const data =
|
|
11168
|
+
const data = getData6(result);
|
|
11745
11169
|
if (opts.json) return printJson(data);
|
|
11746
11170
|
emitWriteResult4(data?.[0], "Algo order placed", "algoId");
|
|
11747
11171
|
}
|
|
@@ -11755,13 +11179,13 @@ async function cmdOptionAlgoAmend(run, opts) {
|
|
|
11755
11179
|
newSlTriggerPx: opts.newSlTriggerPx,
|
|
11756
11180
|
newSlOrdPx: opts.newSlOrdPx
|
|
11757
11181
|
});
|
|
11758
|
-
const data =
|
|
11182
|
+
const data = getData6(result);
|
|
11759
11183
|
if (opts.json) return printJson(data);
|
|
11760
11184
|
emitWriteResult4(data?.[0], "Algo order amended", "algoId");
|
|
11761
11185
|
}
|
|
11762
11186
|
async function cmdOptionAlgoCancel(run, opts) {
|
|
11763
11187
|
const result = await run("option_cancel_algo_orders", { orders: [{ instId: opts.instId, algoId: opts.algoId }] });
|
|
11764
|
-
const data =
|
|
11188
|
+
const data = getData6(result);
|
|
11765
11189
|
if (opts.json) return printJson(data);
|
|
11766
11190
|
emitWriteResult4(data?.[0], "Algo order cancelled", "algoId");
|
|
11767
11191
|
}
|
|
@@ -11771,7 +11195,7 @@ async function cmdOptionAlgoOrders(run, opts) {
|
|
|
11771
11195
|
status: opts.status,
|
|
11772
11196
|
ordType: opts.ordType
|
|
11773
11197
|
});
|
|
11774
|
-
const orders =
|
|
11198
|
+
const orders = getData6(result);
|
|
11775
11199
|
if (opts.json) return printJson(orders);
|
|
11776
11200
|
if (!(orders ?? []).length) {
|
|
11777
11201
|
outputLine("No algo orders");
|
|
@@ -12290,7 +11714,7 @@ function emitWriteResult5(item, label, idKey) {
|
|
|
12290
11714
|
outputLine(`${label}: ${item?.[idKey]} (OK)`);
|
|
12291
11715
|
}
|
|
12292
11716
|
}
|
|
12293
|
-
function
|
|
11717
|
+
function getData7(result) {
|
|
12294
11718
|
return result.data;
|
|
12295
11719
|
}
|
|
12296
11720
|
async function cmdGridOrders(run, opts) {
|
|
@@ -12300,7 +11724,7 @@ async function cmdGridOrders(run, opts) {
|
|
|
12300
11724
|
algoId: opts.algoId,
|
|
12301
11725
|
status: opts.status
|
|
12302
11726
|
});
|
|
12303
|
-
const orders =
|
|
11727
|
+
const orders = getData7(result) ?? [];
|
|
12304
11728
|
if (opts.json) return printJson(orders);
|
|
12305
11729
|
if (!orders.length) {
|
|
12306
11730
|
outputLine("No grid bots");
|
|
@@ -12325,7 +11749,7 @@ async function cmdGridDetails(run, opts) {
|
|
|
12325
11749
|
algoOrdType: opts.algoOrdType,
|
|
12326
11750
|
algoId: opts.algoId
|
|
12327
11751
|
});
|
|
12328
|
-
const detail = (
|
|
11752
|
+
const detail = (getData7(result) ?? [])[0];
|
|
12329
11753
|
if (!detail) {
|
|
12330
11754
|
outputLine("Bot not found");
|
|
12331
11755
|
return;
|
|
@@ -12353,7 +11777,7 @@ async function cmdGridSubOrders(run, opts) {
|
|
|
12353
11777
|
algoId: opts.algoId,
|
|
12354
11778
|
type: opts.type
|
|
12355
11779
|
});
|
|
12356
|
-
const orders =
|
|
11780
|
+
const orders = getData7(result) ?? [];
|
|
12357
11781
|
if (opts.json) return printJson(orders);
|
|
12358
11782
|
if (!orders.length) {
|
|
12359
11783
|
outputLine("No sub-orders");
|
|
@@ -12392,7 +11816,7 @@ async function cmdGridCreate(run, opts) {
|
|
|
12392
11816
|
slRatio: opts.slRatio,
|
|
12393
11817
|
algoClOrdId: opts.algoClOrdId
|
|
12394
11818
|
});
|
|
12395
|
-
const data =
|
|
11819
|
+
const data = getData7(result);
|
|
12396
11820
|
if (opts.json) return printJson(data);
|
|
12397
11821
|
emitWriteResult5(data?.[0], "Grid bot created", "algoId");
|
|
12398
11822
|
}
|
|
@@ -12403,7 +11827,7 @@ async function cmdGridStop(run, opts) {
|
|
|
12403
11827
|
instId: opts.instId,
|
|
12404
11828
|
stopType: opts.stopType
|
|
12405
11829
|
});
|
|
12406
|
-
const data =
|
|
11830
|
+
const data = getData7(result);
|
|
12407
11831
|
if (opts.json) return printJson(data);
|
|
12408
11832
|
emitWriteResult5(data?.[0], "Grid bot stopped", "algoId");
|
|
12409
11833
|
}
|
|
@@ -12433,7 +11857,7 @@ async function cmdDcaCreate(run, opts) {
|
|
|
12433
11857
|
reserveFunds: opts.reserveFunds,
|
|
12434
11858
|
tradeQuoteCcy: opts.tradeQuoteCcy
|
|
12435
11859
|
});
|
|
12436
|
-
const data =
|
|
11860
|
+
const data = getData7(result);
|
|
12437
11861
|
if (opts.json) return printJson(data);
|
|
12438
11862
|
emitWriteResult5(data?.[0], "DCA bot created", "algoId");
|
|
12439
11863
|
}
|
|
@@ -12443,7 +11867,7 @@ async function cmdDcaStop(run, opts) {
|
|
|
12443
11867
|
algoOrdType: opts.algoOrdType,
|
|
12444
11868
|
stopType: opts.stopType
|
|
12445
11869
|
});
|
|
12446
|
-
const data =
|
|
11870
|
+
const data = getData7(result);
|
|
12447
11871
|
if (opts.json) return printJson(data);
|
|
12448
11872
|
emitWriteResult5(data?.[0], "DCA bot stopped", "algoId");
|
|
12449
11873
|
}
|
|
@@ -12454,7 +11878,7 @@ async function cmdDcaOrders(run, opts) {
|
|
|
12454
11878
|
algoId: opts.algoId,
|
|
12455
11879
|
instId: opts.instId
|
|
12456
11880
|
});
|
|
12457
|
-
const orders =
|
|
11881
|
+
const orders = getData7(result) ?? [];
|
|
12458
11882
|
if (opts.json) return printJson(orders);
|
|
12459
11883
|
if (!orders.length) {
|
|
12460
11884
|
outputLine("No DCA bots");
|
|
@@ -12477,7 +11901,7 @@ async function cmdDcaDetails(run, opts) {
|
|
|
12477
11901
|
algoId: opts.algoId,
|
|
12478
11902
|
algoOrdType: opts.algoOrdType
|
|
12479
11903
|
});
|
|
12480
|
-
const detail = (
|
|
11904
|
+
const detail = (getData7(result) ?? [])[0];
|
|
12481
11905
|
if (!detail) {
|
|
12482
11906
|
outputLine("DCA bot not found");
|
|
12483
11907
|
return;
|
|
@@ -12506,7 +11930,7 @@ async function cmdDcaSubOrders(run, opts) {
|
|
|
12506
11930
|
algoOrdType: opts.algoOrdType,
|
|
12507
11931
|
cycleId: opts.cycleId
|
|
12508
11932
|
});
|
|
12509
|
-
const rows =
|
|
11933
|
+
const rows = getData7(result) ?? [];
|
|
12510
11934
|
if (opts.json) return printJson(rows);
|
|
12511
11935
|
if (!rows.length) {
|
|
12512
11936
|
outputLine("No sub-orders");
|
|
@@ -13022,7 +12446,7 @@ function cmdSkillList(json) {
|
|
|
13022
12446
|
// src/index.ts
|
|
13023
12447
|
var _require3 = createRequire3(import.meta.url);
|
|
13024
12448
|
var CLI_VERSION2 = _require3("../package.json").version;
|
|
13025
|
-
var GIT_HASH2 = true ? "
|
|
12449
|
+
var GIT_HASH2 = true ? "0b9b3b7" : "dev";
|
|
13026
12450
|
function handleConfigCommand(action, rest, json, lang, force) {
|
|
13027
12451
|
if (action === "init") return cmdConfigInit(lang === "zh" ? "zh" : "en");
|
|
13028
12452
|
if (action === "show") return cmdConfigShow(json);
|
|
@@ -13788,36 +13212,6 @@ function handleEarnDcdCommand(run, action, v, json) {
|
|
|
13788
13212
|
errorLine("Valid: pairs, products, quote-and-buy, redeem-execute, order, orders");
|
|
13789
13213
|
process.exitCode = 1;
|
|
13790
13214
|
}
|
|
13791
|
-
function handleNewsCommand(run, action, rest, v, json) {
|
|
13792
|
-
const limit = v.limit !== void 0 ? Number(v.limit) : void 0;
|
|
13793
|
-
const begin = v.begin !== void 0 ? Number(v.begin) : void 0;
|
|
13794
|
-
const end = v.end !== void 0 ? Number(v.end) : void 0;
|
|
13795
|
-
const language = v.lang;
|
|
13796
|
-
const detailLvl = v["detail-lvl"];
|
|
13797
|
-
const after = v.after;
|
|
13798
|
-
const period = v.period;
|
|
13799
|
-
const points = v.points !== void 0 ? Number(v.points) : 24;
|
|
13800
|
-
const sortBy = v["sort-by"];
|
|
13801
|
-
const searchOpts = { coins: v.coins, importance: v.importance, sentiment: v.sentiment, sortBy, begin, end, language, detailLvl, limit, after, json };
|
|
13802
|
-
const listOpts = { coins: v.coins, importance: v.importance, begin, end, language, detailLvl, limit, after, json };
|
|
13803
|
-
const dispatch = {
|
|
13804
|
-
latest: () => cmdNewsLatest(run, listOpts),
|
|
13805
|
-
important: () => cmdNewsImportant(run, { coins: v.coins, begin, end, language, detailLvl, limit, json }),
|
|
13806
|
-
"by-coin": () => cmdNewsByCoin(run, v.coins ?? rest[0], { importance: v.importance, begin, end, language, detailLvl, limit, json }),
|
|
13807
|
-
search: () => cmdNewsSearch(run, v.keyword ?? rest[0], searchOpts),
|
|
13808
|
-
detail: () => cmdNewsDetail(run, rest[0], { language, json }),
|
|
13809
|
-
domains: () => cmdNewsDomains(run, { json }),
|
|
13810
|
-
"coin-sentiment": () => cmdNewsCoinSentiment(run, v.coins ?? rest[0], { period, json }),
|
|
13811
|
-
"coin-trend": () => cmdNewsCoinTrend(run, rest[0], { period, points, json }),
|
|
13812
|
-
"by-sentiment": () => cmdNewsSearch(run, "", { ...searchOpts, sentiment: v.sentiment ?? rest[0], sortBy: sortBy ?? "latest" }),
|
|
13813
|
-
"sentiment-rank": () => cmdNewsSentimentRank(run, { period, sortBy, limit, json })
|
|
13814
|
-
};
|
|
13815
|
-
const handler = dispatch[action];
|
|
13816
|
-
if (handler) return handler();
|
|
13817
|
-
process.stderr.write(`Unknown news command: ${action}
|
|
13818
|
-
`);
|
|
13819
|
-
process.exitCode = 1;
|
|
13820
|
-
}
|
|
13821
13215
|
function requireSkillName(rest, usage) {
|
|
13822
13216
|
const name = rest[0];
|
|
13823
13217
|
if (!name) {
|
|
@@ -13914,7 +13308,6 @@ async function main() {
|
|
|
13914
13308
|
swap: () => handleSwapCommand(run, action, rest, v, json),
|
|
13915
13309
|
futures: () => handleFuturesCommand(run, action, rest, v, json),
|
|
13916
13310
|
option: () => handleOptionCommand(run, action, rest, v, json),
|
|
13917
|
-
news: () => handleNewsCommand(run, action, rest, v, json),
|
|
13918
13311
|
bot: () => handleBotCommand(run, action, rest, v, json),
|
|
13919
13312
|
earn: () => handleEarnCommand(run, action, rest, v, json),
|
|
13920
13313
|
skill: () => handleSkillCommand(run, action, rest, v, json, config)
|
|
@@ -13944,7 +13337,6 @@ export {
|
|
|
13944
13337
|
handleMarketCommand,
|
|
13945
13338
|
handleMarketDataCommand,
|
|
13946
13339
|
handleMarketPublicCommand,
|
|
13947
|
-
handleNewsCommand,
|
|
13948
13340
|
handleOptionAlgoCommand,
|
|
13949
13341
|
handleOptionCommand,
|
|
13950
13342
|
handleSetupCommand,
|