@okx_ai/okx-trade-cli 1.2.5-beta.4 → 1.2.5-beta.5
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 +36 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7327,7 +7327,7 @@ async function cmdDiagnoseMcp(options = {}) {
|
|
|
7327
7327
|
|
|
7328
7328
|
// src/commands/diagnose.ts
|
|
7329
7329
|
var CLI_VERSION = readCliVersion();
|
|
7330
|
-
var GIT_HASH = true ? "
|
|
7330
|
+
var GIT_HASH = true ? "3157372" : "dev";
|
|
7331
7331
|
function maskKey2(key) {
|
|
7332
7332
|
if (!key) return "(not set)";
|
|
7333
7333
|
if (key.length <= 8) return "****";
|
|
@@ -8992,8 +8992,10 @@ async function cmdSpotPlace(run, opts) {
|
|
|
8992
8992
|
process.stdout.write(`Order placed: ${order?.["ordId"]} (${order?.["sCode"] === "0" ? "OK" : order?.["sMsg"]})
|
|
8993
8993
|
`);
|
|
8994
8994
|
}
|
|
8995
|
-
async function cmdSpotCancel(run,
|
|
8996
|
-
const
|
|
8995
|
+
async function cmdSpotCancel(run, opts) {
|
|
8996
|
+
const { instId, ordId, clOrdId, json } = opts;
|
|
8997
|
+
if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
|
|
8998
|
+
const result = await run("spot_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
|
|
8997
8999
|
const data = getData3(result);
|
|
8998
9000
|
if (json) return printJson(data);
|
|
8999
9001
|
const r = data?.[0];
|
|
@@ -9243,8 +9245,10 @@ async function cmdSwapPlace(run, opts) {
|
|
|
9243
9245
|
process.stdout.write(`Order placed: ${order?.["ordId"]} (${order?.["sCode"] === "0" ? "OK" : order?.["sMsg"]})
|
|
9244
9246
|
`);
|
|
9245
9247
|
}
|
|
9246
|
-
async function cmdSwapCancel(run,
|
|
9247
|
-
const
|
|
9248
|
+
async function cmdSwapCancel(run, opts) {
|
|
9249
|
+
const { instId, ordId, clOrdId, json } = opts;
|
|
9250
|
+
if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
|
|
9251
|
+
const result = await run("swap_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
|
|
9248
9252
|
const data = getData4(result);
|
|
9249
9253
|
if (json) return printJson(data);
|
|
9250
9254
|
const r = data?.[0];
|
|
@@ -9552,8 +9556,10 @@ async function cmdFuturesPlace(run, opts) {
|
|
|
9552
9556
|
process.stdout.write(`Order placed: ${order?.["ordId"]} (${order?.["sCode"] === "0" ? "OK" : order?.["sMsg"]})
|
|
9553
9557
|
`);
|
|
9554
9558
|
}
|
|
9555
|
-
async function cmdFuturesCancel(run,
|
|
9556
|
-
const
|
|
9559
|
+
async function cmdFuturesCancel(run, opts) {
|
|
9560
|
+
const { instId, ordId, clOrdId, json } = opts;
|
|
9561
|
+
if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
|
|
9562
|
+
const result = await run("futures_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
|
|
9557
9563
|
const data = getData5(result);
|
|
9558
9564
|
if (json) return printJson(data);
|
|
9559
9565
|
const r = data?.[0];
|
|
@@ -11002,7 +11008,7 @@ async function cmdDcdQuoteAndBuy(run, opts) {
|
|
|
11002
11008
|
// src/index.ts
|
|
11003
11009
|
var _require3 = createRequire3(import.meta.url);
|
|
11004
11010
|
var CLI_VERSION2 = _require3("../package.json").version;
|
|
11005
|
-
var GIT_HASH2 = true ? "
|
|
11011
|
+
var GIT_HASH2 = true ? "3157372" : "dev";
|
|
11006
11012
|
function handleConfigCommand(action, rest, json, lang, force) {
|
|
11007
11013
|
if (action === "init") return cmdConfigInit(lang === "zh" ? "zh" : "en");
|
|
11008
11014
|
if (action === "show") return cmdConfigShow(json);
|
|
@@ -11197,7 +11203,7 @@ function handleSpotCommand(run, action, rest, v, json) {
|
|
|
11197
11203
|
json
|
|
11198
11204
|
});
|
|
11199
11205
|
if (action === "cancel")
|
|
11200
|
-
return cmdSpotCancel(run, v.instId, v.ordId, json);
|
|
11206
|
+
return cmdSpotCancel(run, { instId: v.instId ?? rest[0], ordId: v.ordId, clOrdId: v.clOrdId, json });
|
|
11201
11207
|
if (action === "algo")
|
|
11202
11208
|
return handleSpotAlgoCommand(run, rest[0], v, json);
|
|
11203
11209
|
if (action === "batch")
|
|
@@ -11256,9 +11262,9 @@ function handleSwapAlgoCommand(run, subAction, v, json) {
|
|
|
11256
11262
|
json
|
|
11257
11263
|
});
|
|
11258
11264
|
}
|
|
11259
|
-
function
|
|
11265
|
+
function handleSwapQuery(run, action, rest, v, json) {
|
|
11260
11266
|
if (action === "positions")
|
|
11261
|
-
return cmdSwapPositions(run, rest[0]
|
|
11267
|
+
return cmdSwapPositions(run, v.instId ?? rest[0], json);
|
|
11262
11268
|
if (action === "orders")
|
|
11263
11269
|
return cmdSwapOrders(run, {
|
|
11264
11270
|
instId: v.instId,
|
|
@@ -11274,6 +11280,13 @@ function handleSwapCommand(run, action, rest, v, json) {
|
|
|
11274
11280
|
archive: v.archive ?? false,
|
|
11275
11281
|
json
|
|
11276
11282
|
});
|
|
11283
|
+
if (action === "get-leverage")
|
|
11284
|
+
return cmdSwapGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
|
|
11285
|
+
return void 0;
|
|
11286
|
+
}
|
|
11287
|
+
function handleSwapCommand(run, action, rest, v, json) {
|
|
11288
|
+
const queryResult = handleSwapQuery(run, action, rest, v, json);
|
|
11289
|
+
if (queryResult !== void 0) return queryResult;
|
|
11277
11290
|
if (action === "close")
|
|
11278
11291
|
return cmdSwapClose(run, {
|
|
11279
11292
|
instId: v.instId,
|
|
@@ -11282,8 +11295,6 @@ function handleSwapCommand(run, action, rest, v, json) {
|
|
|
11282
11295
|
autoCxl: v.autoCxl,
|
|
11283
11296
|
json
|
|
11284
11297
|
});
|
|
11285
|
-
if (action === "get-leverage")
|
|
11286
|
-
return cmdSwapGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
|
|
11287
11298
|
if (action === "place")
|
|
11288
11299
|
return cmdSwapPlace(run, {
|
|
11289
11300
|
instId: v.instId,
|
|
@@ -11300,7 +11311,7 @@ function handleSwapCommand(run, action, rest, v, json) {
|
|
|
11300
11311
|
json
|
|
11301
11312
|
});
|
|
11302
11313
|
if (action === "cancel")
|
|
11303
|
-
return cmdSwapCancel(run, v.instId, v.ordId, json);
|
|
11314
|
+
return cmdSwapCancel(run, { instId: v.instId ?? rest[0], ordId: v.ordId, clOrdId: v.clOrdId, json });
|
|
11304
11315
|
if (action === "amend")
|
|
11305
11316
|
return cmdSwapAmend(run, {
|
|
11306
11317
|
instId: v.instId,
|
|
@@ -11467,7 +11478,7 @@ function resolveFuturesOrdersStatus(v) {
|
|
|
11467
11478
|
if (v.history) return "history";
|
|
11468
11479
|
return "open";
|
|
11469
11480
|
}
|
|
11470
|
-
function
|
|
11481
|
+
function handleFuturesQuery(run, action, v, json) {
|
|
11471
11482
|
if (action === "orders")
|
|
11472
11483
|
return cmdFuturesOrders(run, { instId: v.instId, status: resolveFuturesOrdersStatus(v), json });
|
|
11473
11484
|
if (action === "positions") return cmdFuturesPositions(run, v.instId, json);
|
|
@@ -11478,6 +11489,15 @@ function handleFuturesCommand(run, action, rest, v, json) {
|
|
|
11478
11489
|
archive: v.archive ?? false,
|
|
11479
11490
|
json
|
|
11480
11491
|
});
|
|
11492
|
+
if (action === "get")
|
|
11493
|
+
return cmdFuturesGet(run, { instId: v.instId, ordId: v.ordId, json });
|
|
11494
|
+
if (action === "get-leverage")
|
|
11495
|
+
return cmdFuturesGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
|
|
11496
|
+
return void 0;
|
|
11497
|
+
}
|
|
11498
|
+
function handleFuturesCommand(run, action, rest, v, json) {
|
|
11499
|
+
const queryResult = handleFuturesQuery(run, action, v, json);
|
|
11500
|
+
if (queryResult !== void 0) return queryResult;
|
|
11481
11501
|
if (action === "place")
|
|
11482
11502
|
return cmdFuturesPlace(run, {
|
|
11483
11503
|
instId: v.instId,
|
|
@@ -11495,9 +11515,7 @@ function handleFuturesCommand(run, action, rest, v, json) {
|
|
|
11495
11515
|
json
|
|
11496
11516
|
});
|
|
11497
11517
|
if (action === "cancel")
|
|
11498
|
-
return cmdFuturesCancel(run, v.instId, v.ordId, json);
|
|
11499
|
-
if (action === "get")
|
|
11500
|
-
return cmdFuturesGet(run, { instId: rest[0] ?? v.instId, ordId: v.ordId, json });
|
|
11518
|
+
return cmdFuturesCancel(run, { instId: v.instId ?? rest[0], ordId: v.ordId, clOrdId: v.clOrdId, json });
|
|
11501
11519
|
if (action === "amend")
|
|
11502
11520
|
return cmdFuturesAmend(run, {
|
|
11503
11521
|
instId: v.instId,
|
|
@@ -11515,8 +11533,6 @@ function handleFuturesCommand(run, action, rest, v, json) {
|
|
|
11515
11533
|
autoCxl: v.autoCxl,
|
|
11516
11534
|
json
|
|
11517
11535
|
});
|
|
11518
|
-
if (action === "get-leverage")
|
|
11519
|
-
return cmdFuturesGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
|
|
11520
11536
|
if (action === "leverage")
|
|
11521
11537
|
return cmdFuturesSetLeverage(run, {
|
|
11522
11538
|
instId: v.instId,
|