@pionex/pionex-ai-kit 0.2.38 → 0.2.40
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 +65 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1946,7 +1946,7 @@ function registerBotTools() {
|
|
|
1946
1946
|
condition: { type: "string" },
|
|
1947
1947
|
conditionDirection: { type: "string", enum: ["1", "-1"] },
|
|
1948
1948
|
slippage: { type: "string" },
|
|
1949
|
-
|
|
1949
|
+
adjustParamsScene: { type: "string" }
|
|
1950
1950
|
},
|
|
1951
1951
|
required: ["buOrderId", "type", "extraMargin"]
|
|
1952
1952
|
},
|
|
@@ -1999,7 +1999,7 @@ function registerBotTools() {
|
|
|
1999
1999
|
body.conditionDirection = conditionDirection;
|
|
2000
2000
|
}
|
|
2001
2001
|
if (args.slippage != null) body.slippage = String(args.slippage);
|
|
2002
|
-
if (args.
|
|
2002
|
+
if (args.adjustParamsScene != null) body.adjustParamsScene = String(args.adjustParamsScene);
|
|
2003
2003
|
return (await client.signedPost("/api/v1/bot/orders/futuresGrid/adjustParams", body)).data;
|
|
2004
2004
|
}
|
|
2005
2005
|
},
|
|
@@ -2040,6 +2040,43 @@ function registerBotTools() {
|
|
|
2040
2040
|
return (await client.signedPost("/api/v1/bot/orders/futuresGrid/reduce", body)).data;
|
|
2041
2041
|
}
|
|
2042
2042
|
},
|
|
2043
|
+
{
|
|
2044
|
+
name: "pionex_bot_order_list",
|
|
2045
|
+
module: "bot",
|
|
2046
|
+
isWrite: false,
|
|
2047
|
+
description: "List bot orders with optional filters and pagination. status: 'running' (default) or 'canceled'. buOrderTypes: one or more of futures_grid, spot_grid, smart_copy. Endpoint: GET /api/v1/bot/orders",
|
|
2048
|
+
inputSchema: {
|
|
2049
|
+
type: "object",
|
|
2050
|
+
additionalProperties: false,
|
|
2051
|
+
properties: {
|
|
2052
|
+
status: {
|
|
2053
|
+
type: "string",
|
|
2054
|
+
enum: ["running", "canceled"],
|
|
2055
|
+
description: "Filter by order status. Default: 'running'."
|
|
2056
|
+
},
|
|
2057
|
+
base: { type: "string", description: "Base currency filter (e.g. BTC)." },
|
|
2058
|
+
quote: { type: "string", description: "Quote currency filter (e.g. USDT)." },
|
|
2059
|
+
pageToken: { type: "string", description: "Pagination token from a previous response." },
|
|
2060
|
+
buOrderTypes: {
|
|
2061
|
+
type: "array",
|
|
2062
|
+
items: { type: "string", enum: ["futures_grid", "spot_grid", "smart_copy"] },
|
|
2063
|
+
description: "Bot type filter: futures_grid, spot_grid, smart_copy. Omit to return all types."
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
required: []
|
|
2067
|
+
},
|
|
2068
|
+
async handler(args, { client }) {
|
|
2069
|
+
const q = {};
|
|
2070
|
+
if (args.status != null) q.status = String(args.status);
|
|
2071
|
+
if (args.base != null) q.base = String(args.base);
|
|
2072
|
+
if (args.quote != null) q.quote = String(args.quote);
|
|
2073
|
+
if (args.pageToken != null) q.pageToken = String(args.pageToken);
|
|
2074
|
+
if (Array.isArray(args.buOrderTypes) && args.buOrderTypes.length > 0) {
|
|
2075
|
+
q.buOrderTypes = args.buOrderTypes.join(",");
|
|
2076
|
+
}
|
|
2077
|
+
return (await client.signedGet("/api/v1/bot/orders", q)).data;
|
|
2078
|
+
}
|
|
2079
|
+
},
|
|
2043
2080
|
{
|
|
2044
2081
|
name: "pionex_bot_futures_grid_cancel",
|
|
2045
2082
|
module: "bot",
|
|
@@ -2531,19 +2568,20 @@ Groups:
|
|
|
2531
2568
|
Examples:
|
|
2532
2569
|
pionex-trade-cli market depth BTC_USDT --limit 5
|
|
2533
2570
|
pionex-trade-cli market tickers --symbol BTC_USDT
|
|
2534
|
-
pionex-trade-cli market
|
|
2571
|
+
pionex-trade-cli market book_tickers --symbol BTC_USDT
|
|
2535
2572
|
pionex-trade-cli market symbols --symbols BTC_USDT
|
|
2536
2573
|
pionex-trade-cli account balance
|
|
2537
2574
|
pionex-trade-cli orders new --symbol BTC_USDT --side BUY --type MARKET --amount 10
|
|
2538
2575
|
pionex-trade-cli orders cancel --symbol BTC_USDT --order-id 123
|
|
2539
|
-
pionex-trade-cli orders
|
|
2576
|
+
pionex-trade-cli orders fills_by_order_id --symbol BTC_USDT --order-id 123
|
|
2577
|
+
pionex-trade-cli bot order_list [--status running|canceled] [--base BTC] [--quote USDT] [--page-token <token>] [--bu-order-types futures_grid,spot_grid,smart_copy]
|
|
2540
2578
|
pionex-trade-cli bot futures_grid get --bu-order-id <id>
|
|
2541
2579
|
pionex-trade-cli bot futures_grid create --base BTC --quote USDT --bu-order-data-json '{"top":"110000","bottom":"90000","row":100,"grid_type":"arithmetic","trend":"long","leverage":5,"quoteInvestment":"100"}'
|
|
2542
2580
|
pionex-trade-cli earn dual symbols --base BTC
|
|
2543
|
-
pionex-trade-cli earn dual
|
|
2581
|
+
pionex-trade-cli earn dual open_products --base BTC --quote USDXO --type DUAL_BASE --currency USDT
|
|
2544
2582
|
pionex-trade-cli earn dual prices --base BTC --quote USDXO --product-ids BTC-USDXO-260402-68000-P-USDT
|
|
2545
2583
|
pionex-trade-cli earn dual invest --base BTC --product-id BTC-USDXO-260402-68000-P-USDT --currency-amount 100 --profit 0.0039
|
|
2546
|
-
pionex-trade-cli earn dual
|
|
2584
|
+
pionex-trade-cli earn dual revoke_invest --base BTC --client-dual-id my-order-001 --dry-run
|
|
2547
2585
|
pionex-trade-cli earn dual collect --base BTC --client-dual-id my-order-001 --dry-run
|
|
2548
2586
|
|
|
2549
2587
|
Global flags:
|
|
@@ -2637,7 +2675,7 @@ async function runPionexCommand(argv) {
|
|
|
2637
2675
|
process.stdout.write(JSON.stringify(out.data, null, 2) + "\n");
|
|
2638
2676
|
return;
|
|
2639
2677
|
}
|
|
2640
|
-
if (command === "
|
|
2678
|
+
if (command === "book_tickers" || command === "bookTickers") {
|
|
2641
2679
|
const symbol = typeof flags.symbol === "string" ? flags.symbol : void 0;
|
|
2642
2680
|
const type = typeof flags.type === "string" ? flags.type : void 0;
|
|
2643
2681
|
const out = await runTool("pionex_market_get_book_tickers", { symbol, type });
|
|
@@ -2716,7 +2754,7 @@ async function runPionexCommand(argv) {
|
|
|
2716
2754
|
process.stdout.write(JSON.stringify(out.data, null, 2) + "\n");
|
|
2717
2755
|
return;
|
|
2718
2756
|
}
|
|
2719
|
-
if (command === "
|
|
2757
|
+
if (command === "fills_by_order_id" || command === "fillsByOrderId") {
|
|
2720
2758
|
const symbol = typeof flags.symbol === "string" ? flags.symbol : void 0;
|
|
2721
2759
|
const orderId = flags["order-id"] != null ? Number(flags["order-id"]) : void 0;
|
|
2722
2760
|
if (!symbol || orderId == null) throw new Error("Missing required flags: --symbol --order-id");
|
|
@@ -2753,9 +2791,26 @@ async function runPionexCommand(argv) {
|
|
|
2753
2791
|
}
|
|
2754
2792
|
if (group === "bot") {
|
|
2755
2793
|
const botRoute = positionals[1];
|
|
2794
|
+
if (botRoute === "order_list") {
|
|
2795
|
+
const status = typeof flags.status === "string" ? flags.status : void 0;
|
|
2796
|
+
const base = typeof flags.base === "string" ? flags.base : void 0;
|
|
2797
|
+
const quote = typeof flags.quote === "string" ? flags.quote : void 0;
|
|
2798
|
+
const pageToken = typeof flags["page-token"] === "string" ? flags["page-token"] : typeof flags.pageToken === "string" ? flags.pageToken : void 0;
|
|
2799
|
+
const buOrderTypesRaw = typeof flags["bu-order-types"] === "string" ? flags["bu-order-types"] : typeof flags.buOrderTypes === "string" ? flags.buOrderTypes : void 0;
|
|
2800
|
+
const buOrderTypes = buOrderTypesRaw ? buOrderTypesRaw.split(",").map((s) => s.trim()) : void 0;
|
|
2801
|
+
const out = await runTool("pionex_bot_order_list", {
|
|
2802
|
+
status,
|
|
2803
|
+
base,
|
|
2804
|
+
quote,
|
|
2805
|
+
pageToken,
|
|
2806
|
+
buOrderTypes
|
|
2807
|
+
});
|
|
2808
|
+
process.stdout.write(JSON.stringify(out.data, null, 2) + "\n");
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2756
2811
|
if (!botRoute || botRoute !== "futures_grid") {
|
|
2757
2812
|
throw new Error(
|
|
2758
|
-
`Missing or unknown bot route: ${botRoute ?? "(none)"}. Use: pionex-trade-cli bot futures_grid <get|create|adjust_params|reduce|cancel> ...`
|
|
2813
|
+
`Missing or unknown bot route: ${botRoute ?? "(none)"}. Use: pionex-trade-cli bot order_list [...] or bot futures_grid <get|create|adjust_params|reduce|cancel> ...`
|
|
2759
2814
|
);
|
|
2760
2815
|
}
|
|
2761
2816
|
if (!command) {
|
|
@@ -2828,7 +2883,7 @@ async function runPionexCommand(argv) {
|
|
|
2828
2883
|
process.stdout.write(JSON.stringify(out.data, null, 2) + "\n");
|
|
2829
2884
|
return;
|
|
2830
2885
|
}
|
|
2831
|
-
throw new Error(`Unknown futures_grid command: ${command}`);
|
|
2886
|
+
throw new Error(`Unknown futures_grid command: ${command}. Available: get, create, adjust_params, reduce, cancel`);
|
|
2832
2887
|
}
|
|
2833
2888
|
if (group === "earn") {
|
|
2834
2889
|
const earnRoute = positionals[1];
|