@okx_ai/okx-trade-cli 1.3.4-beta.2 → 1.3.4
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 +3 -108
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall-download.js +0 -152
package/dist/index.js
CHANGED
|
@@ -9679,58 +9679,6 @@ function registerMarketFilterTools() {
|
|
|
9679
9679
|
);
|
|
9680
9680
|
return normalizeResponse(response);
|
|
9681
9681
|
}
|
|
9682
|
-
},
|
|
9683
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
9684
|
-
// market_get_pair_spread — /api/v5/aigc/mcp/pair-spread
|
|
9685
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
9686
|
-
{
|
|
9687
|
-
name: "market_get_pair_spread",
|
|
9688
|
-
module: "market",
|
|
9689
|
-
description: "Compute spread statistics between two instruments over a lookback window. Returns absolute and ratio spread (mean / stdDev / median / min / max) plus an optional realtime spread snapshot. Use to size pairs trades, detect mean-reversion setups, or compare cross-listed contracts. Results are cached ~60s per (pair, bar, window) tuple. Read-only, no credentials required.\nDo NOT use to fetch raw candles (use market_get_candles) or single-instrument OI/funding (use market_get_oi_history / market_filter_oi_change).",
|
|
9690
|
-
isWrite: false,
|
|
9691
|
-
inputSchema: {
|
|
9692
|
-
type: "object",
|
|
9693
|
-
properties: {
|
|
9694
|
-
instIdA: {
|
|
9695
|
-
type: "string",
|
|
9696
|
-
description: "First instrument ID, e.g. BTC-USDT-SWAP"
|
|
9697
|
-
},
|
|
9698
|
-
instIdB: {
|
|
9699
|
-
type: "string",
|
|
9700
|
-
description: "Second instrument ID; must differ from instIdA"
|
|
9701
|
-
},
|
|
9702
|
-
bar: {
|
|
9703
|
-
type: "string",
|
|
9704
|
-
enum: ["5m", "15m"],
|
|
9705
|
-
description: "Bar size for the spread series. Default 15m. 1m is not supported."
|
|
9706
|
-
},
|
|
9707
|
-
window: {
|
|
9708
|
-
type: "string",
|
|
9709
|
-
description: "Lookback window. Format <n><unit>, units m/H/D/W (case-sensitive), max 1W. Default 1W."
|
|
9710
|
-
},
|
|
9711
|
-
backtestTime: {
|
|
9712
|
-
type: "number",
|
|
9713
|
-
description: "Anchor timestamp (ms epoch) for backtest mode. When provided, realtime is omitted."
|
|
9714
|
-
}
|
|
9715
|
-
},
|
|
9716
|
-
required: ["instIdA", "instIdB"]
|
|
9717
|
-
},
|
|
9718
|
-
handler: async (rawArgs, context) => {
|
|
9719
|
-
const args = asRecord(rawArgs);
|
|
9720
|
-
const body = compactObject({
|
|
9721
|
-
instIdA: requireString(args, "instIdA"),
|
|
9722
|
-
instIdB: requireString(args, "instIdB"),
|
|
9723
|
-
bar: readString(args, "bar"),
|
|
9724
|
-
window: readString(args, "window"),
|
|
9725
|
-
backtestTime: readNumber(args, "backtestTime")
|
|
9726
|
-
});
|
|
9727
|
-
const response = await context.client.publicPost(
|
|
9728
|
-
"/api/v5/aigc/mcp/pair-spread",
|
|
9729
|
-
body,
|
|
9730
|
-
publicRateLimit("market_get_pair_spread", 5)
|
|
9731
|
-
);
|
|
9732
|
-
return normalizeResponse(response);
|
|
9733
|
-
}
|
|
9734
9682
|
}
|
|
9735
9683
|
];
|
|
9736
9684
|
}
|
|
@@ -13803,7 +13751,7 @@ async function cmdDiagnoseMcp(options = {}) {
|
|
|
13803
13751
|
|
|
13804
13752
|
// src/commands/diagnose.ts
|
|
13805
13753
|
var CLI_VERSION = readCliVersion();
|
|
13806
|
-
var GIT_HASH = true ? "
|
|
13754
|
+
var GIT_HASH = true ? "cd99d487" : "dev";
|
|
13807
13755
|
function maskKey2(key) {
|
|
13808
13756
|
if (!key) return "(not set)";
|
|
13809
13757
|
if (key.length <= 8) return "****";
|
|
@@ -14379,11 +14327,6 @@ var CLI_REGISTRY = {
|
|
|
14379
14327
|
toolName: "market_filter_oi_change",
|
|
14380
14328
|
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>]",
|
|
14381
14329
|
description: "Find instruments with largest OI changes over a bar window (accumulation/distribution scanner)"
|
|
14382
|
-
},
|
|
14383
|
-
"pair-spread": {
|
|
14384
|
-
toolName: "market_get_pair_spread",
|
|
14385
|
-
usage: "okx market pair-spread <instIdA> <instIdB> [--bar <5m|15m>] [--window <window>] [--backtest-time <ms>] [--json]",
|
|
14386
|
-
description: "Compute spread statistics (abs + ratio) between two instruments over a lookback window"
|
|
14387
14330
|
}
|
|
14388
14331
|
},
|
|
14389
14332
|
subgroups: {
|
|
@@ -16088,8 +16031,6 @@ var CLI_OPTIONS = {
|
|
|
16088
16031
|
params: { type: "string" },
|
|
16089
16032
|
list: { type: "boolean", default: false },
|
|
16090
16033
|
"backtest-time": { type: "string" },
|
|
16091
|
-
// pair-spread
|
|
16092
|
-
window: { type: "string" },
|
|
16093
16034
|
// news
|
|
16094
16035
|
coins: { type: "string" },
|
|
16095
16036
|
sentiment: { type: "string" },
|
|
@@ -16613,42 +16554,6 @@ async function cmdMarketOiChangeFilter(run, opts) {
|
|
|
16613
16554
|
}))
|
|
16614
16555
|
);
|
|
16615
16556
|
}
|
|
16616
|
-
async function cmdMarketPairSpread(run, instIdA, instIdB, opts) {
|
|
16617
|
-
const result = await run("market_get_pair_spread", {
|
|
16618
|
-
instIdA,
|
|
16619
|
-
instIdB,
|
|
16620
|
-
bar: opts.bar,
|
|
16621
|
-
window: opts.window,
|
|
16622
|
-
backtestTime: opts.backtestTime
|
|
16623
|
-
});
|
|
16624
|
-
const data = getData2(result);
|
|
16625
|
-
if (opts.json) return printJson(data);
|
|
16626
|
-
const bar = data?.["bar"] ?? "15m";
|
|
16627
|
-
const win = data?.["window"] ?? "1W";
|
|
16628
|
-
const mode = data?.["mode"] ?? "live";
|
|
16629
|
-
outputLine(`${instIdA} / ${instIdB} bar=${bar} window=${win} mode=${mode}`);
|
|
16630
|
-
const rt = data?.["realtime"];
|
|
16631
|
-
if (rt) {
|
|
16632
|
-
outputLine(`realtime lastA=${rt["lastPriceA"]} lastB=${rt["lastPriceB"]} abs=${rt["spreadAbs"]} ratio=${rt["spreadRatio"]}`);
|
|
16633
|
-
}
|
|
16634
|
-
const stats = data?.["statistics"];
|
|
16635
|
-
if (stats) {
|
|
16636
|
-
const abs = stats["absolute"];
|
|
16637
|
-
const ratio = stats["ratio"];
|
|
16638
|
-
const meta = data?.["meta"];
|
|
16639
|
-
outputLine(`samples count=${meta?.["alignedBars"] ?? "?"} start=${stats?.["windowStartTs"] ?? "?"} end=${stats?.["windowEndTs"] ?? "?"}`);
|
|
16640
|
-
printTable([
|
|
16641
|
-
{ stat: "mean", absolute: abs?.["mean"], ratio: ratio?.["mean"] },
|
|
16642
|
-
{ stat: "stdDev", absolute: abs?.["stdDev"], ratio: ratio?.["stdDev"] },
|
|
16643
|
-
{ stat: "median", absolute: abs?.["median"], ratio: ratio?.["median"] },
|
|
16644
|
-
{ stat: "min", absolute: abs?.["min"], ratio: ratio?.["min"] },
|
|
16645
|
-
{ stat: "max", absolute: abs?.["max"], ratio: ratio?.["max"] }
|
|
16646
|
-
]);
|
|
16647
|
-
if (meta) {
|
|
16648
|
-
outputLine(`meta requested=${meta["requestedBars"]} aligned=${meta["alignedBars"]} dropped=${meta["droppedBars"]} truncated=${meta["truncated"]}`);
|
|
16649
|
-
}
|
|
16650
|
-
}
|
|
16651
|
-
}
|
|
16652
16557
|
|
|
16653
16558
|
// src/commands/account.ts
|
|
16654
16559
|
import * as fs7 from "fs";
|
|
@@ -20392,7 +20297,7 @@ async function cmdEventCancel(run, opts) {
|
|
|
20392
20297
|
// src/index.ts
|
|
20393
20298
|
var _require3 = createRequire3(import.meta.url);
|
|
20394
20299
|
var CLI_VERSION2 = _require3("../package.json").version;
|
|
20395
|
-
var GIT_HASH2 = true ? "
|
|
20300
|
+
var GIT_HASH2 = true ? "cd99d487" : "dev";
|
|
20396
20301
|
function handlePilotCommand(action, json, force, binaryPath) {
|
|
20397
20302
|
if (action === "status") return cmdPilotStatus(json, binaryPath);
|
|
20398
20303
|
if (action === "install") return cmdPilotInstall(json, binaryPath);
|
|
@@ -20497,15 +20402,6 @@ function handleMarketFilterCommand(run, action, rest, v, json) {
|
|
|
20497
20402
|
limit,
|
|
20498
20403
|
json
|
|
20499
20404
|
});
|
|
20500
|
-
if (action === "pair-spread") {
|
|
20501
|
-
const backtestTime = v["backtest-time"] !== void 0 ? Number(v["backtest-time"]) : void 0;
|
|
20502
|
-
return cmdMarketPairSpread(run, rest[0], rest[1], {
|
|
20503
|
-
bar: v.bar,
|
|
20504
|
-
window: v.window,
|
|
20505
|
-
backtestTime,
|
|
20506
|
-
json
|
|
20507
|
-
});
|
|
20508
|
-
}
|
|
20509
20405
|
}
|
|
20510
20406
|
function handleIndicatorAction(run, rest, v, json) {
|
|
20511
20407
|
if (rest[0] === "list") return cmdMarketIndicatorList(json);
|
|
@@ -20554,8 +20450,7 @@ function handleMarketCommand(run, action, rest, v, json) {
|
|
|
20554
20450
|
"filter",
|
|
20555
20451
|
"oi-history",
|
|
20556
20452
|
"oi-change",
|
|
20557
|
-
"index-candles"
|
|
20558
|
-
"pair-spread"
|
|
20453
|
+
"index-candles"
|
|
20559
20454
|
]);
|
|
20560
20455
|
}
|
|
20561
20456
|
function handleAccountWriteCommand(run, action, v, json) {
|