@okx_ai/okx-trade-cli 1.1.8 → 1.2.0
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 +145 -292
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1200,6 +1200,7 @@ var OkxRestClient = class {
|
|
|
1200
1200
|
};
|
|
1201
1201
|
}
|
|
1202
1202
|
};
|
|
1203
|
+
var DEFAULT_SOURCE_TAG = "MCP";
|
|
1203
1204
|
var OKX_SITES = {
|
|
1204
1205
|
global: {
|
|
1205
1206
|
label: "Global",
|
|
@@ -1970,7 +1971,8 @@ function registerAlgoTradeTools() {
|
|
|
1970
1971
|
slOrdPx: readString(args, "slOrdPx"),
|
|
1971
1972
|
slTriggerPxType: readString(args, "slTriggerPxType"),
|
|
1972
1973
|
reduceOnly: typeof reduceOnly === "boolean" ? String(reduceOnly) : void 0,
|
|
1973
|
-
clOrdId: readString(args, "clOrdId")
|
|
1974
|
+
clOrdId: readString(args, "clOrdId"),
|
|
1975
|
+
tag: context.config.sourceTag
|
|
1974
1976
|
}),
|
|
1975
1977
|
privateRateLimit("swap_place_algo_order", 20)
|
|
1976
1978
|
);
|
|
@@ -2452,7 +2454,7 @@ function registerGridTools() {
|
|
|
2452
2454
|
{
|
|
2453
2455
|
name: "grid_create_order",
|
|
2454
2456
|
module: "bot.grid",
|
|
2455
|
-
description: "Create a new grid trading bot. [CAUTION] Executes real trades and locks funds. Supports Spot Grid ('grid') and Contract Grid ('contract_grid'). For spot grid, provide quoteSz (invest in quote currency) or baseSz (invest in base currency). For contract grids, provide direction, lever, and sz (
|
|
2457
|
+
description: "Create a new grid trading bot. [CAUTION] Executes real trades and locks funds. Supports Spot Grid ('grid') and Contract Grid ('contract_grid'). For spot grid, provide quoteSz (invest in quote currency) or baseSz (invest in base currency). For contract grids, provide direction, lever, and sz (investment amount in margin currency, e.g. USDT for USDT-margined contracts). Private endpoint. Rate limit: 20 req/2s per UID.",
|
|
2456
2458
|
isWrite: true,
|
|
2457
2459
|
inputSchema: {
|
|
2458
2460
|
type: "object",
|
|
@@ -2502,7 +2504,7 @@ function registerGridTools() {
|
|
|
2502
2504
|
},
|
|
2503
2505
|
sz: {
|
|
2504
2506
|
type: "string",
|
|
2505
|
-
description: "
|
|
2507
|
+
description: "Investment amount in margin currency (e.g. USDT for USDT-margined contracts). Required for contract_grid."
|
|
2506
2508
|
},
|
|
2507
2509
|
basePos: {
|
|
2508
2510
|
type: "boolean",
|
|
@@ -2525,7 +2527,8 @@ function registerGridTools() {
|
|
|
2525
2527
|
baseSz: readString(args, "baseSz"),
|
|
2526
2528
|
direction: readString(args, "direction"),
|
|
2527
2529
|
lever: readString(args, "lever"),
|
|
2528
|
-
sz: readString(args, "sz")
|
|
2530
|
+
sz: readString(args, "sz"),
|
|
2531
|
+
tag: context.config.sourceTag
|
|
2529
2532
|
});
|
|
2530
2533
|
if (algoOrdType === "contract_grid") {
|
|
2531
2534
|
body.triggerParams = [{ triggerAction: "start", triggerStrategy: "instant" }];
|
|
@@ -2619,78 +2622,58 @@ function registerDcaTools() {
|
|
|
2619
2622
|
{
|
|
2620
2623
|
name: "dca_create_order",
|
|
2621
2624
|
module: "bot.dca",
|
|
2622
|
-
description: "Create a DCA bot order
|
|
2625
|
+
description: "Create a Contract DCA (Martingale) bot order with leverage on futures/swaps. Required: instId, lever, direction, initOrdAmt, maxSafetyOrds, tpPct. Conditionally required (when maxSafetyOrds > 0): safetyOrdAmt, pxSteps, pxStepsMult, volMult. Optional: slPct, slMode, allowReinvest, triggerStrategy, triggerPx. [CAUTION] Executes real trades. Private endpoint. Rate limit: 20 req/2s.",
|
|
2623
2626
|
isWrite: true,
|
|
2624
2627
|
inputSchema: {
|
|
2625
2628
|
type: "object",
|
|
2626
2629
|
properties: {
|
|
2627
|
-
type:
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
description: "spot=Spot DCA (Martingale, no leverage); contract=Contract DCA (Martingale with leverage)"
|
|
2631
|
-
},
|
|
2632
|
-
instId: { type: "string", description: "e.g. BTC-USDT (spot) or BTC-USDT-SWAP (contract)" },
|
|
2633
|
-
// Shared spot/contract params
|
|
2630
|
+
instId: { type: "string", description: "Instrument ID, e.g. BTC-USDT-SWAP" },
|
|
2631
|
+
lever: { type: "string", description: "Leverage multiplier, e.g. '3'" },
|
|
2632
|
+
direction: { type: "string", enum: ["long", "short"], description: "Strategy direction: 'long' or 'short'" },
|
|
2634
2633
|
initOrdAmt: { type: "string", description: "Initial order amount (USDT)" },
|
|
2635
|
-
safetyOrdAmt: { type: "string", description: "Safety order amount (USDT)" },
|
|
2636
2634
|
maxSafetyOrds: { type: "string", description: "Max number of safety orders, e.g. '3'" },
|
|
2637
|
-
pxSteps: { type: "string", description: "Price drop % per safety order, e.g. '0.03' = 3%" },
|
|
2638
|
-
pxStepsMult: { type: "string", description: "Price step multiplier, e.g. '1.2'" },
|
|
2639
|
-
volMult: { type: "string", description: "Safety order size multiplier, e.g. '1.5'" },
|
|
2640
2635
|
tpPct: { type: "string", description: "Take-profit ratio, e.g. '0.03' = 3%" },
|
|
2636
|
+
safetyOrdAmt: { type: "string", description: "Safety order amount (USDT). Required when maxSafetyOrds > 0" },
|
|
2637
|
+
pxSteps: { type: "string", description: "Price drop % per safety order, e.g. '0.03' = 3%. Required when maxSafetyOrds > 0" },
|
|
2638
|
+
pxStepsMult: { type: "string", description: "Price step multiplier, e.g. '1.2'. Required when maxSafetyOrds > 0" },
|
|
2639
|
+
volMult: { type: "string", description: "Safety order size multiplier, e.g. '1.5'. Required when maxSafetyOrds > 0" },
|
|
2641
2640
|
slPct: { type: "string", description: "Stop-loss ratio, e.g. '0.05' = 5% (optional)" },
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
// Contract-only params
|
|
2647
|
-
lever: { type: "string", description: "[contract] Leverage multiplier, e.g. '3'" },
|
|
2648
|
-
side: { type: "string", enum: ["buy", "sell"], description: "[contract] buy=long, sell=short" }
|
|
2641
|
+
slMode: { type: "string", enum: ["limit", "market"], description: "Stop-loss price type: 'limit' or 'market'. Defaults to market if omitted (optional)" },
|
|
2642
|
+
allowReinvest: { type: "string", enum: ["true", "false"], description: "Reinvest profit into the next cycle. Default 'true' (optional)" },
|
|
2643
|
+
triggerStrategy: { type: "string", enum: ["instant", "price", "rsi"], default: "instant", description: "How the bot starts: 'instant' (default), 'price' (wait for trigger price), or 'rsi' (RSI signal) (optional)" },
|
|
2644
|
+
triggerPx: { type: "string", description: "Trigger price \u2014 required when triggerStrategy='price' (optional)" }
|
|
2649
2645
|
},
|
|
2650
|
-
required: ["
|
|
2646
|
+
required: ["instId", "lever", "direction", "initOrdAmt", "maxSafetyOrds", "tpPct"]
|
|
2651
2647
|
},
|
|
2652
2648
|
handler: async (rawArgs, context) => {
|
|
2653
2649
|
const args = asRecord(rawArgs);
|
|
2654
|
-
const type = requireString(args, "type");
|
|
2655
2650
|
const instId = requireString(args, "instId");
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
side: requireString(args, "side"),
|
|
2664
|
-
direction: readString(args, "direction") ?? "long",
|
|
2665
|
-
initOrdAmt: requireString(args, "initOrdAmt"),
|
|
2666
|
-
safetyOrdAmt: requireString(args, "safetyOrdAmt"),
|
|
2667
|
-
maxSafetyOrds: requireString(args, "maxSafetyOrds"),
|
|
2668
|
-
pxSteps: requireString(args, "pxSteps"),
|
|
2669
|
-
pxStepsMult: requireString(args, "pxStepsMult"),
|
|
2670
|
-
volMult: requireString(args, "volMult"),
|
|
2671
|
-
tpPct: requireString(args, "tpPct"),
|
|
2672
|
-
reserveFunds: readString(args, "reserveFunds") ?? "false",
|
|
2673
|
-
triggerParams: [{ triggerAction: "start", triggerStrategy: "instant" }]
|
|
2674
|
-
}),
|
|
2675
|
-
privateRateLimit("dca_create_order", 20)
|
|
2676
|
-
);
|
|
2677
|
-
return normalizeWrite2(response2);
|
|
2651
|
+
const triggerStrategy = readString(args, "triggerStrategy") ?? "instant";
|
|
2652
|
+
const triggerParam = {
|
|
2653
|
+
triggerAction: "start",
|
|
2654
|
+
triggerStrategy
|
|
2655
|
+
};
|
|
2656
|
+
if (triggerStrategy === "price") {
|
|
2657
|
+
triggerParam["triggerPx"] = requireString(args, "triggerPx");
|
|
2678
2658
|
}
|
|
2679
2659
|
const response = await context.client.privatePost(
|
|
2680
|
-
`${BASE}/
|
|
2660
|
+
`${BASE}/create`,
|
|
2681
2661
|
compactObject({
|
|
2682
2662
|
instId,
|
|
2683
|
-
|
|
2684
|
-
|
|
2663
|
+
algoOrdType: "contract_dca",
|
|
2664
|
+
lever: requireString(args, "lever"),
|
|
2665
|
+
direction: requireString(args, "direction"),
|
|
2685
2666
|
initOrdAmt: requireString(args, "initOrdAmt"),
|
|
2686
|
-
|
|
2687
|
-
safetyOrdAmt: requireString(args, "safetyOrdAmt"),
|
|
2667
|
+
safetyOrdAmt: readString(args, "safetyOrdAmt"),
|
|
2688
2668
|
maxSafetyOrds: requireString(args, "maxSafetyOrds"),
|
|
2689
|
-
pxSteps:
|
|
2690
|
-
pxStepsMult:
|
|
2691
|
-
volMult:
|
|
2669
|
+
pxSteps: readString(args, "pxSteps"),
|
|
2670
|
+
pxStepsMult: readString(args, "pxStepsMult"),
|
|
2671
|
+
volMult: readString(args, "volMult"),
|
|
2692
2672
|
tpPct: requireString(args, "tpPct"),
|
|
2693
|
-
slPct: readString(args, "slPct")
|
|
2673
|
+
slPct: readString(args, "slPct"),
|
|
2674
|
+
slMode: readString(args, "slMode"),
|
|
2675
|
+
allowReinvest: readString(args, "allowReinvest"),
|
|
2676
|
+
triggerParams: [triggerParam]
|
|
2694
2677
|
}),
|
|
2695
2678
|
privateRateLimit("dca_create_order", 20)
|
|
2696
2679
|
);
|
|
@@ -2700,43 +2683,21 @@ function registerDcaTools() {
|
|
|
2700
2683
|
{
|
|
2701
2684
|
name: "dca_stop_order",
|
|
2702
2685
|
module: "bot.dca",
|
|
2703
|
-
description: "Stop a running DCA bot.
|
|
2686
|
+
description: "Stop a running Contract DCA bot. [CAUTION] This will stop the bot. Private endpoint. Rate limit: 20 req/2s.",
|
|
2704
2687
|
isWrite: true,
|
|
2705
2688
|
inputSchema: {
|
|
2706
2689
|
type: "object",
|
|
2707
2690
|
properties: {
|
|
2708
|
-
type:
|
|
2709
|
-
type: "string",
|
|
2710
|
-
enum: ["spot", "contract"],
|
|
2711
|
-
description: "spot or contract"
|
|
2712
|
-
},
|
|
2713
|
-
algoId: { type: "string" },
|
|
2714
|
-
instId: { type: "string", description: "Instrument ID, e.g. BTC-USDT (spot) or BTC-USDT-SWAP (contract)" },
|
|
2715
|
-
stopType: {
|
|
2716
|
-
type: "string",
|
|
2717
|
-
enum: ["1", "2"],
|
|
2718
|
-
description: "1=sell base currency and get quote (default); 2=keep base currency"
|
|
2719
|
-
}
|
|
2691
|
+
algoId: { type: "string", description: "Algo order ID of the DCA bot to stop" }
|
|
2720
2692
|
},
|
|
2721
|
-
required: ["
|
|
2693
|
+
required: ["algoId"]
|
|
2722
2694
|
},
|
|
2723
2695
|
handler: async (rawArgs, context) => {
|
|
2724
2696
|
const args = asRecord(rawArgs);
|
|
2725
|
-
const type = requireString(args, "type");
|
|
2726
2697
|
const algoId = requireString(args, "algoId");
|
|
2727
|
-
const instId = requireString(args, "instId");
|
|
2728
|
-
const stopType = readString(args, "stopType") ?? "1";
|
|
2729
|
-
if (type === "contract") {
|
|
2730
|
-
const response2 = await context.client.privatePost(
|
|
2731
|
-
`${BASE}/stop`,
|
|
2732
|
-
{ algoId, instId, algoOrdType: "contract_dca", stopType },
|
|
2733
|
-
privateRateLimit("dca_stop_order", 20)
|
|
2734
|
-
);
|
|
2735
|
-
return normalizeWrite2(response2);
|
|
2736
|
-
}
|
|
2737
2698
|
const response = await context.client.privatePost(
|
|
2738
|
-
`${BASE}/stop
|
|
2739
|
-
|
|
2699
|
+
`${BASE}/stop`,
|
|
2700
|
+
{ algoId, algoOrdType: "contract_dca" },
|
|
2740
2701
|
privateRateLimit("dca_stop_order", 20)
|
|
2741
2702
|
);
|
|
2742
2703
|
return normalizeWrite2(response);
|
|
@@ -2745,52 +2706,34 @@ function registerDcaTools() {
|
|
|
2745
2706
|
{
|
|
2746
2707
|
name: "dca_get_orders",
|
|
2747
2708
|
module: "bot.dca",
|
|
2748
|
-
description: "Query DCA bot orders.
|
|
2709
|
+
description: "Query Contract DCA bot orders. Use status='active' for running bots, status='history' for completed/stopped. Private endpoint. Rate limit: 20 req/2s.",
|
|
2749
2710
|
isWrite: false,
|
|
2750
2711
|
inputSchema: {
|
|
2751
2712
|
type: "object",
|
|
2752
2713
|
properties: {
|
|
2753
|
-
type: {
|
|
2754
|
-
type: "string",
|
|
2755
|
-
enum: ["spot", "contract"],
|
|
2756
|
-
description: "spot or contract"
|
|
2757
|
-
},
|
|
2758
2714
|
status: {
|
|
2759
2715
|
type: "string",
|
|
2760
2716
|
enum: ["active", "history"],
|
|
2761
2717
|
description: "active=running (default); history=stopped"
|
|
2762
2718
|
},
|
|
2763
2719
|
algoId: { type: "string" },
|
|
2720
|
+
instId: { type: "string", description: "Filter by instrument, e.g. BTC-USDT-SWAP (optional)" },
|
|
2764
2721
|
after: { type: "string", description: "Pagination: before this algo ID" },
|
|
2765
2722
|
before: { type: "string", description: "Pagination: after this algo ID" },
|
|
2766
2723
|
limit: { type: "number", description: "Max results (default 100)" }
|
|
2767
2724
|
},
|
|
2768
|
-
required: [
|
|
2725
|
+
required: []
|
|
2769
2726
|
},
|
|
2770
2727
|
handler: async (rawArgs, context) => {
|
|
2771
2728
|
const args = asRecord(rawArgs);
|
|
2772
|
-
const type = requireString(args, "type");
|
|
2773
2729
|
const status = readString(args, "status") ?? "active";
|
|
2774
|
-
|
|
2775
|
-
const path5 = status === "history" ? `${BASE}/history-list` : `${BASE}/ongoing-list`;
|
|
2776
|
-
const response2 = await context.client.privateGet(
|
|
2777
|
-
path5,
|
|
2778
|
-
compactObject({
|
|
2779
|
-
algoOrdType: "contract_dca",
|
|
2780
|
-
algoId: readString(args, "algoId"),
|
|
2781
|
-
after: readString(args, "after"),
|
|
2782
|
-
before: readString(args, "before"),
|
|
2783
|
-
limit: readNumber(args, "limit")
|
|
2784
|
-
}),
|
|
2785
|
-
privateRateLimit("dca_get_orders", 20)
|
|
2786
|
-
);
|
|
2787
|
-
return normalize4(response2);
|
|
2788
|
-
}
|
|
2789
|
-
const path4 = status === "history" ? `${BASE}/orders-algo-history` : `${BASE}/orders-algo-pending`;
|
|
2730
|
+
const path4 = status === "history" ? `${BASE}/history-list` : `${BASE}/ongoing-list`;
|
|
2790
2731
|
const response = await context.client.privateGet(
|
|
2791
2732
|
path4,
|
|
2792
2733
|
compactObject({
|
|
2734
|
+
algoOrdType: "contract_dca",
|
|
2793
2735
|
algoId: readString(args, "algoId"),
|
|
2736
|
+
instId: readString(args, "instId"),
|
|
2794
2737
|
after: readString(args, "after"),
|
|
2795
2738
|
before: readString(args, "before"),
|
|
2796
2739
|
limit: readNumber(args, "limit")
|
|
@@ -2803,35 +2746,21 @@ function registerDcaTools() {
|
|
|
2803
2746
|
{
|
|
2804
2747
|
name: "dca_get_order_details",
|
|
2805
2748
|
module: "bot.dca",
|
|
2806
|
-
description: "Query details of a single DCA bot by algo ID.
|
|
2749
|
+
description: "Query details of a single Contract DCA bot by algo ID. Returns current position details. Private endpoint. Rate limit: 20 req/2s.",
|
|
2807
2750
|
isWrite: false,
|
|
2808
2751
|
inputSchema: {
|
|
2809
2752
|
type: "object",
|
|
2810
2753
|
properties: {
|
|
2811
|
-
type: {
|
|
2812
|
-
type: "string",
|
|
2813
|
-
enum: ["spot", "contract"],
|
|
2814
|
-
description: "spot or contract"
|
|
2815
|
-
},
|
|
2816
2754
|
algoId: { type: "string" }
|
|
2817
2755
|
},
|
|
2818
|
-
required: ["
|
|
2756
|
+
required: ["algoId"]
|
|
2819
2757
|
},
|
|
2820
2758
|
handler: async (rawArgs, context) => {
|
|
2821
2759
|
const args = asRecord(rawArgs);
|
|
2822
|
-
const type = requireString(args, "type");
|
|
2823
2760
|
const algoId = requireString(args, "algoId");
|
|
2824
|
-
if (type === "contract") {
|
|
2825
|
-
const response2 = await context.client.privateGet(
|
|
2826
|
-
`${BASE}/position-details`,
|
|
2827
|
-
{ algoId, algoOrdType: "contract_dca" },
|
|
2828
|
-
privateRateLimit("dca_get_order_details", 20)
|
|
2829
|
-
);
|
|
2830
|
-
return normalize4(response2);
|
|
2831
|
-
}
|
|
2832
2761
|
const response = await context.client.privateGet(
|
|
2833
|
-
`${BASE}/
|
|
2834
|
-
{ algoId },
|
|
2762
|
+
`${BASE}/position-details`,
|
|
2763
|
+
{ algoId, algoOrdType: "contract_dca" },
|
|
2835
2764
|
privateRateLimit("dca_get_order_details", 20)
|
|
2836
2765
|
);
|
|
2837
2766
|
return normalize4(response);
|
|
@@ -2840,69 +2769,41 @@ function registerDcaTools() {
|
|
|
2840
2769
|
{
|
|
2841
2770
|
name: "dca_get_sub_orders",
|
|
2842
2771
|
module: "bot.dca",
|
|
2843
|
-
description: "Query
|
|
2772
|
+
description: "Query cycles or orders within a cycle of a Contract DCA bot. Returns cycle list when cycleId is omitted; returns orders within a specific cycle when cycleId is provided. Private endpoint. Rate limit: 20 req/2s.",
|
|
2844
2773
|
isWrite: false,
|
|
2845
2774
|
inputSchema: {
|
|
2846
2775
|
type: "object",
|
|
2847
2776
|
properties: {
|
|
2848
|
-
type:
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
},
|
|
2853
|
-
algoId: { type: "string" },
|
|
2854
|
-
subOrdType: {
|
|
2855
|
-
type: "string",
|
|
2856
|
-
enum: ["filled", "live"],
|
|
2857
|
-
description: "[spot] Sub-order type: filled=completed orders, live=pending orders (required for spot)"
|
|
2858
|
-
},
|
|
2859
|
-
cycleId: { type: "string", description: "[contract] Cycle ID; omit to list all cycles" },
|
|
2860
|
-
after: { type: "string", description: "Pagination: before this order ID" },
|
|
2861
|
-
before: { type: "string", description: "Pagination: after this order ID" },
|
|
2777
|
+
algoId: { type: "string", description: "Algo order ID of the DCA bot" },
|
|
2778
|
+
cycleId: { type: "string", description: "Omit to list all cycles; provide to get orders within a cycle" },
|
|
2779
|
+
after: { type: "string", description: "Pagination cursor \u2014 applies to cycle-list mode only (when cycleId is omitted)" },
|
|
2780
|
+
before: { type: "string", description: "Pagination cursor \u2014 applies to cycle-list mode only (when cycleId is omitted)" },
|
|
2862
2781
|
limit: { type: "number", description: "Max results (default 100)" }
|
|
2863
2782
|
},
|
|
2864
|
-
required: ["
|
|
2783
|
+
required: ["algoId"]
|
|
2865
2784
|
},
|
|
2866
2785
|
handler: async (rawArgs, context) => {
|
|
2867
2786
|
const args = asRecord(rawArgs);
|
|
2868
|
-
const type = requireString(args, "type");
|
|
2869
2787
|
const algoId = requireString(args, "algoId");
|
|
2870
2788
|
const cycleId = readString(args, "cycleId");
|
|
2871
|
-
if (
|
|
2872
|
-
if (cycleId) {
|
|
2873
|
-
const response3 = await context.client.privateGet(
|
|
2874
|
-
`${BASE}/orders`,
|
|
2875
|
-
compactObject({
|
|
2876
|
-
algoId,
|
|
2877
|
-
algoOrdType: "contract_dca",
|
|
2878
|
-
cycleId,
|
|
2879
|
-
after: readString(args, "after"),
|
|
2880
|
-
before: readString(args, "before"),
|
|
2881
|
-
limit: readNumber(args, "limit")
|
|
2882
|
-
}),
|
|
2883
|
-
privateRateLimit("dca_get_sub_orders", 20)
|
|
2884
|
-
);
|
|
2885
|
-
return normalize4(response3);
|
|
2886
|
-
}
|
|
2789
|
+
if (cycleId) {
|
|
2887
2790
|
const response2 = await context.client.privateGet(
|
|
2888
|
-
`${BASE}/
|
|
2791
|
+
`${BASE}/orders`,
|
|
2889
2792
|
compactObject({
|
|
2890
2793
|
algoId,
|
|
2891
2794
|
algoOrdType: "contract_dca",
|
|
2892
|
-
|
|
2893
|
-
before: readString(args, "before"),
|
|
2795
|
+
cycleId,
|
|
2894
2796
|
limit: readNumber(args, "limit")
|
|
2895
2797
|
}),
|
|
2896
2798
|
privateRateLimit("dca_get_sub_orders", 20)
|
|
2897
2799
|
);
|
|
2898
2800
|
return normalize4(response2);
|
|
2899
2801
|
}
|
|
2900
|
-
const subOrdType = readString(args, "subOrdType") ?? "filled";
|
|
2901
2802
|
const response = await context.client.privateGet(
|
|
2902
|
-
`${BASE}/
|
|
2803
|
+
`${BASE}/cycle-list`,
|
|
2903
2804
|
compactObject({
|
|
2904
2805
|
algoId,
|
|
2905
|
-
|
|
2806
|
+
algoOrdType: "contract_dca",
|
|
2906
2807
|
after: readString(args, "after"),
|
|
2907
2808
|
before: readString(args, "before"),
|
|
2908
2809
|
limit: readNumber(args, "limit")
|
|
@@ -2978,9 +2879,6 @@ function registerFuturesTools() {
|
|
|
2978
2879
|
type: "string",
|
|
2979
2880
|
description: "Client order ID (max 32 chars)"
|
|
2980
2881
|
},
|
|
2981
|
-
tag: {
|
|
2982
|
-
type: "string"
|
|
2983
|
-
},
|
|
2984
2882
|
tpTriggerPx: {
|
|
2985
2883
|
type: "string",
|
|
2986
2884
|
description: "TP trigger price; places TP at tpOrdPx"
|
|
@@ -3021,7 +2919,7 @@ function registerFuturesTools() {
|
|
|
3021
2919
|
px: readString(args, "px"),
|
|
3022
2920
|
reduceOnly: typeof reduceOnly === "boolean" ? String(reduceOnly) : void 0,
|
|
3023
2921
|
clOrdId: readString(args, "clOrdId"),
|
|
3024
|
-
tag:
|
|
2922
|
+
tag: context.config.sourceTag,
|
|
3025
2923
|
attachAlgoOrds
|
|
3026
2924
|
}),
|
|
3027
2925
|
privateRateLimit("futures_place_order", 60)
|
|
@@ -3818,9 +3716,6 @@ function registerOptionTools() {
|
|
|
3818
3716
|
clOrdId: {
|
|
3819
3717
|
type: "string",
|
|
3820
3718
|
description: "Client order ID (max 32 chars)"
|
|
3821
|
-
},
|
|
3822
|
-
tag: {
|
|
3823
|
-
type: "string"
|
|
3824
3719
|
}
|
|
3825
3720
|
},
|
|
3826
3721
|
required: ["instId", "tdMode", "side", "ordType", "sz"]
|
|
@@ -3839,7 +3734,7 @@ function registerOptionTools() {
|
|
|
3839
3734
|
px: readString(args, "px"),
|
|
3840
3735
|
reduceOnly: typeof reduceOnly === "boolean" ? String(reduceOnly) : void 0,
|
|
3841
3736
|
clOrdId: readString(args, "clOrdId"),
|
|
3842
|
-
tag:
|
|
3737
|
+
tag: context.config.sourceTag
|
|
3843
3738
|
}),
|
|
3844
3739
|
privateRateLimit("option_place_order", 60)
|
|
3845
3740
|
);
|
|
@@ -4193,9 +4088,6 @@ function registerSpotTradeTools() {
|
|
|
4193
4088
|
type: "string",
|
|
4194
4089
|
description: "Client order ID (max 32 chars)"
|
|
4195
4090
|
},
|
|
4196
|
-
tag: {
|
|
4197
|
-
type: "string"
|
|
4198
|
-
},
|
|
4199
4091
|
tpTriggerPx: {
|
|
4200
4092
|
type: "string",
|
|
4201
4093
|
description: "TP trigger price; places TP at tpOrdPx"
|
|
@@ -4233,7 +4125,7 @@ function registerSpotTradeTools() {
|
|
|
4233
4125
|
sz: requireString(args, "sz"),
|
|
4234
4126
|
px: readString(args, "px"),
|
|
4235
4127
|
clOrdId: readString(args, "clOrdId"),
|
|
4236
|
-
tag:
|
|
4128
|
+
tag: context.config.sourceTag,
|
|
4237
4129
|
attachAlgoOrds
|
|
4238
4130
|
}),
|
|
4239
4131
|
privateRateLimit("spot_place_order", 60)
|
|
@@ -4457,7 +4349,8 @@ function registerSpotTradeTools() {
|
|
|
4457
4349
|
tpTriggerPx: readString(args, "tpTriggerPx"),
|
|
4458
4350
|
tpOrdPx: readString(args, "tpOrdPx"),
|
|
4459
4351
|
slTriggerPx: readString(args, "slTriggerPx"),
|
|
4460
|
-
slOrdPx: readString(args, "slOrdPx")
|
|
4352
|
+
slOrdPx: readString(args, "slOrdPx"),
|
|
4353
|
+
tag: context.config.sourceTag
|
|
4461
4354
|
}),
|
|
4462
4355
|
privateRateLimit("spot_place_algo_order", 20)
|
|
4463
4356
|
);
|
|
@@ -4724,6 +4617,7 @@ function registerSpotTradeTools() {
|
|
|
4724
4617
|
sz: requireString(o, "sz"),
|
|
4725
4618
|
px: readString(o, "px"),
|
|
4726
4619
|
clOrdId: readString(o, "clOrdId"),
|
|
4620
|
+
tag: context.config.sourceTag,
|
|
4727
4621
|
attachAlgoOrds
|
|
4728
4622
|
});
|
|
4729
4623
|
}) : orders;
|
|
@@ -4892,9 +4786,6 @@ function registerSwapTradeTools() {
|
|
|
4892
4786
|
type: "string",
|
|
4893
4787
|
description: "Client order ID (max 32 chars)"
|
|
4894
4788
|
},
|
|
4895
|
-
tag: {
|
|
4896
|
-
type: "string"
|
|
4897
|
-
},
|
|
4898
4789
|
tpTriggerPx: {
|
|
4899
4790
|
type: "string",
|
|
4900
4791
|
description: "TP trigger price; places TP at tpOrdPx"
|
|
@@ -4935,7 +4826,7 @@ function registerSwapTradeTools() {
|
|
|
4935
4826
|
px: readString(args, "px"),
|
|
4936
4827
|
reduceOnly: typeof reduceOnly === "boolean" ? String(reduceOnly) : void 0,
|
|
4937
4828
|
clOrdId: readString(args, "clOrdId"),
|
|
4938
|
-
tag:
|
|
4829
|
+
tag: context.config.sourceTag,
|
|
4939
4830
|
attachAlgoOrds
|
|
4940
4831
|
}),
|
|
4941
4832
|
privateRateLimit("swap_place_order", 60)
|
|
@@ -5307,9 +5198,6 @@ function registerSwapTradeTools() {
|
|
|
5307
5198
|
clOrdId: {
|
|
5308
5199
|
type: "string",
|
|
5309
5200
|
description: "Client order ID for close order"
|
|
5310
|
-
},
|
|
5311
|
-
tag: {
|
|
5312
|
-
type: "string"
|
|
5313
5201
|
}
|
|
5314
5202
|
},
|
|
5315
5203
|
required: ["instId", "mgnMode"]
|
|
@@ -5325,7 +5213,7 @@ function registerSwapTradeTools() {
|
|
|
5325
5213
|
posSide: readString(args, "posSide"),
|
|
5326
5214
|
autoCxl: typeof autoCxl === "boolean" ? String(autoCxl) : void 0,
|
|
5327
5215
|
clOrdId: readString(args, "clOrdId"),
|
|
5328
|
-
tag:
|
|
5216
|
+
tag: context.config.sourceTag
|
|
5329
5217
|
}),
|
|
5330
5218
|
privateRateLimit("swap_close_position", 20)
|
|
5331
5219
|
);
|
|
@@ -5386,6 +5274,7 @@ function registerSwapTradeTools() {
|
|
|
5386
5274
|
posSide: readString(o, "posSide"),
|
|
5387
5275
|
reduceOnly: typeof reduceOnly === "boolean" ? String(reduceOnly) : void 0,
|
|
5388
5276
|
clOrdId: readString(o, "clOrdId"),
|
|
5277
|
+
tag: context.config.sourceTag,
|
|
5389
5278
|
attachAlgoOrds
|
|
5390
5279
|
});
|
|
5391
5280
|
}) : orders;
|
|
@@ -5620,7 +5509,8 @@ function loadConfig(cli) {
|
|
|
5620
5509
|
readOnly: cli.readOnly,
|
|
5621
5510
|
demo,
|
|
5622
5511
|
site,
|
|
5623
|
-
userAgent: cli.userAgent
|
|
5512
|
+
userAgent: cli.userAgent,
|
|
5513
|
+
sourceTag: cli.sourceTag ?? DEFAULT_SOURCE_TAG
|
|
5624
5514
|
};
|
|
5625
5515
|
}
|
|
5626
5516
|
var CACHE_FILE = join2(homedir2(), ".okx", "update-check.json");
|
|
@@ -5844,7 +5734,8 @@ function loadProfileConfig(opts) {
|
|
|
5844
5734
|
readOnly: opts.readOnly ?? false,
|
|
5845
5735
|
demo: opts.demo ?? false,
|
|
5846
5736
|
site: opts.site,
|
|
5847
|
-
userAgent: opts.userAgent
|
|
5737
|
+
userAgent: opts.userAgent,
|
|
5738
|
+
sourceTag: opts.sourceTag
|
|
5848
5739
|
});
|
|
5849
5740
|
}
|
|
5850
5741
|
|
|
@@ -6222,27 +6113,27 @@ var HELP_TREE = {
|
|
|
6222
6113
|
}
|
|
6223
6114
|
},
|
|
6224
6115
|
dca: {
|
|
6225
|
-
description: "DCA (
|
|
6116
|
+
description: "Contract DCA (Martingale) bot \u2014 leveraged recurring buys on futures/swaps",
|
|
6226
6117
|
commands: {
|
|
6227
6118
|
orders: {
|
|
6228
|
-
usage: "okx bot dca orders [--
|
|
6229
|
-
description: "List active or historical DCA bot orders"
|
|
6119
|
+
usage: "okx bot dca orders [--history]",
|
|
6120
|
+
description: "List active or historical Contract DCA bot orders"
|
|
6230
6121
|
},
|
|
6231
6122
|
details: {
|
|
6232
|
-
usage: "okx bot dca details
|
|
6233
|
-
description: "Get details of a specific DCA bot order"
|
|
6123
|
+
usage: "okx bot dca details --algoId <id>",
|
|
6124
|
+
description: "Get details of a specific Contract DCA bot order"
|
|
6234
6125
|
},
|
|
6235
6126
|
"sub-orders": {
|
|
6236
|
-
usage: "okx bot dca sub-orders
|
|
6237
|
-
description: "List
|
|
6127
|
+
usage: "okx bot dca sub-orders --algoId <id> [--cycleId <id>]",
|
|
6128
|
+
description: "List cycles or orders within a cycle of a Contract DCA bot"
|
|
6238
6129
|
},
|
|
6239
6130
|
create: {
|
|
6240
|
-
usage: "okx bot dca create --instId <id> --
|
|
6241
|
-
description: "Create a new DCA bot order"
|
|
6131
|
+
usage: "okx bot dca create --instId <id> --lever <n> --direction <long|short>\n --initOrdAmt <n> --maxSafetyOrds <n> --tpPct <n>\n [--safetyOrdAmt <n>] [--pxSteps <n>] [--pxStepsMult <n>] [--volMult <n>]\n [--slPct <n>] [--slMode <limit|market>]\n [--allowReinvest <true|false>] [--triggerStrategy <instant|price|rsi>] [--triggerPx <price>]\n Note: safetyOrdAmt, pxSteps, pxStepsMult, volMult are required when maxSafetyOrds > 0",
|
|
6132
|
+
description: "Create a new Contract DCA bot order"
|
|
6242
6133
|
},
|
|
6243
6134
|
stop: {
|
|
6244
|
-
usage: "okx bot dca stop
|
|
6245
|
-
description: "Stop a running DCA bot order"
|
|
6135
|
+
usage: "okx bot dca stop --algoId <id>",
|
|
6136
|
+
description: "Stop a running Contract DCA bot order"
|
|
6246
6137
|
}
|
|
6247
6138
|
}
|
|
6248
6139
|
}
|
|
@@ -6471,8 +6362,7 @@ var CLI_OPTIONS = {
|
|
|
6471
6362
|
autoCxl: { type: "boolean", default: false },
|
|
6472
6363
|
clOrdId: { type: "string" },
|
|
6473
6364
|
newPx: { type: "string" },
|
|
6474
|
-
// dca bot
|
|
6475
|
-
type: { type: "string" },
|
|
6365
|
+
// dca bot (contract only)
|
|
6476
6366
|
initOrdAmt: { type: "string" },
|
|
6477
6367
|
safetyOrdAmt: { type: "string" },
|
|
6478
6368
|
maxSafetyOrds: { type: "string" },
|
|
@@ -6481,8 +6371,10 @@ var CLI_OPTIONS = {
|
|
|
6481
6371
|
volMult: { type: "string" },
|
|
6482
6372
|
tpPct: { type: "string" },
|
|
6483
6373
|
slPct: { type: "string" },
|
|
6484
|
-
|
|
6485
|
-
|
|
6374
|
+
slMode: { type: "string" },
|
|
6375
|
+
allowReinvest: { type: "string" },
|
|
6376
|
+
triggerStrategy: { type: "string" },
|
|
6377
|
+
triggerPx: { type: "string" },
|
|
6486
6378
|
cycleId: { type: "string" },
|
|
6487
6379
|
// i18n
|
|
6488
6380
|
lang: { type: "string" },
|
|
@@ -8238,21 +8130,21 @@ async function cmdGridStop(run, opts) {
|
|
|
8238
8130
|
}
|
|
8239
8131
|
async function cmdDcaCreate(run, opts) {
|
|
8240
8132
|
const result = await run("dca_create_order", {
|
|
8241
|
-
type: opts.type,
|
|
8242
8133
|
instId: opts.instId,
|
|
8134
|
+
lever: opts.lever,
|
|
8135
|
+
direction: opts.direction,
|
|
8243
8136
|
initOrdAmt: opts.initOrdAmt,
|
|
8244
|
-
safetyOrdAmt: opts.safetyOrdAmt,
|
|
8245
8137
|
maxSafetyOrds: opts.maxSafetyOrds,
|
|
8138
|
+
tpPct: opts.tpPct,
|
|
8139
|
+
safetyOrdAmt: opts.safetyOrdAmt,
|
|
8246
8140
|
pxSteps: opts.pxSteps,
|
|
8247
8141
|
pxStepsMult: opts.pxStepsMult,
|
|
8248
8142
|
volMult: opts.volMult,
|
|
8249
|
-
tpPct: opts.tpPct,
|
|
8250
8143
|
slPct: opts.slPct,
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
side: opts.side
|
|
8144
|
+
slMode: opts.slMode,
|
|
8145
|
+
allowReinvest: opts.allowReinvest,
|
|
8146
|
+
triggerStrategy: opts.triggerStrategy,
|
|
8147
|
+
triggerPx: opts.triggerPx
|
|
8256
8148
|
});
|
|
8257
8149
|
const data = getData7(result);
|
|
8258
8150
|
if (opts.json) return printJson(data);
|
|
@@ -8264,10 +8156,7 @@ async function cmdDcaCreate(run, opts) {
|
|
|
8264
8156
|
}
|
|
8265
8157
|
async function cmdDcaStop(run, opts) {
|
|
8266
8158
|
const result = await run("dca_stop_order", {
|
|
8267
|
-
|
|
8268
|
-
algoId: opts.algoId,
|
|
8269
|
-
instId: opts.instId,
|
|
8270
|
-
stopType: opts.stopType
|
|
8159
|
+
algoId: opts.algoId
|
|
8271
8160
|
});
|
|
8272
8161
|
const data = getData7(result);
|
|
8273
8162
|
if (opts.json) return printJson(data);
|
|
@@ -8279,7 +8168,6 @@ async function cmdDcaStop(run, opts) {
|
|
|
8279
8168
|
}
|
|
8280
8169
|
async function cmdDcaOrders(run, opts) {
|
|
8281
8170
|
const result = await run("dca_get_orders", {
|
|
8282
|
-
type: opts.type,
|
|
8283
8171
|
status: opts.history ? "history" : "active"
|
|
8284
8172
|
});
|
|
8285
8173
|
const orders = getData7(result) ?? [];
|
|
@@ -8301,7 +8189,6 @@ async function cmdDcaOrders(run, opts) {
|
|
|
8301
8189
|
}
|
|
8302
8190
|
async function cmdDcaDetails(run, opts) {
|
|
8303
8191
|
const result = await run("dca_get_order_details", {
|
|
8304
|
-
type: opts.type,
|
|
8305
8192
|
algoId: opts.algoId
|
|
8306
8193
|
});
|
|
8307
8194
|
const detail = (getData7(result) ?? [])[0];
|
|
@@ -8310,44 +8197,26 @@ async function cmdDcaDetails(run, opts) {
|
|
|
8310
8197
|
return;
|
|
8311
8198
|
}
|
|
8312
8199
|
if (opts.json) return printJson(detail);
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
});
|
|
8329
|
-
} else {
|
|
8330
|
-
printKv({
|
|
8331
|
-
algoId: detail["algoId"],
|
|
8332
|
-
instId: detail["instId"],
|
|
8333
|
-
state: detail["state"],
|
|
8334
|
-
initOrdAmt: detail["initOrdAmt"],
|
|
8335
|
-
safetyOrdAmt: detail["safetyOrdAmt"],
|
|
8336
|
-
maxSafetyOrds: detail["maxSafetyOrds"],
|
|
8337
|
-
tpPct: detail["tpPct"],
|
|
8338
|
-
slPct: detail["slPct"],
|
|
8339
|
-
pnl: detail["pnl"],
|
|
8340
|
-
pnlRatio: detail["pnlRatio"],
|
|
8341
|
-
createdAt: new Date(Number(detail["cTime"])).toLocaleString()
|
|
8342
|
-
});
|
|
8343
|
-
}
|
|
8200
|
+
printKv({
|
|
8201
|
+
algoId: detail["algoId"],
|
|
8202
|
+
instId: detail["instId"],
|
|
8203
|
+
sz: detail["sz"],
|
|
8204
|
+
avgPx: detail["avgPx"],
|
|
8205
|
+
initPx: detail["initPx"],
|
|
8206
|
+
tpPx: detail["tpPx"],
|
|
8207
|
+
slPx: detail["slPx"] || "-",
|
|
8208
|
+
upl: detail["upl"],
|
|
8209
|
+
fee: detail["fee"],
|
|
8210
|
+
fundingFee: detail["fundingFee"],
|
|
8211
|
+
curCycleId: detail["curCycleId"],
|
|
8212
|
+
fillSafetyOrds: detail["fillSafetyOrds"],
|
|
8213
|
+
createdAt: new Date(Number(detail["startTime"])).toLocaleString()
|
|
8214
|
+
});
|
|
8344
8215
|
}
|
|
8345
8216
|
async function cmdDcaSubOrders(run, opts) {
|
|
8346
8217
|
const result = await run("dca_get_sub_orders", {
|
|
8347
|
-
type: opts.type,
|
|
8348
8218
|
algoId: opts.algoId,
|
|
8349
|
-
|
|
8350
|
-
cycleId: opts.type === "contract" ? opts.cycleId : void 0
|
|
8219
|
+
cycleId: opts.cycleId
|
|
8351
8220
|
});
|
|
8352
8221
|
const orders = getData7(result) ?? [];
|
|
8353
8222
|
if (opts.json) return printJson(orders);
|
|
@@ -8355,39 +8224,24 @@ async function cmdDcaSubOrders(run, opts) {
|
|
|
8355
8224
|
process.stdout.write("No sub-orders\n");
|
|
8356
8225
|
return;
|
|
8357
8226
|
}
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
);
|
|
8371
|
-
} else {
|
|
8372
|
-
printTable(
|
|
8373
|
-
orders.map((o) => ({
|
|
8374
|
-
ordId: o["ordId"],
|
|
8375
|
-
side: o["side"],
|
|
8376
|
-
px: o["px"],
|
|
8377
|
-
sz: o["sz"],
|
|
8378
|
-
fillPx: o["fillPx"],
|
|
8379
|
-
fillSz: o["fillSz"],
|
|
8380
|
-
state: o["state"],
|
|
8381
|
-
fee: o["fee"]
|
|
8382
|
-
}))
|
|
8383
|
-
);
|
|
8384
|
-
}
|
|
8227
|
+
printTable(
|
|
8228
|
+
orders.map((o) => ({
|
|
8229
|
+
cycleId: o["cycleId"],
|
|
8230
|
+
status: o["cycleStatus"],
|
|
8231
|
+
current: o["currentCycle"] ? "yes" : "",
|
|
8232
|
+
avgPx: o["avgPx"],
|
|
8233
|
+
tpPx: o["tpPx"],
|
|
8234
|
+
realizedPnl: o["realizedPnl"],
|
|
8235
|
+
fee: o["fee"],
|
|
8236
|
+
startTime: o["startTime"] ? new Date(Number(o["startTime"])).toLocaleString() : ""
|
|
8237
|
+
}))
|
|
8238
|
+
);
|
|
8385
8239
|
}
|
|
8386
8240
|
|
|
8387
8241
|
// src/index.ts
|
|
8388
8242
|
var _require = createRequire(import.meta.url);
|
|
8389
8243
|
var CLI_VERSION = _require("../package.json").version;
|
|
8390
|
-
var GIT_HASH = true ? "
|
|
8244
|
+
var GIT_HASH = true ? "63e2e31" : "dev";
|
|
8391
8245
|
function handleConfigCommand(action, rest, json, lang, force) {
|
|
8392
8246
|
if (action === "init") return cmdConfigInit(lang === "zh" ? "zh" : "en");
|
|
8393
8247
|
if (action === "show") return cmdConfigShow(json);
|
|
@@ -8805,34 +8659,33 @@ function handleBotGridCommand(run, v, rest, json) {
|
|
|
8805
8659
|
});
|
|
8806
8660
|
}
|
|
8807
8661
|
function handleBotDcaCommand(run, subAction, v, json) {
|
|
8808
|
-
const type = v.type ?? "spot";
|
|
8809
8662
|
if (subAction === "orders")
|
|
8810
|
-
return cmdDcaOrders(run, {
|
|
8663
|
+
return cmdDcaOrders(run, { history: v.history ?? false, json });
|
|
8811
8664
|
if (subAction === "details")
|
|
8812
|
-
return cmdDcaDetails(run, {
|
|
8665
|
+
return cmdDcaDetails(run, { algoId: v.algoId, json });
|
|
8813
8666
|
if (subAction === "sub-orders")
|
|
8814
|
-
return cmdDcaSubOrders(run, {
|
|
8667
|
+
return cmdDcaSubOrders(run, { algoId: v.algoId, cycleId: v.cycleId, json });
|
|
8815
8668
|
if (subAction === "create")
|
|
8816
8669
|
return cmdDcaCreate(run, {
|
|
8817
|
-
type,
|
|
8818
8670
|
instId: v.instId,
|
|
8671
|
+
lever: v.lever,
|
|
8672
|
+
direction: v.direction,
|
|
8819
8673
|
initOrdAmt: v.initOrdAmt,
|
|
8820
|
-
safetyOrdAmt: v.safetyOrdAmt,
|
|
8821
8674
|
maxSafetyOrds: v.maxSafetyOrds,
|
|
8675
|
+
tpPct: v.tpPct,
|
|
8676
|
+
safetyOrdAmt: v.safetyOrdAmt,
|
|
8822
8677
|
pxSteps: v.pxSteps,
|
|
8823
8678
|
pxStepsMult: v.pxStepsMult,
|
|
8824
8679
|
volMult: v.volMult,
|
|
8825
|
-
tpPct: v.tpPct,
|
|
8826
8680
|
slPct: v.slPct,
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
side: v.side,
|
|
8681
|
+
slMode: v.slMode,
|
|
8682
|
+
allowReinvest: v.allowReinvest,
|
|
8683
|
+
triggerStrategy: v.triggerStrategy,
|
|
8684
|
+
triggerPx: v.triggerPx,
|
|
8832
8685
|
json
|
|
8833
8686
|
});
|
|
8834
8687
|
if (subAction === "stop")
|
|
8835
|
-
return cmdDcaStop(run, {
|
|
8688
|
+
return cmdDcaStop(run, { algoId: v.algoId, json });
|
|
8836
8689
|
}
|
|
8837
8690
|
function handleBotCommand(run, action, rest, v, json) {
|
|
8838
8691
|
if (action === "grid") return handleBotGridCommand(run, v, rest, json);
|
|
@@ -8862,7 +8715,7 @@ async function main() {
|
|
|
8862
8715
|
const json = v.json ?? false;
|
|
8863
8716
|
if (module === "config") return handleConfigCommand(action, rest, json, v.lang, v.force);
|
|
8864
8717
|
if (module === "setup") return handleSetupCommand(v);
|
|
8865
|
-
const config = loadProfileConfig({ profile: v.profile, demo: v.demo, userAgent: `okx-trade-cli/${CLI_VERSION}
|
|
8718
|
+
const config = loadProfileConfig({ profile: v.profile, demo: v.demo, userAgent: `okx-trade-cli/${CLI_VERSION}`, sourceTag: "CLI" });
|
|
8866
8719
|
const client = new OkxRestClient(config);
|
|
8867
8720
|
const run = createToolRunner(client, config);
|
|
8868
8721
|
if (module === "market") return handleMarketCommand(run, action, rest, v, json);
|