@okx_ai/okx-trade-cli 1.2.5-beta.4 → 1.2.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 CHANGED
@@ -3196,7 +3196,7 @@ function registerEarnTools() {
3196
3196
  {
3197
3197
  name: "earn_get_savings_balance",
3198
3198
  module: "earn.savings",
3199
- description: "Get Simple Earn (savings/flexible earn) balance. Returns current holdings for all currencies or a specific one. To show market rates alongside balance (\u5E02\u573A\u5747\u5229\u7387), call earn_get_lending_rate_history \u2014 do NOT use earn_get_lending_rate_summary for this purpose. Private endpoint. Rate limit: 6 req/s.",
3199
+ description: "Get Simple Earn (savings/flexible earn) balance. Returns current holdings for all currencies or a specific one. To show market rates alongside balance (\u5E02\u573A\u5747\u5229\u7387), call earn_get_lending_rate_history \u2014 do NOT use earn_get_lending_rate_summary for this purpose.",
3200
3200
  isWrite: false,
3201
3201
  inputSchema: {
3202
3202
  type: "object",
@@ -3220,7 +3220,7 @@ function registerEarnTools() {
3220
3220
  {
3221
3221
  name: "earn_savings_purchase",
3222
3222
  module: "earn.savings",
3223
- description: "Purchase Simple Earn (savings/flexible earn). [CAUTION] Moves real funds into earn product. Not supported in demo/simulated trading mode. Private endpoint. Rate limit: 6 req/s.",
3223
+ description: "Purchase Simple Earn (savings/flexible earn). [CAUTION] Moves real funds into earn product.",
3224
3224
  isWrite: true,
3225
3225
  inputSchema: {
3226
3226
  type: "object",
@@ -3259,7 +3259,7 @@ function registerEarnTools() {
3259
3259
  {
3260
3260
  name: "earn_savings_redeem",
3261
3261
  module: "earn.savings",
3262
- description: "Redeem Simple Earn (savings/flexible earn). [CAUTION] Withdraws funds from earn product. Not supported in demo/simulated trading mode. Private endpoint. Rate limit: 6 req/s.",
3262
+ description: "Redeem Simple Earn (savings/flexible earn). [CAUTION] Withdraws funds from earn product.",
3263
3263
  isWrite: true,
3264
3264
  inputSchema: {
3265
3265
  type: "object",
@@ -3293,7 +3293,7 @@ function registerEarnTools() {
3293
3293
  {
3294
3294
  name: "earn_set_lending_rate",
3295
3295
  module: "earn.savings",
3296
- description: "Set lending rate for Simple Earn. [CAUTION] Changes your lending rate preference. Not supported in demo/simulated trading mode. Private endpoint. Rate limit: 6 req/s.",
3296
+ description: "Set lending rate for Simple Earn. [CAUTION] Changes your lending rate preference.",
3297
3297
  isWrite: true,
3298
3298
  inputSchema: {
3299
3299
  type: "object",
@@ -3326,7 +3326,7 @@ function registerEarnTools() {
3326
3326
  {
3327
3327
  name: "earn_get_lending_history",
3328
3328
  module: "earn.savings",
3329
- description: "Get market lending rate history for Simple Earn. Use this tool to query market lending rates. Returns market lending records with amount, rate, and earnings data. Private endpoint. Rate limit: 6 req/s.",
3329
+ description: "Get market lending rate history for Simple Earn. Use this tool to query market lending rates. Returns market lending records with amount, rate, and earnings data.",
3330
3330
  isWrite: false,
3331
3331
  inputSchema: {
3332
3332
  type: "object",
@@ -3367,7 +3367,7 @@ function registerEarnTools() {
3367
3367
  {
3368
3368
  name: "earn_get_lending_rate_summary",
3369
3369
  module: "earn.savings",
3370
- description: "Get coin lending market rate summary. NOT related to Simple Earn. Public endpoint (no API key required). Use this to query the lending/borrowing market rates (\u501F\u5E01\u5E02\u573A\u5229\u7387). Returns aggregate overview: average rate (avgRate), estimated next-cycle rate (estRate), previous-cycle rate (preRate), and available lending amounts. Rate limit: 6 req/s.",
3370
+ description: "Get coin lending market rate summary. NOT related to Simple Earn. Use this to query the lending/borrowing market rates (\u501F\u5E01\u5E02\u573A\u5229\u7387). Returns aggregate overview: average rate (avgRate), estimated next-cycle rate (estRate), previous-cycle rate (preRate), and available lending amounts.",
3371
3371
  isWrite: false,
3372
3372
  inputSchema: {
3373
3373
  type: "object",
@@ -3391,7 +3391,7 @@ function registerEarnTools() {
3391
3391
  {
3392
3392
  name: "earn_get_lending_rate_history",
3393
3393
  module: "earn.savings",
3394
- description: "Query Simple Earn lending rates. Public endpoint (no API key required). Use this tool when the user asks about current or historical lending rates for Simple Earn, or when displaying savings balance with market rate context (\u5E02\u573A\u5747\u5229\u7387). Returns actual settled lending rate records (lendingRate field) with timestamps, ordered newest-first. Rate limit: 6 req/s.",
3394
+ description: "Query Simple Earn lending rates. Use this tool when the user asks about current or historical lending rates for Simple Earn, or when displaying savings balance with market rate context (\u5E02\u573A\u5747\u5229\u7387). Returns actual settled lending rate records (lendingRate field) with timestamps, ordered newest-first.",
3395
3395
  isWrite: false,
3396
3396
  inputSchema: {
3397
3397
  type: "object",
@@ -3439,22 +3439,22 @@ function registerOnchainEarnTools() {
3439
3439
  {
3440
3440
  name: "onchain_earn_get_offers",
3441
3441
  module: "earn.onchain",
3442
- description: "Get available on-chain earn (staking/DeFi) offers. Returns investment products with protocol name, APY, terms, and limits. Always display the protocol name (protocol field) and earnings currency (earningData[].ccy field) when showing offers to the user. Private endpoint. Rate limit: 3 req/s.",
3442
+ description: "List staking/DeFi products with APY, terms, and limits. Always show protocol name (protocol field) and earnings currency (earningData[].ccy) when presenting results.",
3443
3443
  isWrite: false,
3444
3444
  inputSchema: {
3445
3445
  type: "object",
3446
3446
  properties: {
3447
3447
  productId: {
3448
3448
  type: "string",
3449
- description: "Specific product ID to query. Omit for all offers."
3449
+ description: "Product ID filter."
3450
3450
  },
3451
3451
  protocolType: {
3452
3452
  type: "string",
3453
- description: "Protocol type filter: staking, defi. Omit for all types."
3453
+ description: "staking|defi"
3454
3454
  },
3455
3455
  ccy: {
3456
3456
  type: "string",
3457
- description: "Currency filter, e.g. ETH. Omit for all currencies."
3457
+ description: "e.g. ETH"
3458
3458
  }
3459
3459
  }
3460
3460
  },
@@ -3478,34 +3478,34 @@ function registerOnchainEarnTools() {
3478
3478
  {
3479
3479
  name: "onchain_earn_purchase",
3480
3480
  module: "earn.onchain",
3481
- description: "Purchase on-chain earn (staking/DeFi) product. [CAUTION] Moves real funds into staking/DeFi product. Not supported in demo/simulated trading mode. Private endpoint. Rate limit: 2 req/s.",
3481
+ description: "Invest in a staking/DeFi product. [CAUTION] Moves real funds. Not available in demo mode.",
3482
3482
  isWrite: true,
3483
3483
  inputSchema: {
3484
3484
  type: "object",
3485
3485
  properties: {
3486
3486
  productId: {
3487
3487
  type: "string",
3488
- description: "Product ID to purchase"
3488
+ description: "Product ID"
3489
3489
  },
3490
3490
  investData: {
3491
3491
  type: "array",
3492
- description: "Investment data array: [{ccy, amt}]. Each item specifies currency and amount.",
3492
+ description: "Array of {ccy, amt} to invest.",
3493
3493
  items: {
3494
3494
  type: "object",
3495
3495
  properties: {
3496
- ccy: { type: "string", description: "Currency, e.g. ETH" },
3497
- amt: { type: "string", description: "Amount to invest" }
3496
+ ccy: { type: "string", description: "e.g. ETH" },
3497
+ amt: { type: "string" }
3498
3498
  },
3499
3499
  required: ["ccy", "amt"]
3500
3500
  }
3501
3501
  },
3502
3502
  term: {
3503
3503
  type: "string",
3504
- description: "Investment term in days. Required for fixed-term products."
3504
+ description: "Investment term in days, required for fixed-term products."
3505
3505
  },
3506
3506
  tag: {
3507
3507
  type: "string",
3508
- description: "Order tag for tracking (optional)."
3508
+ description: "Order tag."
3509
3509
  }
3510
3510
  },
3511
3511
  required: ["productId", "investData"]
@@ -3532,22 +3532,22 @@ function registerOnchainEarnTools() {
3532
3532
  {
3533
3533
  name: "onchain_earn_redeem",
3534
3534
  module: "earn.onchain",
3535
- description: "Redeem on-chain earn (staking/DeFi) investment. [CAUTION] Withdraws funds from staking/DeFi product. Some products may have lock periods. Not supported in demo mode. Private endpoint. Rate limit: 2 req/s.",
3535
+ description: "Redeem a staking/DeFi investment. [CAUTION] Some products have lock periods, early redemption may incur penalties. Not available in demo mode.",
3536
3536
  isWrite: true,
3537
3537
  inputSchema: {
3538
3538
  type: "object",
3539
3539
  properties: {
3540
3540
  ordId: {
3541
3541
  type: "string",
3542
- description: "Order ID to redeem"
3542
+ description: "Order ID"
3543
3543
  },
3544
3544
  protocolType: {
3545
3545
  type: "string",
3546
- description: "Protocol type: staking, defi"
3546
+ description: "staking|defi"
3547
3547
  },
3548
3548
  allowEarlyRedeem: {
3549
3549
  type: "boolean",
3550
- description: "Allow early redemption for fixed-term products (may incur penalties). Default false."
3550
+ description: "Allow early exit for fixed-term products, may incur penalties. Default: false."
3551
3551
  }
3552
3552
  },
3553
3553
  required: ["ordId", "protocolType"]
@@ -3573,18 +3573,18 @@ function registerOnchainEarnTools() {
3573
3573
  {
3574
3574
  name: "onchain_earn_cancel",
3575
3575
  module: "earn.onchain",
3576
- description: "Cancel pending on-chain earn purchase. [CAUTION] Cancels a pending investment order. Not supported in demo mode. Private endpoint. Rate limit: 2 req/s.",
3576
+ description: "Cancel a pending staking/DeFi purchase order. [CAUTION] Not available in demo mode.",
3577
3577
  isWrite: true,
3578
3578
  inputSchema: {
3579
3579
  type: "object",
3580
3580
  properties: {
3581
3581
  ordId: {
3582
3582
  type: "string",
3583
- description: "Order ID to cancel"
3583
+ description: "Order ID"
3584
3584
  },
3585
3585
  protocolType: {
3586
3586
  type: "string",
3587
- description: "Protocol type: staking, defi"
3587
+ description: "staking|defi"
3588
3588
  }
3589
3589
  },
3590
3590
  required: ["ordId", "protocolType"]
@@ -3609,26 +3609,26 @@ function registerOnchainEarnTools() {
3609
3609
  {
3610
3610
  name: "onchain_earn_get_active_orders",
3611
3611
  module: "earn.onchain",
3612
- description: "Get active on-chain earn orders. Returns current staking/DeFi investments. Private endpoint. Rate limit: 3 req/s.",
3612
+ description: "List current active staking/DeFi investments.",
3613
3613
  isWrite: false,
3614
3614
  inputSchema: {
3615
3615
  type: "object",
3616
3616
  properties: {
3617
3617
  productId: {
3618
3618
  type: "string",
3619
- description: "Filter by product ID. Omit for all."
3619
+ description: "Product ID filter."
3620
3620
  },
3621
3621
  protocolType: {
3622
3622
  type: "string",
3623
- description: "Filter by protocol type: staking, defi. Omit for all."
3623
+ description: "staking|defi"
3624
3624
  },
3625
3625
  ccy: {
3626
3626
  type: "string",
3627
- description: "Filter by currency, e.g. ETH. Omit for all."
3627
+ description: "e.g. ETH"
3628
3628
  },
3629
3629
  state: {
3630
3630
  type: "string",
3631
- description: "Filter by state: 8 (pending), 13 (cancelling), 9 (onchain), 1 (earning), 2 (redeeming). Omit for all."
3631
+ description: "8=pending, 13=cancelling, 9=onchain, 1=earning, 2=redeeming"
3632
3632
  }
3633
3633
  }
3634
3634
  },
@@ -3653,34 +3653,34 @@ function registerOnchainEarnTools() {
3653
3653
  {
3654
3654
  name: "onchain_earn_get_order_history",
3655
3655
  module: "earn.onchain",
3656
- description: "Get on-chain earn order history. Returns past staking/DeFi investments including redeemed orders. Private endpoint. Rate limit: 3 req/s.",
3656
+ description: "List past staking/DeFi orders including redeemed ones.",
3657
3657
  isWrite: false,
3658
3658
  inputSchema: {
3659
3659
  type: "object",
3660
3660
  properties: {
3661
3661
  productId: {
3662
3662
  type: "string",
3663
- description: "Filter by product ID. Omit for all."
3663
+ description: "Product ID filter."
3664
3664
  },
3665
3665
  protocolType: {
3666
3666
  type: "string",
3667
- description: "Filter by protocol type: staking, defi. Omit for all."
3667
+ description: "staking|defi"
3668
3668
  },
3669
3669
  ccy: {
3670
3670
  type: "string",
3671
- description: "Filter by currency, e.g. ETH. Omit for all."
3671
+ description: "e.g. ETH"
3672
3672
  },
3673
3673
  after: {
3674
3674
  type: "string",
3675
- description: "Pagination: return results before this order ID"
3675
+ description: "Cursor: results older than this order ID."
3676
3676
  },
3677
3677
  before: {
3678
3678
  type: "string",
3679
- description: "Pagination: return results after this order ID"
3679
+ description: "Cursor: results newer than this order ID."
3680
3680
  },
3681
3681
  limit: {
3682
3682
  type: "string",
3683
- description: "Max results to return (default 100, max 100)"
3683
+ description: "Max results (default 100, max 100)."
3684
3684
  }
3685
3685
  }
3686
3686
  },
@@ -5715,7 +5715,7 @@ function registerSpotTradeTools() {
5715
5715
  {
5716
5716
  name: "spot_place_order",
5717
5717
  module: "spot",
5718
- description: "Place a spot order. Optionally attach TP/SL via tpTriggerPx/slTriggerPx (assembled into attachAlgoOrds automatically). [CAUTION] Executes real trades.",
5718
+ description: "Place a spot order. Attach TP/SL via tpTriggerPx/slTriggerPx. [CAUTION] Executes real trades.",
5719
5719
  isWrite: true,
5720
5720
  inputSchema: {
5721
5721
  type: "object",
@@ -5727,7 +5727,7 @@ function registerSpotTradeTools() {
5727
5727
  tdMode: {
5728
5728
  type: "string",
5729
5729
  enum: ["cash", "cross", "isolated"],
5730
- description: "cash=regular spot; cross/isolated=margin"
5730
+ description: "cash=regular spot, cross/isolated=margin"
5731
5731
  },
5732
5732
  side: {
5733
5733
  type: "string",
@@ -5740,7 +5740,7 @@ function registerSpotTradeTools() {
5740
5740
  },
5741
5741
  sz: {
5742
5742
  type: "string",
5743
- description: "Buy market: quote amount; all others: base amount"
5743
+ description: "Buy market: quote amount, all others: base amount"
5744
5744
  },
5745
5745
  px: {
5746
5746
  type: "string",
@@ -5752,19 +5752,19 @@ function registerSpotTradeTools() {
5752
5752
  },
5753
5753
  tpTriggerPx: {
5754
5754
  type: "string",
5755
- description: "TP trigger price; places TP at tpOrdPx"
5755
+ description: "TP trigger price"
5756
5756
  },
5757
5757
  tpOrdPx: {
5758
5758
  type: "string",
5759
- description: "TP order price; -1=market"
5759
+ description: "TP order price, -1=market"
5760
5760
  },
5761
5761
  slTriggerPx: {
5762
5762
  type: "string",
5763
- description: "SL trigger price; places SL at slOrdPx"
5763
+ description: "SL trigger price"
5764
5764
  },
5765
5765
  slOrdPx: {
5766
5766
  type: "string",
5767
- description: "SL order price; -1=market"
5767
+ description: "SL order price, -1=market"
5768
5768
  }
5769
5769
  },
5770
5770
  required: ["instId", "tdMode", "side", "ordType", "sz"]
@@ -5793,7 +5793,7 @@ function registerSpotTradeTools() {
5793
5793
  {
5794
5794
  name: "spot_cancel_order",
5795
5795
  module: "spot",
5796
- description: "Cancel an unfilled spot order by order ID or client order ID.",
5796
+ description: "Cancel an unfilled spot order.",
5797
5797
  isWrite: true,
5798
5798
  inputSchema: {
5799
5799
  type: "object",
@@ -5806,8 +5806,7 @@ function registerSpotTradeTools() {
5806
5806
  type: "string"
5807
5807
  },
5808
5808
  clOrdId: {
5809
- type: "string",
5810
- description: "Client order ID"
5809
+ type: "string"
5811
5810
  }
5812
5811
  },
5813
5812
  required: ["instId"]
@@ -5839,24 +5838,22 @@ function registerSpotTradeTools() {
5839
5838
  description: "e.g. BTC-USDT"
5840
5839
  },
5841
5840
  ordId: {
5842
- type: "string",
5843
- description: "Order ID"
5841
+ type: "string"
5844
5842
  },
5845
5843
  clOrdId: {
5846
- type: "string",
5847
- description: "Client order ID"
5844
+ type: "string"
5848
5845
  },
5849
5846
  newSz: {
5850
5847
  type: "string",
5851
- description: "New order size in base currency (e.g. BTC amount)"
5848
+ description: "New size in base currency"
5852
5849
  },
5853
5850
  newPx: {
5854
5851
  type: "string",
5855
- description: "New order price"
5852
+ description: "New price"
5856
5853
  },
5857
5854
  newClOrdId: {
5858
5855
  type: "string",
5859
- description: "New client order ID after amendment"
5856
+ description: "Replacement client order ID"
5860
5857
  }
5861
5858
  },
5862
5859
  required: ["instId"]
@@ -5881,15 +5878,14 @@ function registerSpotTradeTools() {
5881
5878
  {
5882
5879
  name: "spot_get_orders",
5883
5880
  module: "spot",
5884
- description: "Query spot open orders, order history (last 7 days), or order archive (up to 3 months).",
5881
+ description: "Query spot orders. status: open(active)|history(7d)|archive(3mo).",
5885
5882
  isWrite: false,
5886
5883
  inputSchema: {
5887
5884
  type: "object",
5888
5885
  properties: {
5889
5886
  status: {
5890
5887
  type: "string",
5891
- enum: ["open", "history", "archive"],
5892
- description: "open=active, history=7d, archive=3mo"
5888
+ enum: ["open", "history", "archive"]
5893
5889
  },
5894
5890
  instId: {
5895
5891
  type: "string",
@@ -5905,11 +5901,11 @@ function registerSpotTradeTools() {
5905
5901
  },
5906
5902
  after: {
5907
5903
  type: "string",
5908
- description: "Pagination: before this order ID"
5904
+ description: "Cursor: older than this order ID"
5909
5905
  },
5910
5906
  before: {
5911
5907
  type: "string",
5912
- description: "Pagination: after this order ID"
5908
+ description: "Cursor: newer than this order ID"
5913
5909
  },
5914
5910
  begin: {
5915
5911
  type: "string",
@@ -5950,7 +5946,7 @@ function registerSpotTradeTools() {
5950
5946
  {
5951
5947
  name: "spot_place_algo_order",
5952
5948
  module: "spot",
5953
- description: "Place a spot algo order: TP/SL (conditional/oco) or trailing stop (move_order_stop). For conditional/oco: use tpTriggerPx, tpOrdPx, slTriggerPx, slOrdPx. For move_order_stop: use callbackRatio (e.g. '0.01'=1%) OR callbackSpread, and optionally activePx. [CAUTION] Executes real trades.",
5949
+ description: "Place a spot algo order: TP/SL (conditional/oco) or trailing stop (move_order_stop). [CAUTION] Executes real trades.",
5954
5950
  isWrite: true,
5955
5951
  inputSchema: {
5956
5952
  type: "object",
@@ -5962,7 +5958,7 @@ function registerSpotTradeTools() {
5962
5958
  tdMode: {
5963
5959
  type: "string",
5964
5960
  enum: ["cash", "cross", "isolated"],
5965
- description: "cash=non-margin spot (default); cross/isolated=margin mode"
5961
+ description: "cash(default)=spot, cross/isolated=margin"
5966
5962
  },
5967
5963
  side: {
5968
5964
  type: "string",
@@ -5971,7 +5967,7 @@ function registerSpotTradeTools() {
5971
5967
  ordType: {
5972
5968
  type: "string",
5973
5969
  enum: ["conditional", "oco", "move_order_stop"],
5974
- description: "conditional=single TP/SL; oco=TP+SL pair (one-cancels-other); move_order_stop=trailing stop"
5970
+ description: "conditional=single TP/SL, oco=TP+SL pair, move_order_stop=trailing stop"
5975
5971
  },
5976
5972
  sz: {
5977
5973
  type: "string",
@@ -5983,7 +5979,7 @@ function registerSpotTradeTools() {
5983
5979
  },
5984
5980
  tpOrdPx: {
5985
5981
  type: "string",
5986
- description: "TP order price; -1=market (conditional/oco only)"
5982
+ description: "TP order price, -1=market (conditional/oco only)"
5987
5983
  },
5988
5984
  slTriggerPx: {
5989
5985
  type: "string",
@@ -5991,19 +5987,19 @@ function registerSpotTradeTools() {
5991
5987
  },
5992
5988
  slOrdPx: {
5993
5989
  type: "string",
5994
- description: "SL order price; -1=market (conditional/oco only)"
5990
+ description: "SL order price, -1=market (conditional/oco only)"
5995
5991
  },
5996
5992
  callbackRatio: {
5997
5993
  type: "string",
5998
- description: "Callback ratio (e.g. '0.01'=1%); provide either ratio or spread (move_order_stop only)"
5994
+ description: "Callback ratio e.g. 0.01=1%, use ratio or spread (move_order_stop only)"
5999
5995
  },
6000
5996
  callbackSpread: {
6001
5997
  type: "string",
6002
- description: "Callback spread in price units; provide either ratio or spread (move_order_stop only)"
5998
+ description: "Callback spread in price units, use ratio or spread (move_order_stop only)"
6003
5999
  },
6004
6000
  activePx: {
6005
6001
  type: "string",
6006
- description: "Activation price; tracking starts after market reaches this level (move_order_stop only)"
6002
+ description: "Activation price, trailing starts when market hits this (move_order_stop only)"
6007
6003
  }
6008
6004
  },
6009
6005
  required: ["instId", "side", "ordType", "sz"]
@@ -6041,12 +6037,12 @@ function registerSpotTradeTools() {
6041
6037
  type: "object",
6042
6038
  properties: {
6043
6039
  instId: { type: "string", description: "e.g. BTC-USDT" },
6044
- algoId: { type: "string", description: "Algo order ID" },
6045
- newSz: { type: "string", description: "New order size in base currency (e.g. BTC amount)" },
6040
+ algoId: { type: "string" },
6041
+ newSz: { type: "string", description: "New size in base currency" },
6046
6042
  newTpTriggerPx: { type: "string", description: "New TP trigger price" },
6047
- newTpOrdPx: { type: "string", description: "New TP order price; -1=market" },
6043
+ newTpOrdPx: { type: "string", description: "New TP order price, -1=market" },
6048
6044
  newSlTriggerPx: { type: "string", description: "New SL trigger price" },
6049
- newSlOrdPx: { type: "string", description: "New SL order price; -1=market" }
6045
+ newSlOrdPx: { type: "string", description: "New SL order price, -1=market" }
6050
6046
  },
6051
6047
  required: ["instId", "algoId"]
6052
6048
  },
@@ -6081,8 +6077,7 @@ function registerSpotTradeTools() {
6081
6077
  description: "e.g. BTC-USDT"
6082
6078
  },
6083
6079
  algoId: {
6084
- type: "string",
6085
- description: "Algo order ID"
6080
+ type: "string"
6086
6081
  }
6087
6082
  },
6088
6083
  required: ["instId", "algoId"]
@@ -6113,7 +6108,7 @@ function registerSpotTradeTools() {
6113
6108
  status: {
6114
6109
  type: "string",
6115
6110
  enum: ["pending", "history"],
6116
- description: "pending=active (default); history=completed"
6111
+ description: "pending=active (default), history=completed"
6117
6112
  },
6118
6113
  instId: {
6119
6114
  type: "string",
@@ -6122,15 +6117,15 @@ function registerSpotTradeTools() {
6122
6117
  ordType: {
6123
6118
  type: "string",
6124
6119
  enum: ["conditional", "oco", "move_order_stop"],
6125
- description: "Filter by type; omit for all"
6120
+ description: "Filter by type"
6126
6121
  },
6127
6122
  after: {
6128
6123
  type: "string",
6129
- description: "Pagination: before this algo ID"
6124
+ description: "Cursor: older than this algo ID"
6130
6125
  },
6131
6126
  before: {
6132
6127
  type: "string",
6133
- description: "Pagination: after this algo ID"
6128
+ description: "Cursor: newer than this algo ID"
6134
6129
  },
6135
6130
  limit: {
6136
6131
  type: "number",
@@ -6139,7 +6134,7 @@ function registerSpotTradeTools() {
6139
6134
  state: {
6140
6135
  type: "string",
6141
6136
  enum: ["effective", "canceled", "order_failed"],
6142
- description: "Required when status=history. effective=triggered, canceled, order_failed. Defaults to effective."
6137
+ description: "Required for history. effective=triggered, canceled, order_failed. Default: effective."
6143
6138
  }
6144
6139
  }
6145
6140
  },
@@ -6182,14 +6177,14 @@ function registerSpotTradeTools() {
6182
6177
  {
6183
6178
  name: "spot_get_fills",
6184
6179
  module: "spot",
6185
- description: "Get spot transaction fill details. archive=false (default): last 3 days; archive=true: up to 3 months.",
6180
+ description: "Get spot transaction fills. archive=false(3d, default)|true(up to 3mo).",
6186
6181
  isWrite: false,
6187
6182
  inputSchema: {
6188
6183
  type: "object",
6189
6184
  properties: {
6190
6185
  archive: {
6191
6186
  type: "boolean",
6192
- description: "true=up to 3 months; false=last 3 days (default)"
6187
+ description: "true=up to 3mo, false=3d (default)"
6193
6188
  },
6194
6189
  instId: {
6195
6190
  type: "string",
@@ -6201,11 +6196,11 @@ function registerSpotTradeTools() {
6201
6196
  },
6202
6197
  after: {
6203
6198
  type: "string",
6204
- description: "Pagination: before this bill ID"
6199
+ description: "Cursor: older than this bill ID"
6205
6200
  },
6206
6201
  before: {
6207
6202
  type: "string",
6208
- description: "Pagination: after this bill ID"
6203
+ description: "Cursor: newer than this bill ID"
6209
6204
  },
6210
6205
  begin: {
6211
6206
  type: "string",
@@ -6245,19 +6240,18 @@ function registerSpotTradeTools() {
6245
6240
  {
6246
6241
  name: "spot_batch_orders",
6247
6242
  module: "spot",
6248
- description: "[CAUTION] Batch place/cancel/amend up to 20 spot orders in one request. Use action='place'/'cancel'/'amend'. Private. Rate limit: 60 req/s.",
6243
+ description: "[CAUTION] Batch place/cancel/amend up to 20 spot orders. action: place|cancel|amend.",
6249
6244
  isWrite: true,
6250
6245
  inputSchema: {
6251
6246
  type: "object",
6252
6247
  properties: {
6253
6248
  action: {
6254
6249
  type: "string",
6255
- enum: ["place", "cancel", "amend"],
6256
- description: "place|cancel|amend"
6250
+ enum: ["place", "cancel", "amend"]
6257
6251
  },
6258
6252
  orders: {
6259
6253
  type: "array",
6260
- description: "Array (max 20). place: {instId,side,ordType,sz,tdMode?,px?,clOrdId?,tpTriggerPx?,tpOrdPx?,slTriggerPx?,slOrdPx?} (tdMode defaults to cash for non-margin accounts; use cross for unified/margin accounts). cancel: {instId,ordId|clOrdId}. amend: {instId,ordId|clOrdId,newSz?,newPx?}.",
6254
+ description: "Array (max 20). place: {instId,side,ordType,sz,tdMode(default cash; use cross for unified/margin accounts),px?,clOrdId?,tpTriggerPx?,tpOrdPx?,slTriggerPx?,slOrdPx?}. cancel: {instId,ordId|clOrdId}. amend: {instId,ordId|clOrdId,newSz?,newPx?}.",
6261
6255
  items: {
6262
6256
  type: "object"
6263
6257
  }
@@ -6304,7 +6298,7 @@ function registerSpotTradeTools() {
6304
6298
  {
6305
6299
  name: "spot_get_order",
6306
6300
  module: "spot",
6307
- description: "Get details of a single spot order by order ID or client order ID.",
6301
+ description: "Get details of a single spot order.",
6308
6302
  isWrite: false,
6309
6303
  inputSchema: {
6310
6304
  type: "object",
@@ -6341,7 +6335,7 @@ function registerSpotTradeTools() {
6341
6335
  {
6342
6336
  name: "spot_batch_amend",
6343
6337
  module: "spot",
6344
- description: "[CAUTION] Batch amend up to 20 unfilled spot orders in one request. Modify price and/or size per order.",
6338
+ description: "[CAUTION] Batch amend up to 20 unfilled spot orders.",
6345
6339
  isWrite: true,
6346
6340
  inputSchema: {
6347
6341
  type: "object",
@@ -6371,7 +6365,7 @@ function registerSpotTradeTools() {
6371
6365
  {
6372
6366
  name: "spot_batch_cancel",
6373
6367
  module: "spot",
6374
- description: "[CAUTION] Batch cancel up to 20 spot orders in one request. Provide instId plus ordId or clOrdId for each order.",
6368
+ description: "[CAUTION] Batch cancel up to 20 spot orders.",
6375
6369
  isWrite: true,
6376
6370
  inputSchema: {
6377
6371
  type: "object",
@@ -7327,7 +7321,7 @@ async function cmdDiagnoseMcp(options = {}) {
7327
7321
 
7328
7322
  // src/commands/diagnose.ts
7329
7323
  var CLI_VERSION = readCliVersion();
7330
- var GIT_HASH = true ? "50eb95e" : "dev";
7324
+ var GIT_HASH = true ? "c00f777" : "dev";
7331
7325
  function maskKey2(key) {
7332
7326
  if (!key) return "(not set)";
7333
7327
  if (key.length <= 8) return "****";
@@ -8992,8 +8986,10 @@ async function cmdSpotPlace(run, opts) {
8992
8986
  process.stdout.write(`Order placed: ${order?.["ordId"]} (${order?.["sCode"] === "0" ? "OK" : order?.["sMsg"]})
8993
8987
  `);
8994
8988
  }
8995
- async function cmdSpotCancel(run, instId, ordId, json) {
8996
- const result = await run("spot_cancel_order", { instId, ordId });
8989
+ async function cmdSpotCancel(run, opts) {
8990
+ const { instId, ordId, clOrdId, json } = opts;
8991
+ if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
8992
+ const result = await run("spot_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
8997
8993
  const data = getData3(result);
8998
8994
  if (json) return printJson(data);
8999
8995
  const r = data?.[0];
@@ -9243,8 +9239,10 @@ async function cmdSwapPlace(run, opts) {
9243
9239
  process.stdout.write(`Order placed: ${order?.["ordId"]} (${order?.["sCode"] === "0" ? "OK" : order?.["sMsg"]})
9244
9240
  `);
9245
9241
  }
9246
- async function cmdSwapCancel(run, instId, ordId, json) {
9247
- const result = await run("swap_cancel_order", { instId, ordId });
9242
+ async function cmdSwapCancel(run, opts) {
9243
+ const { instId, ordId, clOrdId, json } = opts;
9244
+ if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
9245
+ const result = await run("swap_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
9248
9246
  const data = getData4(result);
9249
9247
  if (json) return printJson(data);
9250
9248
  const r = data?.[0];
@@ -9552,8 +9550,10 @@ async function cmdFuturesPlace(run, opts) {
9552
9550
  process.stdout.write(`Order placed: ${order?.["ordId"]} (${order?.["sCode"] === "0" ? "OK" : order?.["sMsg"]})
9553
9551
  `);
9554
9552
  }
9555
- async function cmdFuturesCancel(run, instId, ordId, json) {
9556
- const result = await run("futures_cancel_order", { instId, ordId });
9553
+ async function cmdFuturesCancel(run, opts) {
9554
+ const { instId, ordId, clOrdId, json } = opts;
9555
+ if (!ordId && !clOrdId) throw new Error("Either --ordId or --clOrdId is required");
9556
+ const result = await run("futures_cancel_order", { instId, ...ordId ? { ordId } : { clOrdId } });
9557
9557
  const data = getData5(result);
9558
9558
  if (json) return printJson(data);
9559
9559
  const r = data?.[0];
@@ -11002,7 +11002,7 @@ async function cmdDcdQuoteAndBuy(run, opts) {
11002
11002
  // src/index.ts
11003
11003
  var _require3 = createRequire3(import.meta.url);
11004
11004
  var CLI_VERSION2 = _require3("../package.json").version;
11005
- var GIT_HASH2 = true ? "50eb95e" : "dev";
11005
+ var GIT_HASH2 = true ? "c00f777" : "dev";
11006
11006
  function handleConfigCommand(action, rest, json, lang, force) {
11007
11007
  if (action === "init") return cmdConfigInit(lang === "zh" ? "zh" : "en");
11008
11008
  if (action === "show") return cmdConfigShow(json);
@@ -11197,7 +11197,7 @@ function handleSpotCommand(run, action, rest, v, json) {
11197
11197
  json
11198
11198
  });
11199
11199
  if (action === "cancel")
11200
- return cmdSpotCancel(run, v.instId, v.ordId, json);
11200
+ return cmdSpotCancel(run, { instId: v.instId ?? rest[0], ordId: v.ordId, clOrdId: v.clOrdId, json });
11201
11201
  if (action === "algo")
11202
11202
  return handleSpotAlgoCommand(run, rest[0], v, json);
11203
11203
  if (action === "batch")
@@ -11256,9 +11256,9 @@ function handleSwapAlgoCommand(run, subAction, v, json) {
11256
11256
  json
11257
11257
  });
11258
11258
  }
11259
- function handleSwapCommand(run, action, rest, v, json) {
11259
+ function handleSwapQuery(run, action, rest, v, json) {
11260
11260
  if (action === "positions")
11261
- return cmdSwapPositions(run, rest[0] ?? v.instId, json);
11261
+ return cmdSwapPositions(run, v.instId ?? rest[0], json);
11262
11262
  if (action === "orders")
11263
11263
  return cmdSwapOrders(run, {
11264
11264
  instId: v.instId,
@@ -11274,6 +11274,13 @@ function handleSwapCommand(run, action, rest, v, json) {
11274
11274
  archive: v.archive ?? false,
11275
11275
  json
11276
11276
  });
11277
+ if (action === "get-leverage")
11278
+ return cmdSwapGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
11279
+ return void 0;
11280
+ }
11281
+ function handleSwapCommand(run, action, rest, v, json) {
11282
+ const queryResult = handleSwapQuery(run, action, rest, v, json);
11283
+ if (queryResult !== void 0) return queryResult;
11277
11284
  if (action === "close")
11278
11285
  return cmdSwapClose(run, {
11279
11286
  instId: v.instId,
@@ -11282,8 +11289,6 @@ function handleSwapCommand(run, action, rest, v, json) {
11282
11289
  autoCxl: v.autoCxl,
11283
11290
  json
11284
11291
  });
11285
- if (action === "get-leverage")
11286
- return cmdSwapGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
11287
11292
  if (action === "place")
11288
11293
  return cmdSwapPlace(run, {
11289
11294
  instId: v.instId,
@@ -11300,7 +11305,7 @@ function handleSwapCommand(run, action, rest, v, json) {
11300
11305
  json
11301
11306
  });
11302
11307
  if (action === "cancel")
11303
- return cmdSwapCancel(run, v.instId, v.ordId, json);
11308
+ return cmdSwapCancel(run, { instId: v.instId ?? rest[0], ordId: v.ordId, clOrdId: v.clOrdId, json });
11304
11309
  if (action === "amend")
11305
11310
  return cmdSwapAmend(run, {
11306
11311
  instId: v.instId,
@@ -11467,7 +11472,7 @@ function resolveFuturesOrdersStatus(v) {
11467
11472
  if (v.history) return "history";
11468
11473
  return "open";
11469
11474
  }
11470
- function handleFuturesCommand(run, action, rest, v, json) {
11475
+ function handleFuturesQuery(run, action, v, json) {
11471
11476
  if (action === "orders")
11472
11477
  return cmdFuturesOrders(run, { instId: v.instId, status: resolveFuturesOrdersStatus(v), json });
11473
11478
  if (action === "positions") return cmdFuturesPositions(run, v.instId, json);
@@ -11478,6 +11483,15 @@ function handleFuturesCommand(run, action, rest, v, json) {
11478
11483
  archive: v.archive ?? false,
11479
11484
  json
11480
11485
  });
11486
+ if (action === "get")
11487
+ return cmdFuturesGet(run, { instId: v.instId, ordId: v.ordId, json });
11488
+ if (action === "get-leverage")
11489
+ return cmdFuturesGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
11490
+ return void 0;
11491
+ }
11492
+ function handleFuturesCommand(run, action, rest, v, json) {
11493
+ const queryResult = handleFuturesQuery(run, action, v, json);
11494
+ if (queryResult !== void 0) return queryResult;
11481
11495
  if (action === "place")
11482
11496
  return cmdFuturesPlace(run, {
11483
11497
  instId: v.instId,
@@ -11495,9 +11509,7 @@ function handleFuturesCommand(run, action, rest, v, json) {
11495
11509
  json
11496
11510
  });
11497
11511
  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 });
11512
+ return cmdFuturesCancel(run, { instId: v.instId ?? rest[0], ordId: v.ordId, clOrdId: v.clOrdId, json });
11501
11513
  if (action === "amend")
11502
11514
  return cmdFuturesAmend(run, {
11503
11515
  instId: v.instId,
@@ -11515,8 +11527,6 @@ function handleFuturesCommand(run, action, rest, v, json) {
11515
11527
  autoCxl: v.autoCxl,
11516
11528
  json
11517
11529
  });
11518
- if (action === "get-leverage")
11519
- return cmdFuturesGetLeverage(run, { instId: v.instId, mgnMode: v.mgnMode, json });
11520
11530
  if (action === "leverage")
11521
11531
  return cmdFuturesSetLeverage(run, {
11522
11532
  instId: v.instId,