@okx_ai/okx-trade-mcp 1.2.9-beta.2 → 1.2.9
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 +33 -10
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -21
- package/scripts/postinstall-download.js +0 -152
package/dist/index.js
CHANGED
|
@@ -4134,7 +4134,7 @@ function registerDcdTools() {
|
|
|
4134
4134
|
{
|
|
4135
4135
|
name: "dcd_get_products",
|
|
4136
4136
|
module: "earn.dcd",
|
|
4137
|
-
description: "Get DCD products with yield and quota info.",
|
|
4137
|
+
description: "Get DCD products with yield and quota info. Yields in response are decimal fractions, not percentages.",
|
|
4138
4138
|
isWrite: false,
|
|
4139
4139
|
inputSchema: {
|
|
4140
4140
|
type: "object",
|
|
@@ -4188,7 +4188,7 @@ function registerDcdTools() {
|
|
|
4188
4188
|
{
|
|
4189
4189
|
name: "dcd_get_orders",
|
|
4190
4190
|
module: "earn.dcd",
|
|
4191
|
-
description: "Get DCD order history.",
|
|
4191
|
+
description: "Get DCD order history. Yields in response are decimal fractions, not percentages.",
|
|
4192
4192
|
isWrite: false,
|
|
4193
4193
|
inputSchema: {
|
|
4194
4194
|
type: "object",
|
|
@@ -4232,7 +4232,7 @@ function registerDcdTools() {
|
|
|
4232
4232
|
{
|
|
4233
4233
|
name: "dcd_subscribe",
|
|
4234
4234
|
module: "earn.dcd",
|
|
4235
|
-
description: "Subscribe to a DCD product: get quote and execute atomically. Confirm product, amount, and currency with user before calling. Optional minAnnualizedYield
|
|
4235
|
+
description: "Subscribe to a DCD product: get quote and execute atomically. Confirm product, amount, and currency with user before calling. Optional minAnnualizedYield rejects the order if quote yield falls below threshold. Returns order result with quote snapshot (minAnnualizedYield is in percent; response yields are decimal fractions).",
|
|
4236
4236
|
isWrite: true,
|
|
4237
4237
|
inputSchema: {
|
|
4238
4238
|
type: "object",
|
|
@@ -4271,13 +4271,23 @@ function registerDcdTools() {
|
|
|
4271
4271
|
});
|
|
4272
4272
|
}
|
|
4273
4273
|
if (minAnnualizedYield !== void 0) {
|
|
4274
|
-
const
|
|
4275
|
-
if (
|
|
4274
|
+
const rawYield = parseFloat(quote["annualizedYield"]);
|
|
4275
|
+
if (isNaN(rawYield)) {
|
|
4276
4276
|
throw new OkxApiError(
|
|
4277
|
-
|
|
4277
|
+
"Quote returned non-numeric annualizedYield, cannot verify minimum yield threshold.",
|
|
4278
|
+
{
|
|
4279
|
+
code: "INVALID_YIELD_VALUE",
|
|
4280
|
+
suggestion: "Order not placed. The quote did not include a valid annualizedYield. Retry or pick a different product."
|
|
4281
|
+
}
|
|
4282
|
+
);
|
|
4283
|
+
}
|
|
4284
|
+
const actualYieldPct = rawYield * 100;
|
|
4285
|
+
if (actualYieldPct < minAnnualizedYield) {
|
|
4286
|
+
throw new OkxApiError(
|
|
4287
|
+
`Quote yield ${actualYieldPct.toFixed(2)}% is below the minimum threshold of ${minAnnualizedYield}%.`,
|
|
4278
4288
|
{
|
|
4279
4289
|
code: "YIELD_BELOW_MIN",
|
|
4280
|
-
suggestion: `Order not placed. Actual: ${
|
|
4290
|
+
suggestion: `Order not placed. Actual: ${actualYieldPct.toFixed(2)}%, required: >= ${minAnnualizedYield}%. Try a different product or lower your minimum yield.`
|
|
4281
4291
|
}
|
|
4282
4292
|
);
|
|
4283
4293
|
}
|
|
@@ -5849,7 +5859,12 @@ function registerOptionTools() {
|
|
|
5849
5859
|
},
|
|
5850
5860
|
sz: {
|
|
5851
5861
|
type: "string",
|
|
5852
|
-
description: "Contracts count
|
|
5862
|
+
description: "Contracts count by default. Set tgtCcy=quote_ccy to use USDT amount instead."
|
|
5863
|
+
},
|
|
5864
|
+
tgtCcy: {
|
|
5865
|
+
type: "string",
|
|
5866
|
+
enum: ["base_ccy", "quote_ccy"],
|
|
5867
|
+
description: "Size unit. base_ccy(default): sz in contracts, quote_ccy: sz in USDT (auto-converted to contracts)"
|
|
5853
5868
|
},
|
|
5854
5869
|
px: {
|
|
5855
5870
|
type: "string",
|
|
@@ -5886,6 +5901,13 @@ function registerOptionTools() {
|
|
|
5886
5901
|
const args = asRecord(rawArgs);
|
|
5887
5902
|
const reduceOnly = args.reduceOnly;
|
|
5888
5903
|
const attachAlgoOrds = buildAttachAlgoOrds(args);
|
|
5904
|
+
const resolved = await resolveQuoteCcySz(
|
|
5905
|
+
requireString(args, "instId"),
|
|
5906
|
+
requireString(args, "sz"),
|
|
5907
|
+
readString(args, "tgtCcy"),
|
|
5908
|
+
"OPTION",
|
|
5909
|
+
context.client
|
|
5910
|
+
);
|
|
5889
5911
|
const response = await context.client.privatePost(
|
|
5890
5912
|
"/api/v5/trade/order",
|
|
5891
5913
|
compactObject({
|
|
@@ -5893,7 +5915,8 @@ function registerOptionTools() {
|
|
|
5893
5915
|
tdMode: requireString(args, "tdMode"),
|
|
5894
5916
|
side: requireString(args, "side"),
|
|
5895
5917
|
ordType: requireString(args, "ordType"),
|
|
5896
|
-
sz:
|
|
5918
|
+
sz: resolved.sz,
|
|
5919
|
+
tgtCcy: resolved.tgtCcy,
|
|
5897
5920
|
px: readString(args, "px"),
|
|
5898
5921
|
reduceOnly: typeof reduceOnly === "boolean" ? String(reduceOnly) : void 0,
|
|
5899
5922
|
clOrdId: readString(args, "clOrdId"),
|
|
@@ -7477,7 +7500,7 @@ var _require = createRequire(import.meta.url);
|
|
|
7477
7500
|
var pkg = _require("../package.json");
|
|
7478
7501
|
var SERVER_NAME = "okx-trade-mcp";
|
|
7479
7502
|
var SERVER_VERSION = pkg.version;
|
|
7480
|
-
var GIT_HASH = true ? "
|
|
7503
|
+
var GIT_HASH = true ? "f1f0625" : "dev";
|
|
7481
7504
|
|
|
7482
7505
|
// src/server.ts
|
|
7483
7506
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|