@okx_ai/okx-trade-cli 1.2.7-beta.2 → 1.2.7
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 +37 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3150,8 +3150,12 @@ function registerDcaTools() {
|
|
|
3150
3150
|
slPct: { type: "string", description: "Stop-loss ratio, 0.05=5%" },
|
|
3151
3151
|
slMode: { type: "string", enum: ["limit", "market"] },
|
|
3152
3152
|
allowReinvest: { type: "boolean", description: "Default true" },
|
|
3153
|
-
triggerStrategy: { type: "string", enum: ["instant", "price"] },
|
|
3154
|
-
triggerPx: { type: "string", description: "Need if triggerStrategy=price" },
|
|
3153
|
+
triggerStrategy: { type: "string", enum: ["instant", "price", "rsi"], description: "contract_dca: instant|price|rsi; spot_dca: instant|rsi. Default: instant" },
|
|
3154
|
+
triggerPx: { type: "string", description: "Need if triggerStrategy=price (contract_dca only)" },
|
|
3155
|
+
triggerCond: { type: "string", enum: ["cross_up", "cross_down"], description: "Required when triggerStrategy=rsi. Optional when triggerStrategy=price" },
|
|
3156
|
+
thold: { type: "string", description: "RSI threshold (e.g. '30'). Need if triggerStrategy=rsi" },
|
|
3157
|
+
timeframe: { type: "string", description: "RSI timeframe (e.g. '15m'). Need if triggerStrategy=rsi" },
|
|
3158
|
+
timePeriod: { type: "string", description: "RSI period. Default '14'. Optional when triggerStrategy=rsi" },
|
|
3155
3159
|
algoClOrdId: { type: "string", description: "Client order ID, 1-32 chars" },
|
|
3156
3160
|
// Backend expects boolean, but kept as string for backward compatibility with older clients.
|
|
3157
3161
|
reserveFunds: { type: "string", description: "'true' or 'false', default 'true'" },
|
|
@@ -3170,12 +3174,28 @@ function registerDcaTools() {
|
|
|
3170
3174
|
});
|
|
3171
3175
|
}
|
|
3172
3176
|
const triggerStrategy = readString(args, "triggerStrategy") ?? "instant";
|
|
3177
|
+
if (triggerStrategy === "price" && algoOrdType === "spot_dca") {
|
|
3178
|
+
throw new OkxApiError("triggerStrategy 'price' is only supported for contract_dca. spot_dca supports: instant, rsi", {
|
|
3179
|
+
code: "VALIDATION",
|
|
3180
|
+
endpoint: `${BASE}/create`
|
|
3181
|
+
});
|
|
3182
|
+
}
|
|
3173
3183
|
const triggerParam = {
|
|
3174
3184
|
triggerAction: "start",
|
|
3175
3185
|
triggerStrategy
|
|
3176
3186
|
};
|
|
3177
3187
|
if (triggerStrategy === "price") {
|
|
3178
3188
|
triggerParam["triggerPx"] = requireString(args, "triggerPx");
|
|
3189
|
+
const triggerCond = readString(args, "triggerCond");
|
|
3190
|
+
if (triggerCond) {
|
|
3191
|
+
triggerParam["triggerCond"] = triggerCond;
|
|
3192
|
+
}
|
|
3193
|
+
} else if (triggerStrategy === "rsi") {
|
|
3194
|
+
triggerParam["triggerCond"] = requireString(args, "triggerCond");
|
|
3195
|
+
triggerParam["thold"] = requireString(args, "thold");
|
|
3196
|
+
triggerParam["timeframe"] = requireString(args, "timeframe");
|
|
3197
|
+
const timePeriod = readString(args, "timePeriod");
|
|
3198
|
+
triggerParam["timePeriod"] = timePeriod ?? "14";
|
|
3179
3199
|
}
|
|
3180
3200
|
const maxSafetyOrds = requireString(args, "maxSafetyOrds");
|
|
3181
3201
|
if (Number(maxSafetyOrds) > 0) {
|
|
@@ -7735,7 +7755,7 @@ async function cmdDiagnoseMcp(options = {}) {
|
|
|
7735
7755
|
|
|
7736
7756
|
// src/commands/diagnose.ts
|
|
7737
7757
|
var CLI_VERSION = readCliVersion();
|
|
7738
|
-
var GIT_HASH = true ? "
|
|
7758
|
+
var GIT_HASH = true ? "475621d" : "dev";
|
|
7739
7759
|
function maskKey2(key) {
|
|
7740
7760
|
if (!key) return "(not set)";
|
|
7741
7761
|
if (key.length <= 8) return "****";
|
|
@@ -8593,7 +8613,7 @@ var HELP_TREE = {
|
|
|
8593
8613
|
description: "Get DCA cycles/orders (spot or contract)"
|
|
8594
8614
|
},
|
|
8595
8615
|
create: {
|
|
8596
|
-
usage: "okx bot dca create --algoOrdType <spot_dca|contract_dca> --instId <id> --direction <long|short>\n --initOrdAmt <n> --maxSafetyOrds <n> --tpPct <n>\n [--lever <n>] [--safetyOrdAmt <n>] [--pxSteps <n>] [--pxStepsMult <n>] [--volMult <n>]\n [--slPct <n>] [--slMode <limit|market>] [--allowReinvest <true|false>]\n [--triggerStrategy <instant|price|rsi>] [--triggerPx <price>]\n [--algoClOrdId <id>] [--reserveFunds <true|false>] [--tradeQuoteCcy <ccy>]\n Note: --lever required for contract_dca; safetyOrdAmt, pxSteps, pxStepsMult, volMult required when maxSafetyOrds > 0",
|
|
8616
|
+
usage: "okx bot dca create --algoOrdType <spot_dca|contract_dca> --instId <id> --direction <long|short>\n --initOrdAmt <n> --maxSafetyOrds <n> --tpPct <n>\n [--lever <n>] [--safetyOrdAmt <n>] [--pxSteps <n>] [--pxStepsMult <n>] [--volMult <n>]\n [--slPct <n>] [--slMode <limit|market>] [--allowReinvest <true|false>]\n [--triggerStrategy <instant|price|rsi>] [--triggerPx <price>]\n [--triggerCond <cross_up|cross_down>] [--thold <n>] [--timeframe <tf>] [--timePeriod <n>]\n [--algoClOrdId <id>] [--reserveFunds <true|false>] [--tradeQuoteCcy <ccy>]\n Note: --lever required for contract_dca; safetyOrdAmt, pxSteps, pxStepsMult, volMult required when maxSafetyOrds > 0\n triggerStrategy: contract_dca supports instant|price|rsi; spot_dca supports instant|rsi",
|
|
8597
8617
|
description: "Create a DCA (Martingale) bot (spot or contract)"
|
|
8598
8618
|
},
|
|
8599
8619
|
stop: {
|
|
@@ -8846,6 +8866,10 @@ var CLI_OPTIONS = {
|
|
|
8846
8866
|
allowReinvest: { type: "string" },
|
|
8847
8867
|
triggerStrategy: { type: "string" },
|
|
8848
8868
|
triggerPx: { type: "string" },
|
|
8869
|
+
triggerCond: { type: "string" },
|
|
8870
|
+
thold: { type: "string" },
|
|
8871
|
+
timeframe: { type: "string" },
|
|
8872
|
+
timePeriod: { type: "string" },
|
|
8849
8873
|
cycleId: { type: "string" },
|
|
8850
8874
|
reserveFunds: { type: "string" },
|
|
8851
8875
|
tradeQuoteCcy: { type: "string" },
|
|
@@ -11128,6 +11152,10 @@ async function cmdDcaCreate(run, opts) {
|
|
|
11128
11152
|
allowReinvest: opts.allowReinvest,
|
|
11129
11153
|
triggerStrategy: opts.triggerStrategy,
|
|
11130
11154
|
triggerPx: opts.triggerPx,
|
|
11155
|
+
triggerCond: opts.triggerCond,
|
|
11156
|
+
thold: opts.thold,
|
|
11157
|
+
timeframe: opts.timeframe,
|
|
11158
|
+
timePeriod: opts.timePeriod,
|
|
11131
11159
|
algoClOrdId: opts.algoClOrdId,
|
|
11132
11160
|
reserveFunds: opts.reserveFunds,
|
|
11133
11161
|
tradeQuoteCcy: opts.tradeQuoteCcy
|
|
@@ -11537,7 +11565,7 @@ async function cmdDcdQuoteAndBuy(run, opts) {
|
|
|
11537
11565
|
// src/index.ts
|
|
11538
11566
|
var _require3 = createRequire3(import.meta.url);
|
|
11539
11567
|
var CLI_VERSION2 = _require3("../package.json").version;
|
|
11540
|
-
var GIT_HASH2 = true ? "
|
|
11568
|
+
var GIT_HASH2 = true ? "475621d" : "dev";
|
|
11541
11569
|
function handleConfigCommand(action, rest, json, lang, force) {
|
|
11542
11570
|
if (action === "init") return cmdConfigInit(lang === "zh" ? "zh" : "en");
|
|
11543
11571
|
if (action === "show") return cmdConfigShow(json);
|
|
@@ -12169,6 +12197,10 @@ function handleBotDcaCommand(run, subAction, v, json) {
|
|
|
12169
12197
|
allowReinvest: v.allowReinvest,
|
|
12170
12198
|
triggerStrategy: v.triggerStrategy,
|
|
12171
12199
|
triggerPx: v.triggerPx,
|
|
12200
|
+
triggerCond: v.triggerCond,
|
|
12201
|
+
thold: v.thold,
|
|
12202
|
+
timeframe: v.timeframe,
|
|
12203
|
+
timePeriod: v.timePeriod,
|
|
12172
12204
|
algoClOrdId: v.algoClOrdId,
|
|
12173
12205
|
reserveFunds: v.reserveFunds,
|
|
12174
12206
|
tradeQuoteCcy: v.tradeQuoteCcy,
|